Partially revert r35962, since the cure is worse than the sickness.

Should fix #5717 (but probably reopens #3103)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36369 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2010-04-20 12:37:08 +00:00
parent 910f10f2fc
commit 76d5e0641b
2 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ private:
bool _ChooseTrigger(const char* title, int32& index, bool _ChooseTrigger(const char* title, int32& index,
uint32& trigger, uint32& trigger,
BPrivate::TriggerList& triggers); BPrivate::TriggerList& triggers);
void _UpdateWindowViewSize(); void _UpdateWindowViewSize(const bool &updatePosition);
bool _OkToProceed(BMenuItem* item); bool _OkToProceed(BMenuItem* item);
bool _CustomTrackingWantsToQuit(); bool _CustomTrackingWantsToQuit();
+10 -9
View File
@@ -398,7 +398,7 @@ BMenu::AttachedToWindow()
if (!fAttachAborted) { if (!fAttachAborted) {
_CacheFontInfo(); _CacheFontInfo();
_LayoutItems(0); _LayoutItems(0);
_UpdateWindowViewSize(); _UpdateWindowViewSize(false);
} }
} }
@@ -705,7 +705,7 @@ BMenu::AddItem(BMenuItem* item, int32 index)
if (LockLooper()) { if (LockLooper()) {
if (!Window()->IsHidden()) { if (!Window()->IsHidden()) {
_LayoutItems(index); _LayoutItems(index);
_UpdateWindowViewSize(); _UpdateWindowViewSize(false);
Invalidate(); Invalidate();
} }
UnlockLooper(); UnlockLooper();
@@ -826,7 +826,7 @@ BMenu::AddList(BList* list, int32 index)
if (locked && Window() != NULL && !Window()->IsHidden()) { if (locked && Window() != NULL && !Window()->IsHidden()) {
// Make sure we update the layout if needed. // Make sure we update the layout if needed.
_LayoutItems(index); _LayoutItems(index);
_UpdateWindowViewSize(); _UpdateWindowViewSize(false);
Invalidate(); Invalidate();
} }
@@ -1508,7 +1508,7 @@ BMenu::_Show(bool selectFirstItem)
return false; return false;
} }
_UpdateWindowViewSize(); _UpdateWindowViewSize(true);
window->Show(); window->Show();
if (selectFirstItem) if (selectFirstItem)
@@ -1990,7 +1990,7 @@ BMenu::_RemoveItems(int32 index, int32 count, BMenuItem* item,
InvalidateLayout(); InvalidateLayout();
if (locked && window != NULL) { if (locked && window != NULL) {
_LayoutItems(0); _LayoutItems(0);
_UpdateWindowViewSize(); _UpdateWindowViewSize(false);
Invalidate(); Invalidate();
} }
} }
@@ -2300,7 +2300,7 @@ BMenu::_CalcFrame(BPoint where, bool* scrollOn)
if (!scroll) { if (!scroll) {
// basically, if this returns false, it means // basically, if this returns false, it means
// that the menu frame won't fit completely inside the screen // that the menu frame won't fit completely inside the screen
// TODO: Scrolling, will currently only work up/down, // TODO: Scrolling will currently only work up/down,
// not left/right // not left/right
scroll = screenFrame.Height() < frame.Height(); scroll = screenFrame.Height() < frame.Height();
} }
@@ -2684,7 +2684,7 @@ BMenu::_ChooseTrigger(const char* title, int32& index, uint32& trigger,
void void
BMenu::_UpdateWindowViewSize() BMenu::_UpdateWindowViewSize(const bool &move)
{ {
BMenuWindow* window = static_cast<BMenuWindow*>(Window()); BMenuWindow* window = static_cast<BMenuWindow*>(Window());
if (window == NULL) if (window == NULL)
@@ -2697,7 +2697,7 @@ BMenu::_UpdateWindowViewSize()
return; return;
bool scroll = false; bool scroll = false;
const BPoint screenLocation = ScreenLocation(); const BPoint screenLocation = move ? ScreenLocation() : window->Frame().LeftTop();
BRect frame = _CalcFrame(screenLocation, &scroll); BRect frame = _CalcFrame(screenLocation, &scroll);
ResizeTo(frame.Width(), frame.Height()); ResizeTo(frame.Width(), frame.Height());
@@ -2728,7 +2728,8 @@ BMenu::_UpdateWindowViewSize()
fFontHeight + fPad.top + fPad.bottom); fFontHeight + fPad.top + fPad.bottom);
} }
window->MoveTo(frame.LeftTop()); if (move)
window->MoveTo(frame.LeftTop());
} }