PopUpMenus didn't respect the openanyway setting (sticky mode), they always set it. And even in that case, they weren't working correctly. This should fix bugs 463 and 476. This might not work if click to open isn't selected in the menu prefs, though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17136 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-04-15 16:57:51 +00:00
parent ce1efe4ce6
commit 415c63bee2
2 changed files with 16 additions and 9 deletions

View File

@ -959,14 +959,9 @@ BMenu::Hide()
BMenuItem *
BMenu::Track(bool openAnyway, BRect *clickToOpenRect)
{
if (!IsStickyPrefOn())
openAnyway = false;
SetStickyMode(openAnyway);
if (openAnyway && LockLooper()) {
BMenu::Track(bool sticky, BRect *clickToOpenRect)
{
if (sticky && LockLooper()) {
RedrawAfterSticky(Bounds());
UnlockLooper();
}
@ -977,8 +972,12 @@ BMenu::Track(bool openAnyway, BRect *clickToOpenRect)
UnlockLooper();
}
// If sticky is false, pass 0 to the tracking function
// so the menu will stay in nonsticky mode, regardless
// of the "IsStickyPrefOn()" value
const bigtime_t trackTime = sticky ? system_time() : 0;
int action;
BMenuItem *menuItem = _track(&action, system_time());
BMenuItem *menuItem = _track(&action, trackTime);
SetStickyMode(false);
fExtraRect = NULL;

View File

@ -267,6 +267,14 @@ BMenuItem *
BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
BRect *_specialRect, bool async)
{
if (fTrackThread >= 0) {
// Something bad happened: Go() was called on us twice, and we got here
// while the other instance hasn't finished yet.
// TODO: Maybe we should simply call debugger() ?
status_t unused;
wait_for_thread(fTrackThread, &unused);
}
BMenuItem *selected = NULL;
// Can't use Window(), as the BPopUpMenu isn't attached