From de54520c958205e684cfbc2fee04e2c7787bbec7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 20 Nov 2013 16:04:12 +0000 Subject: [PATCH] Don't process events handled in user code in generic scrolling code. Undo the change introduced, probably accidentally, by r11369 (12 years ago) and skip the default handling of all events except wxEVT_SIZE and wxEVT_PAINT, which are special for the reasons explained in the comments in the code, if the user code has already handled the event. This allows to customize scrolling by selectively handling some scrolling events only and generally makes sense. Closes #15684. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 8 +++++--- src/generic/vscroll.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 6291815209..c14ab53075 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -214,9 +214,6 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } - if ( processed && event.IsCommandEvent()) - return true; - // For wxEVT_PAINT the user code can either handle this event as usual or // override virtual OnDraw(), so if the event hasn't been handled we need // to call this virtual function ourselves. @@ -235,6 +232,11 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } + // If the user code handled this event, it should prevent the default + // handling from taking place, so don't do anything else in this case. + if ( processed ) + return true; + if ( evType == wxEVT_CHILD_FOCUS ) { m_scrollHelper->HandleOnChildFocus((wxChildFocusEvent &)event); diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 10afddad01..38e882bbb0 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -89,9 +89,6 @@ bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } - if ( processed && event.IsCommandEvent()) - return true; - // For wxEVT_PAINT the user code can either handle this event as usual or // override virtual OnDraw(), so if the event hasn't been handled we need // to call this virtual function ourselves. @@ -110,6 +107,11 @@ bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } + // If the user code handled this event, it should prevent the default + // handling from taking place, so don't do anything else in this case. + if ( processed ) + return true; + // reset the skipped flag (which might have been set to true in // ProcessEvent() above) to be able to test it below bool wasSkipped = event.GetSkipped();