fix(tray): Correct alignment coords
This commit is contained in:
parent
4c2d710169
commit
24df9e30a3
@ -280,12 +280,20 @@ void bar::bootstrap_tray() {
|
|||||||
settings.width *= scale;
|
settings.width *= scale;
|
||||||
settings.height_fill *= scale;
|
settings.height_fill *= scale;
|
||||||
|
|
||||||
if (settings.align == alignment::RIGHT) {
|
auto inner_area = m_opts.inner_area(true);
|
||||||
settings.orig_x = m_opts.pos.x + m_opts.size.w - m_opts.borders.at(edge::RIGHT).size;
|
|
||||||
} else if (settings.align == alignment::LEFT) {
|
switch (settings.align) {
|
||||||
settings.orig_x = m_opts.pos.x + m_opts.borders.at(edge::LEFT).size;
|
case alignment::NONE:
|
||||||
} else if (settings.align == alignment::CENTER) {
|
break;
|
||||||
settings.orig_x = m_opts.pos.x + m_opts.center.x - (settings.width / 2);
|
case alignment::LEFT:
|
||||||
|
settings.orig_x = inner_area.x;
|
||||||
|
break;
|
||||||
|
case alignment::CENTER:
|
||||||
|
settings.orig_x = inner_area.x + inner_area.width / 2 - settings.width / 2;
|
||||||
|
break;
|
||||||
|
case alignment::RIGHT:
|
||||||
|
settings.orig_x = inner_area.x + inner_area.width;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set user-defined background color
|
// Set user-defined background color
|
||||||
|
@ -210,27 +210,20 @@ void renderer::flush(bool clear) {
|
|||||||
|
|
||||||
// Calculate the area that was reserved so that we
|
// Calculate the area that was reserved so that we
|
||||||
// can clear any previous content drawn at the same location
|
// can clear any previous content drawn at the same location
|
||||||
xcb_rectangle_t clear_area{0, 0, 0U, 0U};
|
xcb_rectangle_t clear_area{r.x, r.y, r.width, r.height};
|
||||||
|
|
||||||
if (m_cleararea.size && m_cleararea.side == edge::RIGHT) {
|
if (m_cleararea.size && m_cleararea.side == edge::RIGHT) {
|
||||||
clear_area.x = m_bar.size.w - m_cleararea.size - right.width;
|
clear_area.x += r.width;
|
||||||
clear_area.y = 0;
|
clear_area.y = top.height;
|
||||||
clear_area.width = m_cleararea.size;
|
clear_area.width = m_cleararea.size;
|
||||||
clear_area.height = m_bar.size.h;
|
|
||||||
} else if (m_cleararea.size && m_cleararea.side == edge::LEFT) {
|
} else if (m_cleararea.size && m_cleararea.side == edge::LEFT) {
|
||||||
clear_area.x = left.width;
|
clear_area.x = left.width;
|
||||||
clear_area.y = top.height;
|
clear_area.y = top.height;
|
||||||
clear_area.width = m_cleararea.size;
|
clear_area.width = m_cleararea.size;
|
||||||
clear_area.height = m_rect.height;
|
|
||||||
} else if (m_cleararea.size && m_cleararea.side == edge::TOP) {
|
} else if (m_cleararea.size && m_cleararea.side == edge::TOP) {
|
||||||
clear_area.x = m_rect.x;
|
|
||||||
clear_area.y = m_rect.y;
|
|
||||||
clear_area.width = m_rect.width;
|
|
||||||
clear_area.height = m_cleararea.size;
|
clear_area.height = m_cleararea.size;
|
||||||
} else if (m_cleararea.size && m_cleararea.side == edge::TOP) {
|
} else if (m_cleararea.size && m_cleararea.side == edge::BOTTOM) {
|
||||||
clear_area.x = m_rect.x;
|
clear_area.y += r.height - m_cleararea.size;
|
||||||
clear_area.y = m_rect.y + m_rect.height - m_cleararea.size;
|
|
||||||
clear_area.width = m_rect.width;
|
|
||||||
clear_area.height = m_cleararea.size;
|
clear_area.height = m_cleararea.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user