diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-10-02 12:32:47 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-10-02 13:53:24 (GMT) |
commit | 3301e993ada9fc794dcbba65e8ee28c1ebe5621a (patch) | |
tree | c413f0fccbafc5268d830776627774aa1a7e0284 | |
parent | a375fdb1832db072008fab5e8e6d2c56372f31ad (diff) | |
download | fluxbox-3301e993ada9fc794dcbba65e8ee28c1ebe5621a.zip fluxbox-3301e993ada9fc794dcbba65e8ee28c1ebe5621a.tar.bz2 |
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)
-rw-r--r-- | src/IconButton.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc index d8205fb..a4cd8af 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -288,7 +288,13 @@ bool IconButton::setOrientation(FbTk::Orientation orient) { | |||
288 | } | 288 | } |
289 | 289 | ||
290 | unsigned int IconButton::preferredWidth() const { | 290 | unsigned int IconButton::preferredWidth() const { |
291 | IconButton *that = const_cast<IconButton*>(this); | ||
292 | that->setFont(that->m_theme.focusedTheme()->text().font()); | ||
291 | unsigned int r = TextButton::preferredWidth(); | 293 | unsigned int r = TextButton::preferredWidth(); |
294 | that->setFont(that->m_theme.unfocusedTheme()->text().font()); | ||
295 | unsigned int r2 = TextButton::preferredWidth(); | ||
296 | that->setFont(that->m_theme->text().font()); | ||
297 | r = std::max(r, r2); | ||
292 | if (m_icon_pixmap.drawable()) | 298 | if (m_icon_pixmap.drawable()) |
293 | r += m_icon_window.width() + 1; | 299 | r += m_icon_window.width() + 1; |
294 | return r; | 300 | return r; |