Apply the same logic of BMenu::_Track() also in BMenuBar::_track():
check if mouse is over a submenu and then if it's over the current menu. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -471,22 +471,7 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
||||
break;
|
||||
|
||||
BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN);
|
||||
if (menuItem != NULL) {
|
||||
if (menuItem->Submenu() != NULL && menuItem != fSelected) {
|
||||
if (menuItem->Submenu()->Window() == NULL) {
|
||||
// open the menu if it's not opened yet
|
||||
_SelectItem(menuItem);
|
||||
} else {
|
||||
// Menu was already opened, close it and bail
|
||||
_SelectItem(NULL);
|
||||
fState = MENU_STATE_CLOSED;
|
||||
fChosenItem = NULL;
|
||||
}
|
||||
} else {
|
||||
// No submenu, just select the item
|
||||
_SelectItem(menuItem);
|
||||
}
|
||||
} else if (_OverSubmenu(fSelected, ConvertToScreen(where))) {
|
||||
if (_OverSubmenu(fSelected, ConvertToScreen(where))) {
|
||||
// call _Track() from the selected sub-menu when the mouse cursor
|
||||
// is over its window
|
||||
BMenu *menu = fSelected->Submenu();
|
||||
@@ -523,6 +508,21 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
||||
}
|
||||
if (!window->Lock())
|
||||
break;
|
||||
} else if (menuItem != NULL) {
|
||||
if (menuItem->Submenu() != NULL && menuItem != fSelected) {
|
||||
if (menuItem->Submenu()->Window() == NULL) {
|
||||
// open the menu if it's not opened yet
|
||||
_SelectItem(menuItem);
|
||||
} else {
|
||||
// Menu was already opened, close it and bail
|
||||
_SelectItem(NULL);
|
||||
fState = MENU_STATE_CLOSED;
|
||||
fChosenItem = NULL;
|
||||
}
|
||||
} else {
|
||||
// No submenu, just select the item
|
||||
_SelectItem(menuItem);
|
||||
}
|
||||
} else if (menuItem == NULL && fSelected != NULL
|
||||
&& !_IsStickyMode() && Bounds().Contains(where)) {
|
||||
_SelectItem(NULL);
|
||||
|
||||
Reference in New Issue
Block a user