From ba61835820c6638402503bfd39e19b00f6677fdf Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 15 Jun 2005 12:09:40 +0000 Subject: [PATCH] Fixed submenus for good git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13151 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 6a33843df4..11c32c34d9 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1116,24 +1116,22 @@ BMenu::_track(int *action, long start) if (item != NULL) { if (item != fSelected) SelectItem(item); + } + + int submenuAction = MENU_ACT_NONE; + BMenuItem *submenuItem = NULL; + if (fSelected != NULL && fSelected->Submenu() != NULL) { + UnlockLooper(); - int submenuAction = MENU_ACT_NONE; - BMenuItem *submenuItem = NULL; - // TODO: Review this as it doesn't work very well, - // BMenu::_track() isn't always called when needed. - if (item->Submenu() != NULL) { - UnlockLooper(); - - submenuItem = item->Submenu()->_track(&submenuAction); - if (submenuAction == MENU_ACT_CLOSE) { - item = submenuItem; - localAction = submenuAction; - break; - } - - if (!LockLooper()) - break; + submenuItem = fSelected->Submenu()->_track(&submenuAction); + if (submenuAction == MENU_ACT_CLOSE) { + item = submenuItem; + localAction = submenuAction; + break; } + + if (!LockLooper()) + break; } UnlockLooper();