aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r--src/FbTk/Menu.cc12
1 files changed, 8 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) {