From db822d2fd959ce365040b1cd1bb25fda1d7f32ef Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 17 Jan 2006 21:04:55 +0000 Subject: 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 --- src/Fl_Menu.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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; -- cgit v1.2.3