From: Vadim Zeitlin Date: Tue, 7 May 2013 15:07:28 +0000 (+0000) Subject: Fix for event propagation in "single document" doc/view mode. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/82dfe81b283888d85bcc3d7516c16e0373b175be Fix for event propagation in "single document" doc/view mode. Ensure that the events still get to wxDocManager even when we are using the single document mode in which a view can be directly associated with the parent frame. Closes #14314. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 246d247254..4118192416 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2075,15 +2075,24 @@ bool wxDocParentFrameAnyBase::TryProcessEvent(wxEvent& event) // already forwarded the event to wxDocManager, check for this: if ( wxView* const view = m_docManager->GetAnyUsableView() ) { - // Notice that we intentionally don't use wxGetTopLevelParent() here - // because we want to check both for the case of a child "frame" (e.g. - // MDI child frame or notebook page) inside this TLW and a separate - // child TLW frame (as used in the SDI mode) here. - for ( wxWindow* win = view->GetFrame(); win; win = win->GetParent() ) + wxWindow* win = view->GetFrame(); + if ( win != m_frame ) { - if ( win == m_frame ) - return false; + // Notice that we intentionally don't use wxGetTopLevelParent() + // here because we want to check both for the case of a child + // "frame" (e.g. MDI child frame or notebook page) inside this TLW + // and a separate child TLW frame (as used in the SDI mode) here. + for ( win = win->GetParent(); win; win = win->GetParent() ) + { + if ( win == m_frame ) + return false; + } } + //else: This view is directly associated with the parent frame (which + // can happen in the so called "single" mode in which only one + // document can be opened and so is managed by the parent frame + // itself), there can be no child frame in play so we must forward + // the event to wxDocManager ourselves. } // But forward the event to wxDocManager ourselves if there are no views at