summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc12
-rw-r--r--src/FbTk/Menu.hh1
2 files changed, 9 insertions, 4 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 491ad76..ec0a061 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -600,7 +600,7 @@ void Menu::internal_hide(bool first) {
600 shown = (Menu *) 0; 600 shown = (Menu *) 0;
601 } 601 }
602 602
603 m_torn = m_visible = false; 603 m_torn = m_visible = m_closing = false;
604 m_which_sub = -1; 604 m_which_sub = -1;
605 605
606 if (first && m_parent && m_parent->isVisible() && 606 if (first && m_parent && m_parent->isVisible() &&
@@ -835,12 +835,16 @@ void Menu::handleEvent(XEvent &event) {
835 if (validIndex(m_which_sub) && 835 if (validIndex(m_which_sub) &&
836 menuitems[m_which_sub]->submenu()->isVisible()) 836 menuitems[m_which_sub]->submenu()->isVisible())
837 menuitems[m_which_sub]->submenu()->grabInputFocus(); 837 menuitems[m_which_sub]->submenu()->grabInputFocus();
838 } 838 } else if (event.type == LeaveNotify)
839 m_closing = false;
839} 840}
840 841
841void Menu::buttonPressEvent(XButtonEvent &be) { 842void Menu::buttonPressEvent(XButtonEvent &be) {
842 if (be.window == menu.title) 843 if (be.window == menu.title) {
843 grabInputFocus(); 844 grabInputFocus();
845 m_closing = (be.button == 3);
846 } else
847 m_closing = false;
844 848
845 if (be.window == menu.frame && menu.item_w != 0) { 849 if (be.window == menu.frame && menu.item_w != 0) {
846 850
@@ -879,7 +883,7 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
879 } 883 }
880 } 884 }
881 885
882 if (re.button == 3) 886 if (re.button == 3 && m_closing)
883 internal_hide(); 887 internal_hide();
884 888
885 } else if (re.window == menu.frame) { 889 } else if (re.window == menu.frame) {
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 576c9f3..34df40a 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