From c1c84a620a892bac0c15e95171cb55d32d75b4df Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 17 Jan 2006 04:32:51 +0000 Subject: Check if the user clicks outside the menu area in the menu bar so that we don't get stuck with the focus in the menubar. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4764 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Menu.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index 4e860e396..9b61e3098 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -598,7 +598,7 @@ int menuwindow::handle(int e) { for (mymenu = pp.nummenus-1; ; mymenu--) { item = pp.p[mymenu]->find_selected(mx, my); if (item >= 0) break; - if (mymenu <= 0) break; + if (mymenu <= 0) return 0; } if (my == 0 && item > 0) setitem(mymenu, item - 1); else setitem(mymenu, item); @@ -674,7 +674,13 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown( } pp.current_item = 0; pp.menu_number = 0; pp.item_number = -1; - if (menubar) mw.handle(FL_DRAG); // find the initial menu + if (menubar) { + // find the initial menu + if (!mw.handle(FL_DRAG)) { + Fl::release(); + return 0; + } + } initial_item = pp.current_item; if (initial_item) goto STARTUP; -- cgit v1.2.3