Added IsTopLevel() check to last message loop in PreProcessMessage. This

stops e.g. ESC being processed by a parent modal dialog if not processed
by the child -> assert and lockup


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-11-17 13:42:14 +00:00
parent a1d47842fc
commit 22cfea03b8

View File

@@ -168,15 +168,22 @@ bool wxEventLoop::PreProcessMessage(WXMSG *msg)
break; break;
} }
// now try the other hooks (kbd navigation is handled here): we start from // now try the other hooks (kbd navigation is handled here)
// wndThis->GetParent() because wndThis->MSWProcessMessage() was already for ( wnd = wndThis; wnd; wnd = wnd->GetParent() )
// called above {
for ( wnd = wndThis->GetParent(); wnd; wnd = wnd->GetParent() ) if (wnd != wndThis) // Skip the first since wndThis->MSWProcessMessage() was called above
{ {
if ( wnd->MSWProcessMessage((WXMSG *)msg) ) if ( wnd->MSWProcessMessage((WXMSG *)msg) )
return true; return true;
} }
// Stop at first top level window (as per comment above).
// If we don't do this, pressing ESC on a modal dialog shown as child of a modal
// dialog with wxID_CANCEL will cause the parent dialog to be closed, for example
if (wnd->IsTopLevel())
break;
}
// no special preprocessing for this message, dispatch it normally // no special preprocessing for this message, dispatch it normally
return false; return false;
} }