diff --git a/src/common/event.cpp b/src/common/event.cpp index 061d991d7a..73d7d79ba6 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -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 diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 80165004e0..ed4d736788 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -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.