fix(tray): fix transparency after background manager changes

The systray only supports pseudo transparency (real transparency would require
much larger changes) so the real transparency should only be used for the bar itself.
This commit is contained in:
Benno Fünfstück
2018-07-06 15:19:12 +02:00
committed by Patrick Ziegler
parent 061fe83b2f
commit eacf5ce5ba
4 changed files with 22 additions and 32 deletions

View File

@ -175,6 +175,8 @@ renderer::renderer(
m_comp_ul = m_conf.get<cairo_operator_t>("settings", "compositing-underline", m_comp_ul);
m_comp_border = m_conf.get<cairo_operator_t>("settings", "compositing-border", m_comp_border);
m_pseudo_transparency = m_conf.get<bool>("settings", "pseudo-transparency", m_pseudo_transparency);
m_fixedcenter = m_conf.get(m_conf.section(), "fixed-center", true);
}
@ -503,14 +505,21 @@ void renderer::fill_background() {
m_context->save();
*m_context << m_comp_bg;
auto root_bg = m_background.get_surface();
if(root_bg != nullptr) {
m_log.trace_x("renderer: root background");
*m_context << *root_bg;
m_context->paint();
*m_context << CAIRO_OPERATOR_OVER;
// if using pseudo-transparency, fill the background with the root window's contents
// otherwise, we simply use a fully transparent base layer
if(m_pseudo_transparency) {
auto root_bg = m_background.get_surface();
if(root_bg != nullptr) {
m_log.trace_x("renderer: root background");
*m_context << *root_bg;
}
} else {
*m_context << (unsigned int)0;
}
m_context->paint();
*m_context << CAIRO_OPERATOR_OVER;
if (!m_bar.background_steps.empty()) {
m_log.trace_x("renderer: gradient background (steps=%lu)", m_bar.background_steps.size());
*m_context << cairo::linear_gradient{0.0, 0.0 + m_rect.y, 0.0, 0.0 + m_rect.height, m_bar.background_steps};