diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-01-17 04:32:51 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-01-17 04:32:51 +0000 |
| commit | c1c84a620a892bac0c15e95171cb55d32d75b4df (patch) | |
| tree | 6f682730678c8119c29ee664bc11d2ce27ce6751 | |
| parent | 42a6245bdd5bf7fa3a03f1cd82b1c7013c5be7c9 (diff) | |
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
| -rw-r--r-- | src/Fl_Menu.cxx | 10 |
1 files 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; |
