summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-01-17 15:02:36 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-01-17 15:02:36 +0000
commit826eb45715c0209a081ae4603fdb4067f311fd19 (patch)
tree0f1f4069ee857c05c95f8572f2c87cb618ea42c3
parentc1c84a620a892bac0c15e95171cb55d32d75b4df (diff)
Clicking outside a menu window dismisses it (STR #1144)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4765 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES4
-rw-r--r--src/Fl_Menu.cxx8
2 files changed, 10 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 046ac9e86..ed0a33e60 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,8 +3,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
- - Pressing a Fl_Menu_Button widget now draws it pressed
- in (STR #1140)
+ - Various menu widget fixes (STR #1140, STR #1143, STR
+ #1144)
- The threads demo would display negative prime numbers
on MacOS X; this appears to be a MacOS X bug, but we
added a workaround to "fix" this (STR #1138)
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index 9b61e3098..f4ce0a7af 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -595,6 +595,14 @@ int menuwindow::handle(int e) {
int mx = Fl::event_x_root();
int my = Fl::event_y_root();
int item=0; int mymenu;
+ if (e == FL_PUSH &&
+ (mx < x() || mx >= (x() + w()) ||
+ my < y() || my >= (y() + h()))) {
+ // Clicking outside menu cancels it...
+ setitem(0, -1, 0);
+ pp.state = DONE_STATE;
+ return 1;
+ }
for (mymenu = pp.nummenus-1; ; mymenu--) {
item = pp.p[mymenu]->find_selected(mx, my);
if (item >= 0) break;