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:
@@ -1607,6 +1607,7 @@ BMenu::_UpdateNavigationArea(BPoint position, BRect& navAreaRectAbove,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMenu::_UpdateStateOpenSelect(BMenuItem* item, BPoint position,
|
BMenu::_UpdateStateOpenSelect(BMenuItem* item, BPoint position,
|
||||||
BRect& navAreaRectAbove, BRect& navAreaRectBelow, bigtime_t& selectedTime,
|
BRect& navAreaRectAbove, BRect& navAreaRectBelow, bigtime_t& selectedTime,
|
||||||
@@ -1615,7 +1616,6 @@ BMenu::_UpdateStateOpenSelect(BMenuItem* item, BPoint position,
|
|||||||
if (fState == MENU_STATE_CLOSED)
|
if (fState == MENU_STATE_CLOSED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if (item != fSelected) {
|
if (item != fSelected) {
|
||||||
if (navigationAreaTime == 0)
|
if (navigationAreaTime == 0)
|
||||||
navigationAreaTime = system_time();
|
navigationAreaTime = system_time();
|
||||||
|
|||||||
@@ -471,22 +471,7 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN);
|
BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN);
|
||||||
if (menuItem != NULL) {
|
if (_OverSubmenu(fSelected, ConvertToScreen(where))) {
|
||||||
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))) {
|
|
||||||
// call _Track() from the selected sub-menu when the mouse cursor
|
// call _Track() from the selected sub-menu when the mouse cursor
|
||||||
// is over its window
|
// is over its window
|
||||||
BMenu *menu = fSelected->Submenu();
|
BMenu *menu = fSelected->Submenu();
|
||||||
@@ -523,6 +508,21 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
}
|
}
|
||||||
if (!window->Lock())
|
if (!window->Lock())
|
||||||
break;
|
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
|
} else if (menuItem == NULL && fSelected != NULL
|
||||||
&& !_IsStickyMode() && Bounds().Contains(where)) {
|
&& !_IsStickyMode() && Bounds().Contains(where)) {
|
||||||
_SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user