fix highlighted menu item on mouse out

This commit is contained in:
Mark Tiefenbruck 2008-02-08 18:36:06 -08:00
parent 3a8ec6512b
commit 26dafdafbe
2 changed files with 14 additions and 2 deletions

View file

@ -832,8 +832,7 @@ void Menu::handleEvent(XEvent &event) {
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 @@ void Menu::keyPressEvent(XKeyEvent &event) {
}
}
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());

View file

@ -103,6 +103,7 @@ public:
void motionNotifyEvent(XMotionEvent &mn);
void exposeEvent(XExposeEvent &ee);
void keyPressEvent(XKeyEvent &ke);
void leaveNotifyEvent(XCrossingEvent &ce);
//@}
/// get input focus
void grabInputFocus();