Same thing as previous commit, only for BMenuBar. Added some other
comment git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23280 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
14e826c4ba
commit
8d44324fda
@ -1405,6 +1405,11 @@ BMenu::_Track(int *action, long start)
|
|||||||
int submenuAction = MENU_STATE_TRACKING;
|
int submenuAction = MENU_STATE_TRACKING;
|
||||||
BMenu *submenu = fSelected->Submenu();
|
BMenu *submenu = fSelected->Submenu();
|
||||||
submenu->_SetStickyMode(_IsStickyMode());
|
submenu->_SetStickyMode(_IsStickyMode());
|
||||||
|
|
||||||
|
// The following call blocks until the submenu
|
||||||
|
// gives control back to us, either because the mouse
|
||||||
|
// pointer goes out of the submenu's bounds, or because
|
||||||
|
// the user closes the menu
|
||||||
BMenuItem *submenuItem = submenu->_Track(&submenuAction);
|
BMenuItem *submenuItem = submenu->_Track(&submenuAction);
|
||||||
if (submenuAction == MENU_STATE_CLOSED) {
|
if (submenuAction == MENU_STATE_CLOSED) {
|
||||||
item = submenuItem;
|
item = submenuItem;
|
||||||
|
@ -465,10 +465,9 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
window->Unlock();
|
window->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (fState != MENU_STATE_CLOSED) {
|
||||||
bigtime_t snoozeAmount = 40000;
|
bigtime_t snoozeAmount = 40000;
|
||||||
bool locked = (Window() != NULL && window->Lock());//WithTimeout(200000)
|
if (Window() == NULL || !window->Lock())
|
||||||
if (!locked)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN);
|
BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN);
|
||||||
@ -504,7 +503,6 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
// is over its window
|
// is over its window
|
||||||
BMenu *menu = fSelected->Submenu();
|
BMenu *menu = fSelected->Submenu();
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
locked = false;
|
|
||||||
snoozeAmount = 30000;
|
snoozeAmount = 30000;
|
||||||
bool wasSticky = _IsStickyMode();
|
bool wasSticky = _IsStickyMode();
|
||||||
menu->_SetStickyMode(wasSticky);
|
menu->_SetStickyMode(wasSticky);
|
||||||
@ -535,35 +533,36 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
} else
|
} else
|
||||||
fState = MENU_STATE_CLOSED;
|
fState = MENU_STATE_CLOSED;
|
||||||
}
|
}
|
||||||
|
if (!window->Lock())
|
||||||
|
break;
|
||||||
} else if (menuItem == NULL && fSelected != NULL
|
} else if (menuItem == NULL && fSelected != NULL
|
||||||
&& !_IsStickyMode() && Bounds().Contains(where)) {
|
&& !_IsStickyMode() && Bounds().Contains(where)) {
|
||||||
_SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!locked)
|
window->Unlock();
|
||||||
locked = window->Lock();
|
|
||||||
|
|
||||||
if (locked) {
|
if (fState != MENU_STATE_CLOSED) {
|
||||||
|
if (snoozeAmount > 0)
|
||||||
|
snooze(snoozeAmount);
|
||||||
|
|
||||||
|
if (window->Lock()) {
|
||||||
GetMouse(&where, &buttons, true);
|
GetMouse(&where, &buttons, true);
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
locked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fState == MENU_STATE_CLOSED
|
if ((buttons != 0 && _IsStickyMode() && menuItem == NULL))
|
||||||
|| (buttons != 0 && _IsStickyMode() && menuItem == NULL))
|
fState = MENU_STATE_CLOSED;
|
||||||
break;
|
|
||||||
else if (buttons == 0 && !_IsStickyMode()) {
|
else if (buttons == 0 && !_IsStickyMode()) {
|
||||||
if ((fSelected != NULL && fSelected->Submenu() == NULL)
|
if ((fSelected != NULL && fSelected->Submenu() == NULL)
|
||||||
|| menuItem == NULL) {
|
|| menuItem == NULL) {
|
||||||
fChosenItem = fSelected;
|
fChosenItem = fSelected;
|
||||||
break;
|
fState = MENU_STATE_CLOSED;
|
||||||
} else
|
} else
|
||||||
_SetStickyMode(true);
|
_SetStickyMode(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (snoozeAmount > 0)
|
|
||||||
snooze(snoozeAmount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->Lock()) {
|
if (window->Lock()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user