From c47280236f2e6d3cb9aa267184a4081ec4e844c6 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sat, 10 Jan 2015 22:53:37 +0100 Subject: Fix order of reconfigure the theme of an IconButton The font might have an impact to the result of width() and height(). In order to render the new pixmap correctly fluxbox now first sets the font and the width of the border and after that it recreates the pixmap. --- src/IconButton.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/IconButton.cc b/src/IconButton.cc index f7b4f5f..f1dd1f0 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc @@ -142,28 +142,24 @@ void IconButton::setPixmap(bool use) { void IconButton::reconfigTheme() { - if (m_theme->texture().usePixmap()) + setFont(m_theme->text().font()); + setGC(m_theme->text().textGC()); + setBorderWidth(m_theme->border().width()); + setBorderColor(m_theme->border().color()); + setJustify(m_theme->text().justify()); + setAlpha(parent()->alpha()); + + if (m_theme->texture().usePixmap()) { m_pm.reset(m_win.screen().imageControl().renderImage( width(), height(), m_theme->texture(), orientation())); - else - m_pm.reset(0); - - setAlpha(parent()->alpha()); - - if (m_pm != 0) setBackgroundPixmap(m_pm); - else + } else{ + m_pm.reset(0); setBackgroundColor(m_theme->texture().color()); - - setGC(m_theme->text().textGC()); - setFont(m_theme->text().font()); - setJustify(m_theme->text().justify()); - setBorderWidth(m_theme->border().width()); - setBorderColor(m_theme->border().color()); + } updateBackground(false); - } void IconButton::reconfigAndClear() { -- cgit v0.11.2