From 4fc26303b9ee1eb66fb0ecc3170084428ea8551e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Jun 2015 17:43:41 +0200 Subject: [PATCH] Fix restricting both min and max size of MDI children in wxMSW. Calling SetMinSize() on wxMDIChildFrame in wxMSW prevented SetMaxSize() from working as wxMDIChildFrame::HandleGetMinMaxInfo() didn't take the max size into account and prevented the execution of the base class version of the same method from taking place if min size was set. Fix this simply by always delegating to the base class version after using DefMDIChildProc() to compute the default max size values. Closes #17029. --- src/msw/mdi.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index c742e20c36..2588499bed 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -1241,32 +1241,13 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) { - MINMAXINFO *info = (MINMAXINFO *)mmInfo; + // Get the window max size from DefMDIChildProc() as it calculates it + // correctly from the size of the MDI parent frame. + MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo); - // let the default window proc calculate the size of MDI children - // frames because it is based on the size of the MDI client window, - // not on the values specified in wxWindow m_max variables - bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo) != 0; - - int minWidth = GetMinWidth(), - minHeight = GetMinHeight(); - - // but allow GetSizeHints() to set the min size - if ( minWidth != wxDefaultCoord ) - { - info->ptMinTrackSize.x = minWidth; - - processed = true; - } - - if ( minHeight != wxDefaultCoord ) - { - info->ptMinTrackSize.y = minHeight; - - processed = true; - } - - return processed; + // But then handle the message as usual at the base class level to allow + // overriding min/max frame size as for the normal frames. + return false; } // ---------------------------------------------------------------------------