Call wxEvtHandler::TryBefore() only once from ProcessEvent().

The event pre-processing hooks associated with the window should be called
only once during the event processing, we don't need to call TryBefore() for
each and every event handler associated with the window too.

This makes the code slightly simpler and faster and shouldn't change the
behaviour of any existing code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-05-09 14:55:21 +00:00
parent c0c05e79b2
commit 255ea4a702
2 changed files with 8 additions and 9 deletions

View File

@ -463,10 +463,10 @@ public:
The normal order of event table searching is as follows:
-# wxApp::FilterEvent() is called. If it returns anything but @c -1
(default) the processing stops here.
-# If the object is disabled (via a call to wxEvtHandler::SetEvtHandlerEnabled)
the function skips to step (7).
-# TryBefore() is called (this is where wxValidator are taken into
account for wxWindow objects). If this returns @true, the function exits.
-# If the object is disabled (via a call to wxEvtHandler::SetEvtHandlerEnabled)
the function skips to step (7).
-# Dynamic event table of the handlers bound using Bind<>() is
searched. If a handler is found, it is executed and the function
returns @true unless the handler used wxEvent::Skip() to indicate
@ -489,7 +489,7 @@ public:
processed, ProcessEvent() on wxTheApp object is called as the last
step.
Notice that steps (2)-(6) are performed in ProcessEventHere() which is
Notice that steps (3)-(5) are performed in ProcessEventHere() which is
called by this function.
@param event
@ -508,8 +508,7 @@ public:
This method is called from ProcessEvent(), please see the detailed
description of the event processing logic there.
It is @em not virtual and so may not be overridden but it does call
virtual TryBefore() which may be overridden.
It is @em not virtual and so may not be overridden.
@param event
Event to process.

View File

@ -1361,6 +1361,10 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
}
}
// Try the hooks which should be called before our own handlers
if ( TryBefore(event) )
return true;
if ( ProcessEventHere(event) )
return true;
@ -1381,10 +1385,6 @@ bool wxEvtHandler::ProcessEventHere(wxEvent& event)
if ( !GetEvtHandlerEnabled() )
return false;
// Try the hooks which should be called before our own handlers
if ( TryBefore(event) )
return true;
// Handle per-instance dynamic event tables first
if ( m_dynamicEvents && SearchDynamicEventTable(event) )
return true;