Fix closing minimized top level windows under Windows 10

Minimized windows don't seem to get any events after "Close" menu item
is selected from the system menu, so they were never actually destroyed
when closing them in this way.

Fix this by explicitly waking up the message loop after deleting the
window to ensure that the delayed destruction does happen.

Closes #18622.

See https://github.com/wxWidgets/wxWidgets/pull/1690
This commit is contained in:
Vadim Zeitlin
2020-01-11 23:13:02 +01:00
parent 46042843e8
commit 13752968ea
2 changed files with 17 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ public:
virtual bool IsIconized() const wxOVERRIDE;
virtual void SetIcons(const wxIconBundle& icons ) wxOVERRIDE;
virtual void Restore() wxOVERRIDE;
virtual bool Destroy() wxOVERRIDE;
virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE;

View File

@@ -823,6 +823,22 @@ void wxTopLevelWindowMSW::Restore()
DoShowWindow(SW_RESTORE);
}
bool wxTopLevelWindowMSW::Destroy()
{
if ( !wxTopLevelWindowBase::Destroy() )
return false;
// Under Windows 10 iconized windows don't get any messages, so delayed
// destruction doesn't work for them if we don't force a message dispatch
// here (and it doesn't seem useful to test for MSWIsIconized() as doing
// this doesn't do any harm for non-iconized windows neither). For that
// matter, doing this shouldn't do any harm under previous OS versions
// neither, so checking for the OS version doesn't seem useful too.
wxWakeUpIdle();
return true;
}
void wxTopLevelWindowMSW::SetLayoutDirection(wxLayoutDirection dir)
{
if ( dir == wxLayout_Default )