diff --git a/docs/changes.txt b/docs/changes.txt index 29f4ca057a..2c53338ad0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -548,6 +548,7 @@ wxMSW: - Add support for CURRENCY and SCODE types to OLE Automation helpers (PB). - Allow setting LCID used by wxAutomationObject (PB). +- Fix calling Iconize(false) on hidden top level windows (Christian Walther). 2.9.4: (released 2012-07-09) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index e43e038530..0d1a0735cd 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -709,9 +709,21 @@ bool wxTopLevelWindowMSW::Show(bool show) } else if ( m_iconized ) { - // iconize and show + // We were iconized while we were hidden, so now we need to show + // the window in iconized state. nShowCmd = SW_MINIMIZE; } + else if ( ::IsIconic(GetHwnd()) ) + { + // We were restored while we were hidden, so now we need to show + // the window in its normal state. + // + // As below, don't activate some kinds of windows. + if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) + nShowCmd = SW_SHOWNOACTIVATE; + else + nShowCmd = SW_RESTORE; + } else // just show { // we shouldn't use SW_SHOW which also activates the window for @@ -823,9 +835,9 @@ void wxTopLevelWindowMSW::Iconize(bool iconize) } else // hidden { - // iconizing the window shouldn't show it so just remember that we need - // to become iconized when shown later - m_iconized = true; + // iconizing the window shouldn't show it so just update the internal + // state (otherwise it's done by DoShowWindow() itself) + m_iconized = iconize; } }