an eventually opened menu is now quit in BWindow::DispatchMessage()

before sending a B_MOUSE_DOWN message to any other view. This fixes bug 
594 for real and another bug in BMenuBar.  BMenuBar tracking will also 
be simplified a bit because of this. Install items to a NULL window on 
Show() as does R5 (although I don't know why yet). 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17605 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-05-27 09:57:14 +00:00
parent a502e8cd6e
commit e061d1bae5
4 changed files with 37 additions and 13 deletions
+19 -11
View File
@@ -317,6 +317,7 @@ BMenu::AddItem(BMenuItem *item, int32 index)
if (!_AddItem(item, index))
return false;
InvalidateLayout();
if (LockLooper()) {
if (!Window()->IsHidden()) {
LayoutItems(index);
@@ -432,8 +433,9 @@ BMenu::AddList(BList *list, int32 index)
if (!_AddItem(item, index + i))
break;
}
}
}
InvalidateLayout();
if (locked && Window() != NULL && !Window()->IsHidden()) {
// Make sure we update the layout if needed.
LayoutItems(index);
@@ -1020,6 +1022,7 @@ BMenu::Show()
void
BMenu::Show(bool selectFirst)
{
Install(NULL);
_show(selectFirst);
}
@@ -1028,6 +1031,7 @@ void
BMenu::Hide()
{
_hide();
Uninstall();
}
@@ -1302,19 +1306,19 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
if (locked)
UnlockLooper();
if (buttons != 0 && IsStickyMode()) {
if (buttons != 0 && IsStickyMode())
fState = MENU_STATE_CLOSED;
break;
} else if (buttons == 0 && !IsStickyMode()) {
else if (buttons == 0 && !IsStickyMode()) {
if (system_time() < trackTime + 1000000
|| (fExtraRect != NULL && fExtraRect->Contains(location)))
SetStickyMode(true);
else {
else
fState = MENU_STATE_CLOSED;
break;
}
}
if (fState == MENU_STATE_CLOSED)
break;
snooze(snoozeAmount);
}
@@ -1358,10 +1362,6 @@ BMenu::_AddItem(BMenuItem *item, int32 index)
item->SetSuper(this);
// TODO: Sometimes the menu layout isn't invalidated correctly,
// So we force a rebuild of the whole menu layout. Remove this!
InvalidateLayout();
return true;
}
@@ -2061,6 +2061,14 @@ BMenu::OkToProceed(BMenuItem* item)
}
void
BMenu::QuitTracking()
{
fState = MENU_STATE_CLOSED;
}
status_t
BMenu::ParseMsg(BMessage *msg, int32 *sindex, BMessage *spec,
int32 *form, const char **prop, BMenu **tmenu,