Don't send wxActivateEvent for minimized windows in wxMSW

Unexpectedly, minimizing the window by clicking on its taskbar icon resulted
in a wxActivateEvent. This broke the focus handling in wxTLW and resulted in
debug messages about ::SetFocus() failure whenever the window was minimized in
this way.

It also seems that other existing code doesn't take into account the
possibility of getting an "active" activation event when the window is
minimized and this doesn't happen in the other ports, so don't send this event
in wxMSW neither.

Closes #17128.
This commit is contained in:
Vadim Zeitlin
2015-09-04 16:23:13 +02:00
parent dac9851f8d
commit 8d6a2b3921
3 changed files with 18 additions and 2 deletions

View File

@@ -4044,9 +4044,19 @@ bool wxWindowMSW::HandleDestroy()
// ---------------------------------------------------------------------------
bool wxWindowMSW::HandleActivate(int state,
bool WXUNUSED(minimized),
WXHWND WXUNUSED(activate))
bool minimized,
WXHWND WXUNUSED(activate))
{
if ( minimized )
{
// Getting activation event when the window is minimized, as happens
// e.g. when the window task bar icon is clicked, is unexpected and
// managed to even break the logic in wx itself (see #17128), so just
// don't do it as there doesn't seem to be any need to be notified
// about the activation of the window icon in the task bar in practice.
return false;
}
wxActivateEvent event(wxEVT_ACTIVATE,
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
m_windowId,