Send deactivation events to MDI children frame in wxMSW too.

For some reason, the code only forwarded activation events to the current MDI
child, but not the deactivation ones. And even though this was literally
always the case (the check for the event being the activation one is there
since r9), it is clearly wrong as the focus restoring code in wxTopLevelWindow
in wxMSW doesn't work if the focus hadn't been previously saved.

This fix hopefully completes the changes started by r78340 and r78341 and
ensures that the focus is always properly restored to the last focused window
inside an MDI child.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2015-01-09 03:30:13 +00:00
parent a6d74d8176
commit 510ae4e0b4

View File

@ -669,14 +669,12 @@ bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate
processed = !m_activationNotHandled;
}
// If this window is an MDI parent, we must also send an OnActivate message
// to the current child.
if ( GetActiveChild() &&
((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) )
// Also generate the (de)activation event for the current child, if any, to
// allow updating its state and, in particular, remembering or restoring
// its last focused window.
if ( GetActiveChild() )
{
wxActivateEvent event(wxEVT_ACTIVATE, true, GetActiveChild()->GetId());
event.SetEventObject( GetActiveChild() );
if ( GetActiveChild()->HandleWindowEvent(event) )
if ( GetActiveChild()->HandleActivate(state, minimized, activate) )
processed = true;
}