Fix activation loss when hiding floating frame TLW in wxMSW
Generalize the fix of d6fb86a81c
and
explicitly activate the parent when a TLW with wxFRAME_FLOAT_ON_PARENT
style is hidden or minimized and not only when it is destroyed.
Closes #18535.
This commit is contained in:
@@ -577,19 +577,6 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
|
|||||||
delete m_menuSystem;
|
delete m_menuSystem;
|
||||||
|
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
|
||||||
// after destroying an owned window, Windows activates the next top level
|
|
||||||
// window in Z order but it may be different from our owner (to reproduce
|
|
||||||
// this simply Alt-TAB to another application and back before closing the
|
|
||||||
// owned frame) whereas we always want to yield activation to our parent
|
|
||||||
if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) )
|
|
||||||
{
|
|
||||||
wxWindow *parent = GetParent();
|
|
||||||
if ( parent )
|
|
||||||
{
|
|
||||||
::BringWindowToTop(GetHwndOf(parent));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -598,6 +585,26 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
|
|||||||
|
|
||||||
void wxTopLevelWindowMSW::DoShowWindow(int nShowCmd)
|
void wxTopLevelWindowMSW::DoShowWindow(int nShowCmd)
|
||||||
{
|
{
|
||||||
|
// After hiding or minimizing an owned window, Windows activates the next
|
||||||
|
// top level window in Z order but it may be different from our owner (to
|
||||||
|
// reproduce this simply Alt-TAB to another application and back before
|
||||||
|
// closing the owned frame) whereas we always want to yield activation to
|
||||||
|
// our parent, so do it explicitly _before_ yielding activation.
|
||||||
|
switch ( nShowCmd )
|
||||||
|
{
|
||||||
|
case SW_HIDE:
|
||||||
|
case SW_MINIMIZE:
|
||||||
|
if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) )
|
||||||
|
{
|
||||||
|
wxWindow *parent = GetParent();
|
||||||
|
if ( parent )
|
||||||
|
{
|
||||||
|
::BringWindowToTop(GetHwndOf(parent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
::ShowWindow(GetHwnd(), nShowCmd);
|
::ShowWindow(GetHwnd(), nShowCmd);
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
|
Reference in New Issue
Block a user