diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index ff4ad7fedb..b434321f91 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -344,6 +344,8 @@ private: void _GetDecoratorSize(float* _borderWidth, float* _tabHeight) const; + void _CheckSizeLimits(); + private: char* fTitle; int32 _unused0; diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index b646c37cbd..da9769c1bf 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1406,14 +1406,7 @@ FrameMoved(origin); case B_LAYOUT_WINDOW: { - if (fFlags & B_AUTO_UPDATE_SIZE_LIMITS) { - // Get min/max constraints of the top view and enforce window - // size limits respectively. - BSize minSize = fTopView->MinSize(); - BSize maxSize = fTopView->MaxSize(); - SetSizeLimits(minSize.width, maxSize.width, - minSize.height, maxSize.height); - } + _CheckSizeLimits(); // do the actual layout fTopView->Layout(false); @@ -2460,11 +2453,8 @@ BWindow::ResizeTo(float width, float height) void BWindow::CenterIn(const BRect& rect) { - // Force layout resizing if needed - if (GetLayout() != NULL) { - BSize size = GetLayout()->PreferredSize(); - ResizeTo(size.Width(), size.Height()); - } + // Set size limits now if needed + _CheckSizeLimits(); MoveTo(BLayoutUtils::AlignInFrame(rect, Size(), BAlignment(B_ALIGN_HORIZONTAL_CENTER, @@ -3884,6 +3874,20 @@ BWindow::_GetDecoratorSize(float* _borderWidth, float* _tabHeight) const } +void +BWindow::_CheckSizeLimits() +{ + if (fFlags & B_AUTO_UPDATE_SIZE_LIMITS) { + // Get min/max constraints of the top view and enforce window + // size limits respectively. + BSize minSize = fTopView->MinSize(); + BSize maxSize = fTopView->MaxSize(); + SetSizeLimits(minSize.width, maxSize.width, + minSize.height, maxSize.height); + } +} + + // #pragma mark - C++ binary compatibility kludge