]> git.saurik.com Git - wxWidgets.git/commitdiff
Added IsTopLevel() check to last message loop in PreProcessMessage. This
authorJulian Smart <julian@anthemion.co.uk>
Wed, 17 Nov 2004 13:42:14 +0000 (13:42 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 17 Nov 2004 13:42:14 +0000 (13:42 +0000)
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

src/msw/evtloop.cpp

index 55ce24cbe5722e8e7ced8840909b9ca153f79572..b3294524199b2619237595030e2e95194d7f9978 100644 (file)
@@ -168,13 +168,20 @@ bool wxEventLoop::PreProcessMessage(WXMSG *msg)
             break;
     }
 
-    // now try the other hooks (kbd navigation is handled here): we start from
-    // wndThis->GetParent() because wndThis->MSWProcessMessage() was already
-    // called above
-    for ( wnd = wndThis->GetParent(); wnd; wnd = wnd->GetParent() )
+    // now try the other hooks (kbd navigation is handled here)
+    for ( wnd = wndThis; wnd; wnd = wnd->GetParent() )
     {
-        if ( wnd->MSWProcessMessage((WXMSG *)msg) )
-            return true;
+        if (wnd != wndThis) // Skip the first since wndThis->MSWProcessMessage() was called above
+        {
+            if ( wnd->MSWProcessMessage((WXMSG *)msg) )
+                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