From 709ef82757c29ea1ab4e51ec274ad141d606d0d1 Mon Sep 17 00:00:00 2001 From: Alexandre Deckner Date: Fri, 13 Jun 2008 00:24:01 +0000 Subject: [PATCH] - BMenu caches the preferred size (since r21396) but didn't recompute it if the ResizingMode changed, it did it only in InvalidateLayout(). This fixes #1461, the bug appeared because DraggableContainerIcon uses a special trick, involving changing the resizing mode, to get the total width of the menu items. (see tracker/ContainerWindow.cpp line 479) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25948 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 1e32b9691e..c3edb2fedb 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -173,6 +173,7 @@ const char *kEmptyMenuLabel = ""; struct BMenu::LayoutData { BSize preferred; + uint32 lastResizingMode; }; @@ -1853,7 +1854,7 @@ BMenu::_LayoutItems(int32 index) BSize BMenu::_ValidatePreferredSize() { - if (!fLayoutData->preferred.IsWidthSet()) + if (!fLayoutData->preferred.IsWidthSet() || ResizingMode() != fLayoutData->lastResizingMode) _ComputeLayout(0, true, false, NULL, NULL); return fLayoutData->preferred; @@ -1867,6 +1868,8 @@ BMenu::_ComputeLayout(int32 index, bool bestFit, bool moveItems, // TODO: Take "bestFit", "moveItems", "index" into account, // Recalculate only the needed items, // not the whole layout every time + + fLayoutData->lastResizingMode = ResizingMode(); BRect frame;