]> git.saurik.com Git - wxWidgets.git/commitdiff
merged fixes for accel and command event non propagation from 2.2
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 May 2001 23:46:30 +0000 (23:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 May 2001 23:46:30 +0000 (23:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/event.cpp
src/msw/app.cpp

index 061d991d7a4624ef1c7852b368f448ff15705a54..73d7d79ba674238864b8bfd44a00c55a4b74c8f9 100644 (file)
@@ -943,15 +943,21 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
     }
 
 #if wxUSE_GUI
-    // Carry on up the parent-child hierarchy,
-    // but only if event is a command event: it wouldn't
-    // make sense for a parent to receive a child's size event, for example
+    // Carry on up the parent-child hierarchy, but only if event is a command
+    // event: it wouldn't make sense for a parent to receive a child's size
+    // event, for example
     if ( m_isWindow && event.IsCommandEvent() )
     {
         wxWindow *win = (wxWindow *)this;
-        wxWindow *parent = win->GetParent();
-        if (parent && !parent->IsBeingDeleted())
-            return parent->GetEventHandler()->ProcessEvent(event);
+
+        // also, don't propagate events beyond the first top level window: it
+        // doesn't make sense to process dialogs events in the parent frame
+        if ( !win->IsTopLevel() )
+        {
+            wxWindow *parent = win->GetParent();
+            if (parent && !parent->IsBeingDeleted())
+                return parent->GetEventHandler()->ProcessEvent(event);
+        }
     }
 #endif // wxUSE_GUI
 
index 80165004e02f42feb13be81aa3a964632acf9689..ed4d7367887739ba8cb9c71fb08307ef66151cdd 100644 (file)
@@ -1060,6 +1060,12 @@ bool wxApp::ProcessMessage(WXMSG *wxmsg)
     {
         if ( wnd->MSWTranslateMessage(wxmsg) )
             return TRUE;
+
+        // stop at first top level window, i.e. don't try to process the key
+        // strokes originating in a dialog using the accelerators of the parent
+        // frame - this doesn't make much sense
+        if ( wnd->IsTopLevel() )
+            break;
     }
 
     // Anyone for a non-translation message? Try youngest descendants first.