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
1 files changed,
6 insertions(+),
0 deletions(-)
jump to
M
src/IconButton.cc
→
src/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;