- 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
This commit is contained in:
@@ -173,6 +173,7 @@ const char *kEmptyMenuLabel = "<empty>";
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user