From 5d2deb1a99d906524905e446aa9f8ab4ff2bd23a Mon Sep 17 00:00:00 2001 From: Vasili Karaev Date: Sun, 12 Nov 2017 11:53:54 +0300 Subject: [PATCH] fix(renderer): Only draw text bg if color differs from bar bg (#831) Fixes #759 by only drawing text background when its color is different from the background color of the bar itself. Explicitly setting a module's background to `background-0` now stops working. --- src/components/renderer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp index 1fe264e4..77017901 100644 --- a/src/components/renderer.cpp +++ b/src/components/renderer.cpp @@ -602,7 +602,11 @@ void renderer::draw_text(const string& contents) { block.y_advance = &m_blocks[m_align].y; block.bg_rect = cairo::rect{0.0, 0.0, 0.0, 0.0}; - if (m_bg) { + // Only draw text background if the color differs from + // the background color of the bar itself + // Note: this means that if the user explicitly set text + // background color equal to background-0 it will be ignored + if (m_bg != m_bar.background) { block.bg = m_bg; block.bg_operator = m_comp_bg; block.bg_rect.x = m_rect.x;