X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b9e6623377b992ed8a6d4ac146d59e2c19330ada..ba808e1178c352621456baeb229847d733142d32:/src/msw/toplevel.cpp diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index a7217b5c91..d0e47ea963 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -660,10 +660,14 @@ bool wxTopLevelWindowMSW::Show(bool show) } else // just show { - if ( GetWindowStyle() & wxFRAME_TOOL_WINDOW ) - nShowCmd = SW_SHOWNA; - else - nShowCmd = SW_SHOW; + // we shouldn't use SW_SHOW which also activates the window for + // tool frames (as they shouldn't steal focus from the main window) + // nor for the currently disabled windows as they would be enabled + // as a side effect + if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) + nShowCmd = SW_SHOWNA; + else + nShowCmd = SW_SHOW; } } else // hide @@ -1172,55 +1176,50 @@ bool wxTopLevelWindowMSW::CanSetTransparent() } -void wxTopLevelWindowMSW::Freeze() +void wxTopLevelWindowMSW::DoFreeze() { - if ( !m_frozenness++) { - if (IsShown()) { - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - if ( child->IsTopLevel() ) - continue; - else - child->Freeze(); - } + if ( IsShown() ) + { + for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow *child = node->GetData(); + if ( child->IsTopLevel() ) + continue; + + child->Freeze(); } } } -void wxTopLevelWindowMSW::Thaw() +void wxTopLevelWindowMSW::DoThaw() { - wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") ); - if ( --m_frozenness == 0 ) + if ( IsShown() ) { - if ( IsShown() ) { - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - if ( child->IsTopLevel() ) - continue; - else - child->Thaw(); - } + for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow *child = node->GetData(); + if ( child->IsTopLevel() ) + continue; + + child->Thaw(); } } } -void wxTopLevelWindowMSW::AddChild(wxWindowBase *child ) +void wxTopLevelWindowMSW::AddChild(wxWindowBase *child) { - //adding a child while frozen will assert when thawn, - // so freeze it - if (child && !child->IsTopLevel() && IsFrozen()) { - //need to match our current freeze level - for (unsigned int ii=0;ii< m_frozenness;ii++) { - child->Freeze(); - } + // adding a child while frozen will assert when thawn, so freeze it as if + // it had been already present when we were frozen + if ( child && !child->IsTopLevel() && IsFrozen() ) + { + child->Freeze(); } + wxTopLevelWindowBase::AddChild(child); }