From fff4c906b321aedc5fa2519cddecf103d0f7d8aa Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 7 Sep 2005 23:19:08 +0000 Subject: bugfix for client menu --- src/FbTk/Menu.cc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 25c000e..3aa88b0 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -447,7 +447,7 @@ void Menu::updateMenu(int active_index) { // the rest can wait until the end menu.window.resize(new_width, new_height); - if (!m_visible) + if (!isVisible()) return; if (menu.frame.alpha() != alpha()) @@ -524,18 +524,17 @@ void Menu::updateMenu(int active_index) { void Menu::show() { - if (m_visible) + if (isVisible()) return; - if (m_need_update) { - m_visible = true; + m_visible = true; + + if (m_need_update) updateMenu(); - } menu.window.showSubwindows(); menu.window.show(); raise(); - m_visible = true; if (! m_parent && shown != this) { if (shown && (! shown->m_torn)) @@ -552,7 +551,6 @@ void Menu::hide() { if (!isVisible()) return; - // if not m_torn and parent is m_visible, go to first parent // and hide it if (!m_torn && m_parent && m_parent->isVisible()) { @@ -675,10 +673,11 @@ void Menu::drawSubmenu(unsigned int index) { if (index >= menuitems.size()) return; + MenuItem *item = menuitems[index]; - if (item->submenu() && m_visible && (! item->submenu()->isTorn()) && + if (item->submenu() && isVisible() && (! item->submenu()->isTorn()) && item->isEnabled()) { - + if (item->submenu()->m_parent != this) item->submenu()->m_parent = this; @@ -951,16 +950,17 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { if (w == m_active_index) return; - - if (validIndex(m_active_index) && w != m_active_index) { - int old = m_active_index; + + + if (validIndex(m_active_index) && w != m_active_index) { + int old_active_index = m_active_index; m_active_index = -1; - MenuItem *item = menuitems[old]; + MenuItem *item = menuitems[old_active_index]; if (item != 0) { - clearItem(old); + clearItem(old_active_index); if (item->submenu()) { if (item->submenu()->isVisible() && @@ -1006,7 +1006,6 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { timeout.tv_usec = theme().delayOpen() * 1000; // transformed to usec m_submenu_timer.setTimeout(timeout); m_submenu_timer.start(); - } } else if (isItemSelectable(w)){ @@ -1172,6 +1171,7 @@ void Menu::reconfigure() { void Menu::openSubmenu() { + if (!isVisible() || ! validIndex(m_which_press) || ! validIndex(m_which_sbl)) return; @@ -1181,8 +1181,14 @@ void Menu::openSubmenu() { return; clearItem(item); - if (menuitems[item]->submenu() != 0 && !menuitems[item]->submenu()->isVisible()) + + if (menuitems[item]->submenu() != 0) { + // stop hide timer, so it doesnt hides the menu if we + // have the same submenu as the last shown submenu + // (window menu for clients inside workspacemenu for example) + menuitems[item]->submenu()->m_hide_timer.stop(); drawSubmenu(item); + } } -- cgit v0.11.2