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
This commit is contained in:
Michael R Sweet 2006-01-17 04:32:51 +00:00
parent 42a6245bdd
commit c1c84a620a
1 changed files with 8 additions and 2 deletions

View File

@ -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;