all repos — fluxbox @ 3301e993ada9fc794dcbba65e8ee28c1ebe5621a

custom fork of the fluxbox windowmanager

Make preferredWidth max from un- and focused width

This is notably an issue if the focused font differs from the unfocused
font (eg. is bold or bigger)

Updating the value with the state leads to ugly judder (nasty when minimizing
a window through the iconbar) and not handling this causes random button
widths (depending on whether the button was focused when checking the value)
Thomas Lübking thomas.luebking@gmail.com
commit

3301e993ada9fc794dcbba65e8ee28c1ebe5621a

parent

a375fdb1832db072008fab5e8e6d2c56372f31ad

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M src/IconButton.ccsrc/IconButton.cc

@@ -288,7 +288,13 @@ return false;

} unsigned int IconButton::preferredWidth() const { + IconButton *that = const_cast<IconButton*>(this); + that->setFont(that->m_theme.focusedTheme()->text().font()); unsigned int r = TextButton::preferredWidth(); + that->setFont(that->m_theme.unfocusedTheme()->text().font()); + unsigned int r2 = TextButton::preferredWidth(); + that->setFont(that->m_theme->text().font()); + r = std::max(r, r2); if (m_icon_pixmap.drawable()) r += m_icon_window.width() + 1; return r;