From 965f8909193fad2fa7f400a5088efc79c5ef9cf8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 26 Oct 2018 04:01:04 +0200 Subject: [PATCH] Fix regression in wxTopLevelWindowMSW::IsMaximized() This fixes another bug from 3518f1a7d8b27877183b0aa2338a59dec836ae3c (after the one fixed in 57662803113247619921dcfb414736e09529ef87): if a window was maximized by user and then hidden, its IsMaximized() returned false because it examined m_showCmd which didn't have SW_MAXIMIZE value in this case. The same was true for IsMinimised() as well. Fix both problems by updating the value of m_showCmd when hiding the window. --- src/msw/toplevel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index d2b89ccc97..df9e001c93 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -579,6 +579,15 @@ bool wxTopLevelWindowMSW::Show(bool show) } else // hide { + // When hiding the window, remember if it was maximized or iconized in + // order to return the correct value from Is{Maximized,Iconized}(). + if ( ::IsZoomed(GetHwnd()) ) + m_showCmd = SW_MAXIMIZE; + else if ( ::IsIconic(GetHwnd()) ) + m_showCmd = SW_MINIMIZE; + else + m_showCmd = SW_SHOW; + nShowCmd = SW_HIDE; }