fix highlighted menu item on mouse out
Mark Tiefenbruck mark@fluxbox.org
2 files changed,
14 insertions(+),
2 deletions(-)
M
src/FbTk/Menu.cc
→
src/FbTk/Menu.cc
@@ -832,8 +832,7 @@ // if there's a submenu open, focus it instead
if (validIndex(m_which_sub) && menuitems[m_which_sub]->submenu()->isVisible()) menuitems[m_which_sub]->submenu()->grabInputFocus(); - } else if (event.type == LeaveNotify) - m_closing = false; + } } void Menu::buttonPressEvent(XButtonEvent &be) {@@ -1091,6 +1090,18 @@ break;
} } +void Menu::leaveNotifyEvent(XCrossingEvent &ce) { + m_closing = false; + // if there's a submenu open, highlight its index and stop hide + if (validIndex(m_which_sub) && m_active_index != m_which_sub && + menuitems[m_which_sub]->submenu()->isVisible()) { + int old = m_active_index; + m_active_index = m_which_sub; + clearItem(m_active_index); + clearItem(old); + menuitems[m_which_sub]->submenu()->stopHide(); + } +} void Menu::reconfigure() { m_shape->setPlaces(theme()->shapePlaces());
M
src/FbTk/Menu.hh
→
src/FbTk/Menu.hh
@@ -103,6 +103,7 @@ virtual void buttonReleaseEvent(XButtonEvent &br);
void motionNotifyEvent(XMotionEvent &mn); void exposeEvent(XExposeEvent &ee); void keyPressEvent(XKeyEvent &ke); + void leaveNotifyEvent(XCrossingEvent &ce); //@} /// get input focus void grabInputFocus();