diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-01-17 21:04:55 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-01-17 21:04:55 +0000 |
| commit | db822d2fd959ce365040b1cd1bb25fda1d7f32ef (patch) | |
| tree | 02bb63a7324230666ab814567bd8c105252fbdf1 /src/Fl_Menu.cxx | |
| parent | 826eb45715c0209a081ae4603fdb4067f311fd19 (diff) | |
Fix menubar menu clicking, so that menu items work again and clicking outside
the menu cancels it.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4766 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Menu.cxx')
| -rw-r--r-- | src/Fl_Menu.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index f4ce0a7af..34f6b4b99 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -588,16 +588,18 @@ int menuwindow::handle(int e) { case FL_PUSH: case FL_DRAG: { #ifdef __QNX__ - // STR 704: workaround QNX X11 bug - in QNX an event FL_MOVE is sent + // STR 704: workaround QNX X11 bug - in QNX a FL_MOVE event is sent // right after FL_RELEASE... if (pp.state == DONE_STATE) return 1; #endif // __QNX__ 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()))) { + int item=0; int mymenu = pp.nummenus-1; + if (e == FL_PUSH && (!pp.menubar || mymenu) && + (mx < pp.p[mymenu]->x_root() || + mx >= (pp.p[mymenu]->x_root() + pp.p[mymenu]->w()) || + my < pp.p[mymenu]->y_root() || + my >= (pp.p[mymenu]->y_root() + pp.p[mymenu]->h()))) { // Clicking outside menu cancels it... setitem(0, -1, 0); pp.state = DONE_STATE; |
