From 826eb45715c0209a081ae4603fdb4067f311fd19 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 17 Jan 2006 15:02:36 +0000 Subject: 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 --- CHANGES | 4 ++-- src/Fl_Menu.cxx | 8 ++++++++ 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; -- cgit v1.2.3