Reverted that last change, as it was really a bad idea afterall (as Axel pointed out)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12784 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-05-23 13:50:59 +00:00
parent db4227c6ac
commit 063446f455
+10 -16
View File
@@ -1053,10 +1053,9 @@ BMenu::InitData(BMessage *data)
bool bool
BMenu::_show(bool selectFirstItem) BMenu::_show(bool selectFirstItem)
{ {
BWindow *menuWindow = MenuWindow(); // Menu windows get the BMenu's handler name
fCachedMenuWindow = new BMenuWindow(Name());
menuWindow->Lock(); fCachedMenuWindow->ChildAt(0)->AddChild(this);
menuWindow->ChildAt(0)->AddChild(this);
// We're doing this here because ConvertToScreen() needs: // We're doing this here because ConvertToScreen() needs:
// 1. The BView to be attached (see the above line). // 1. The BView to be attached (see the above line).
@@ -1066,8 +1065,7 @@ BMenu::_show(bool selectFirstItem)
UpdateWindowViewSize(); UpdateWindowViewSize();
menuWindow->Unlock(); fCachedMenuWindow->Show();
menuWindow->Show();
return true; return true;
} }
@@ -1079,8 +1077,8 @@ BMenu::_hide()
if (fCachedMenuWindow != NULL) { if (fCachedMenuWindow != NULL) {
fCachedMenuWindow->Lock(); fCachedMenuWindow->Lock();
fCachedMenuWindow->ChildAt(0)->RemoveChild(this); fCachedMenuWindow->ChildAt(0)->RemoveChild(this);
fCachedMenuWindow->Hide(); fCachedMenuWindow->Quit();
fCachedMenuWindow->Unlock(); fCachedMenuWindow = NULL;
} }
} }
@@ -1434,12 +1432,6 @@ BMenu::OverSubmenu(BMenuItem *item, BPoint loc)
BMenuWindow * BMenuWindow *
BMenu::MenuWindow() BMenu::MenuWindow()
{ {
if (fCachedMenuWindow == NULL) {
// Menu windows get the BMenu's handler name
fCachedMenuWindow = new BMenuWindow(Name());
UpdateWindowViewSize();
}
return fCachedMenuWindow; return fCachedMenuWindow;
} }
@@ -1646,8 +1638,10 @@ void
BMenu::UpdateWindowViewSize(bool upWind) BMenu::UpdateWindowViewSize(bool upWind)
{ {
ASSERT(fCachedMenuWindow != NULL); ASSERT(fCachedMenuWindow != NULL);
fCachedMenuWindow->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2); if (fCachedMenuWindow != NULL) {
fCachedMenuWindow->MoveTo(ScreenLocation()); fCachedMenuWindow->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
fCachedMenuWindow->MoveTo(ScreenLocation());
}
} }