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
This commit is contained in:
Michael R Sweet 2006-01-17 15:02:36 +00:00
parent c1c84a620a
commit 826eb45715
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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;