diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Menu.cc | 12 | ||||
-rw-r--r-- | src/FbTk/Menu.hh | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 8f795ac..0559f0d 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -596,7 +596,7 @@ void Menu::internal_hide(bool first) { | |||
596 | shown = (Menu *) 0; | 596 | shown = (Menu *) 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | m_torn = m_visible = false; | 599 | m_torn = m_visible = m_closing = false; |
600 | m_which_sub = -1; | 600 | m_which_sub = -1; |
601 | 601 | ||
602 | if (first && m_parent && m_parent->isVisible() && | 602 | if (first && m_parent && m_parent->isVisible() && |
@@ -831,12 +831,16 @@ void Menu::handleEvent(XEvent &event) { | |||
831 | if (validIndex(m_which_sub) && | 831 | if (validIndex(m_which_sub) && |
832 | menuitems[m_which_sub]->submenu()->isVisible()) | 832 | menuitems[m_which_sub]->submenu()->isVisible()) |
833 | menuitems[m_which_sub]->submenu()->grabInputFocus(); | 833 | menuitems[m_which_sub]->submenu()->grabInputFocus(); |
834 | } | 834 | } else if (event.type == LeaveNotify) |
835 | m_closing = false; | ||
835 | } | 836 | } |
836 | 837 | ||
837 | void Menu::buttonPressEvent(XButtonEvent &be) { | 838 | void Menu::buttonPressEvent(XButtonEvent &be) { |
838 | if (be.window == menu.title) | 839 | if (be.window == menu.title) { |
839 | grabInputFocus(); | 840 | grabInputFocus(); |
841 | m_closing = (be.button == 3); | ||
842 | } else | ||
843 | m_closing = false; | ||
840 | 844 | ||
841 | if (be.window == menu.frame && menu.item_w != 0) { | 845 | if (be.window == menu.frame && menu.item_w != 0) { |
842 | 846 | ||
@@ -875,7 +879,7 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) { | |||
875 | } | 879 | } |
876 | } | 880 | } |
877 | 881 | ||
878 | if (re.button == 3) | 882 | if (re.button == 3 && m_closing) |
879 | internal_hide(); | 883 | internal_hide(); |
880 | 884 | ||
881 | } else if (re.window == menu.frame) { | 885 | } else if (re.window == menu.frame) { |
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index 8d112ca..06af08d 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh | |||
@@ -220,6 +220,7 @@ private: | |||
220 | int m_screen_x, m_screen_y; | 220 | int m_screen_x, m_screen_y; |
221 | unsigned int m_screen_width, m_screen_height; | 221 | unsigned int m_screen_width, m_screen_height; |
222 | bool m_moving; ///< if we're moving/draging or not | 222 | bool m_moving; ///< if we're moving/draging or not |
223 | bool m_closing; ///< if we're right clicking on the menu title | ||
223 | bool m_visible; ///< menu visibility | 224 | bool m_visible; ///< menu visibility |
224 | bool m_torn; ///< torn from parent | 225 | bool m_torn; ///< torn from parent |
225 | bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else | 226 | bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else |