fix(tray): Attached offset relative to inner area

This commit is contained in:
Michael Carlberg 2016-12-14 10:54:38 +01:00
parent 24df9e30a3
commit 8da52af6a2
1 changed files with 10 additions and 4 deletions

View File

@ -327,13 +327,19 @@ void bar::bootstrap_tray() {
auto offset_y = atoi(offset_y_def.c_str());
if (offset_x != 0 && offset_x_def.find('%') != string::npos) {
offset_x = math_util::percentage_to_value<int>(offset_x, m_opts.monitor->w);
offset_x -= settings.width / 2;
if (settings.detached) {
offset_x = math_util::percentage_to_value<int>(offset_x, m_opts.monitor->w);
} else {
offset_x = math_util::percentage_to_value<int>(offset_x, inner_area.width);
}
}
if (offset_y != 0 && offset_y_def.find('%') != string::npos) {
offset_y = math_util::percentage_to_value<int>(offset_y, m_opts.monitor->h);
offset_y -= settings.width / 2;
if (settings.detached) {
offset_y = math_util::percentage_to_value<int>(offset_y, m_opts.monitor->h);
} else {
offset_y = math_util::percentage_to_value<int>(offset_y, inner_area.height);
}
}
settings.orig_x += offset_x;