From 5178d10df7da6e0ec7628569269ea0e0935923e8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Feb 2014 00:32:58 +0000 Subject: [PATCH] Don't show hidden MDI frames when maximizing them in wxMSW. This is inconsistent with the other ports and rather unexpected. Closes #2508. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mdi.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 854ea0bafb..e72a8b1eb8 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -1012,9 +1012,28 @@ void wxMDIChildFrame::Maximize(bool maximize) wxMDIParentFrame * const parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { + if ( !IsShown() ) + { + // Turn off redrawing in the MDI client window because otherwise + // maximizing it would also show it and we don't want this for + // hidden windows. + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_SETREDRAW, + FALSE, 0L); + } + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), maximize ? WM_MDIMAXIMIZE : WM_MDIRESTORE, (WPARAM)GetHwnd(), 0); + + if ( !IsShown() ) + { + // Hide back the child window shown by maximizing it. + ::ShowWindow(GetHwnd(), SW_HIDE); + + // Turn redrawing in the MDI client back on. + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_SETREDRAW, + TRUE, 0L); + } } }