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:
@@ -167,6 +167,7 @@ wxMSW:
|
|||||||
- Avoid bogus assert after calling wxDatePickerCtrl::SetRange().
|
- Avoid bogus assert after calling wxDatePickerCtrl::SetRange().
|
||||||
- Add solution file for building with MSVS 2014 (Peter Tissen).
|
- Add solution file for building with MSVS 2014 (Peter Tissen).
|
||||||
- Correct wxGetOsDescription() for Windows 10 (Tobias Taschner).
|
- Correct wxGetOsDescription() for Windows 10 (Tobias Taschner).
|
||||||
|
- Don't send wxActivateEvent for minimized windows (bzcdr).
|
||||||
|
|
||||||
wxOSX/Cocoa:
|
wxOSX/Cocoa:
|
||||||
|
|
||||||
|
@@ -3005,6 +3005,11 @@ public:
|
|||||||
a @c wxEVT_ACTIVATE or @c wxEVT_ACTIVATE_APP event.
|
a @c wxEVT_ACTIVATE or @c wxEVT_ACTIVATE_APP event.
|
||||||
@endEventTable
|
@endEventTable
|
||||||
|
|
||||||
|
@note Until wxWidgets 3.1.0 activation events could be sent by wxMSW when
|
||||||
|
the window was minimized. This reflected the native MSW behaviour but was
|
||||||
|
often surprising and unexpected, so starting from 3.1.0 such events are not
|
||||||
|
sent any more when the window is in the minimized state.
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{events}
|
@category{events}
|
||||||
|
|
||||||
|
@@ -4044,9 +4044,19 @@ bool wxWindowMSW::HandleDestroy()
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxWindowMSW::HandleActivate(int state,
|
bool wxWindowMSW::HandleActivate(int state,
|
||||||
bool WXUNUSED(minimized),
|
bool minimized,
|
||||||
WXHWND WXUNUSED(activate))
|
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,
|
wxActivateEvent event(wxEVT_ACTIVATE,
|
||||||
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
|
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
|
||||||
m_windowId,
|
m_windowId,
|
||||||
|
Reference in New Issue
Block a user