From b120bcd665f4ee4034762ab61841ed6b361c148f Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 10 Jan 2006 09:40:28 +0000 Subject: [PATCH] Don't quit tracking the menu even if OverSuper() returns true, if HitTestItems() doesn't return NULL. This should fix (at least in part) bug #85 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15891 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index c65770400a..abe273d652 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1070,29 +1070,30 @@ BMenu::_hide() BMenuItem * BMenu::_track(int *action, long start) { - // TODO: Take Sticky mode into account - BPoint location; + // TODO: Take Sticky mode into account, cleanup ulong buttons; BMenuItem *item = NULL; int localAction = MENU_ACT_NONE; do { if (!LockLooper()) break; - + + BPoint location; GetMouse(&location, &buttons); - if (OverSuper(location)) { - UnlockLooper(); - break; - } item = HitTestItems(location, B_ORIGIN); - if (item != NULL) { if (item != fSelected) SelectItem(item); - } else if (fSelected != NULL && !OverSubmenu(fSelected, ConvertToScreen(location))) + } else { + if (OverSuper(location)) { + UnlockLooper(); + break; + } + if (fSelected != NULL && !OverSubmenu(fSelected, ConvertToScreen(location))) SelectItem(NULL); - + } + if (fSelected != NULL && fSelected->Submenu() != NULL) { UnlockLooper();