diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-04-11 21:57:18 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-07-01 18:14:04 (GMT) |
commit | ca452a58867b4ceaacb35c823902c89f2f6b6b83 (patch) | |
tree | 57ae780edf7026a50fbd61e4201b1fbe2b70db62 /src/FbTk/Menu.cc | |
parent | ea306493f95abd04cfa5b7653e3ad30a74b1985f (diff) | |
download | fluxbox-ca452a58867b4ceaacb35c823902c89f2f6b6b83.zip fluxbox-ca452a58867b4ceaacb35c823902c89f2f6b6b83.tar.bz2 |
ignore font for empty title height calculation
and align calculation on init and reconfigure
As a result, if a menu has no label, the title height is determined
only by menu.titleHeight (and the border sizes), not by the unused font.
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r-- | src/FbTk/Menu.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 484a399..34cc6ae 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -158,7 +158,7 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl): | |||
158 | event_mask |= EnterWindowMask | LeaveWindowMask; | 158 | event_mask |= EnterWindowMask | LeaveWindowMask; |
159 | 159 | ||
160 | int w = width(); | 160 | int w = width(); |
161 | int th = theme()->titleHeight(); | 161 | int th = theme()->titleHeight(!m_title.label.logical().empty()); |
162 | int fh = std::max(m_frame.height, m_frame.height); | 162 | int fh = std::max(m_frame.height, m_frame.height); |
163 | 163 | ||
164 | //create menu title | 164 | //create menu title |
@@ -395,7 +395,7 @@ void Menu::updateMenu() { | |||
395 | int bw = theme()->borderWidth(); | 395 | int bw = theme()->borderWidth(); |
396 | int ih = theme()->itemHeight(); | 396 | int ih = theme()->itemHeight(); |
397 | unsigned int iw = 1; | 397 | unsigned int iw = 1; |
398 | int th = theme()->titleHeight(); | 398 | int th = theme()->titleHeight(!m_title.label.logical().empty()); |
399 | int tbw = m_title.win.borderWidth(); | 399 | int tbw = m_title.win.borderWidth(); |
400 | int w = static_cast<int>(width()); | 400 | int w = static_cast<int>(width()); |
401 | size_t l = m_items.size(); | 401 | size_t l = m_items.size(); |
@@ -668,7 +668,7 @@ void Menu::redrawTitle(FbDrawable &drawable) { | |||
668 | } | 668 | } |
669 | 669 | ||
670 | // difference between height based on font, and style-set height | 670 | // difference between height based on font, and style-set height |
671 | int height_offset = theme()->titleHeight() - (font.height() + 2*dx); | 671 | int height_offset = theme()->titleHeight(!m_title.label.logical().empty()) - (font.height() + 2*dx); |
672 | font.drawText(drawable, screenNumber(), theme()->titleTextGC().gc(), m_title.label, | 672 | font.drawText(drawable, screenNumber(), theme()->titleTextGC().gc(), m_title.label, |
673 | dx, font.ascent() + dx + height_offset/2); // position | 673 | dx, font.ascent() + dx + height_offset/2); // position |
674 | } | 674 | } |
@@ -707,10 +707,10 @@ void Menu::drawSubmenu(unsigned int index) { | |||
707 | int bw = m_window.borderWidth(); | 707 | int bw = m_window.borderWidth(); |
708 | int h = static_cast<int>(height()); | 708 | int h = static_cast<int>(height()); |
709 | int title_bw = m_title.win.borderWidth(); | 709 | int title_bw = m_title.win.borderWidth(); |
710 | int title_height = (m_title.visible ? theme()->titleHeight() + title_bw : 0); | 710 | int title_height = (m_title.visible ? theme()->titleHeight(!m_title.label.logical().empty()) + title_bw : 0); |
711 | 711 | ||
712 | int subm_title_height = (item->submenu()->m_title.visible) ? | 712 | int subm_title_height = (item->submenu()->m_title.visible) ? |
713 | item->submenu()->theme()->titleHeight() + bw : 0; | 713 | item->submenu()->theme()->titleHeight(!m_title.label.logical().empty()) + bw : 0; |
714 | int subm_height = static_cast<int>(item->submenu()->height()); | 714 | int subm_height = static_cast<int>(item->submenu()->height()); |
715 | int subm_width = static_cast<int>(item->submenu()->width()); | 715 | int subm_width = static_cast<int>(item->submenu()->width()); |
716 | int subm_bw = item->submenu()->fbwindow().borderWidth(); | 716 | int subm_bw = item->submenu()->fbwindow().borderWidth(); |