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:
@@ -463,10 +463,10 @@ public:
|
|||||||
The normal order of event table searching is as follows:
|
The normal order of event table searching is as follows:
|
||||||
-# wxApp::FilterEvent() is called. If it returns anything but @c -1
|
-# wxApp::FilterEvent() is called. If it returns anything but @c -1
|
||||||
(default) the processing stops here.
|
(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
|
-# TryBefore() is called (this is where wxValidator are taken into
|
||||||
account for wxWindow objects). If this returns @true, the function exits.
|
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
|
-# Dynamic event table of the handlers bound using Bind<>() is
|
||||||
searched. If a handler is found, it is executed and the function
|
searched. If a handler is found, it is executed and the function
|
||||||
returns @true unless the handler used wxEvent::Skip() to indicate
|
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
|
processed, ProcessEvent() on wxTheApp object is called as the last
|
||||||
step.
|
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.
|
called by this function.
|
||||||
|
|
||||||
@param event
|
@param event
|
||||||
@@ -508,8 +508,7 @@ public:
|
|||||||
This method is called from ProcessEvent(), please see the detailed
|
This method is called from ProcessEvent(), please see the detailed
|
||||||
description of the event processing logic there.
|
description of the event processing logic there.
|
||||||
|
|
||||||
It is @em not virtual and so may not be overridden but it does call
|
It is @em not virtual and so may not be overridden.
|
||||||
virtual TryBefore() which may be overridden.
|
|
||||||
|
|
||||||
@param event
|
@param event
|
||||||
Event to process.
|
Event to process.
|
||||||
|
@@ -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) )
|
if ( ProcessEventHere(event) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -1381,10 +1385,6 @@ bool wxEvtHandler::ProcessEventHere(wxEvent& event)
|
|||||||
if ( !GetEvtHandlerEnabled() )
|
if ( !GetEvtHandlerEnabled() )
|
||||||
return false;
|
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
|
// Handle per-instance dynamic event tables first
|
||||||
if ( m_dynamicEvents && SearchDynamicEventTable(event) )
|
if ( m_dynamicEvents && SearchDynamicEventTable(event) )
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user