From eb742e228b930eaff316252216dae0f66f16d236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Thu, 31 Aug 2017 15:07:48 +0200 Subject: [PATCH] fix(render): correctly handle semi-transparency for borders We need to fetch the outer area from the root window, not just the inner area because we paint the background below the borders as well. This has the nice effect of supporting semi-transparency for borders as well. --- include/components/types.hpp | 21 ++++++++++++++------- src/components/renderer.cpp | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/components/types.hpp b/include/components/types.hpp index 219612dd..1a1299ed 100644 --- a/include/components/types.hpp +++ b/include/components/types.hpp @@ -169,14 +169,8 @@ struct bar_settings { position shade_pos{1U, 1U}; const xcb_rectangle_t inner_area(bool abspos = false) const { - xcb_rectangle_t rect{0, 0, 0, 0}; - rect.width += size.w; - rect.height += size.h; + xcb_rectangle_t rect = this->outer_area(abspos); - if (abspos) { - rect.x = pos.x; - rect.y = pos.y; - } if (borders.find(edge::TOP) != borders.end()) { rect.y += borders.at(edge::TOP).size; rect.height -= borders.at(edge::TOP).size; @@ -193,6 +187,19 @@ struct bar_settings { } return rect; } + + const xcb_rectangle_t outer_area(bool abspos = false) const { + xcb_rectangle_t rect{0, 0, 0, 0}; + rect.width += size.w; + rect.height += size.h; + + if (abspos) { + rect.x = pos.x; + rect.y = pos.y; + } + + return rect; + } }; struct event_timer { diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp index f51546fc..5f3eebc7 100644 --- a/src/components/renderer.cpp +++ b/src/components/renderer.cpp @@ -166,7 +166,7 @@ renderer::renderer( } m_log.trace("Activate root background manager"); - m_background.activate(m_window, m_bar.inner_area(true)); + m_background.activate(m_window, m_bar.outer_area(true)); } m_comp_bg = m_conf.get("settings", "compositing-background", m_comp_bg);