diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 5d0b719a02d2..39b5610e35a9 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -193,6 +193,7 @@ struct ImplSVWinData AutoTimer* mpTrackTimer; // tracking timer ImageList* mpMsgBoxImgList; // ImageList for MessageBox VclPtr mpAutoScrollWin; // window, that is in AutoScrollMode mode + VclPtr mpLastWheelWindow; // window, that last received a mouse wheel event StartTrackingFlags mnTrackFlags; // tracking flags StartAutoScrollFlags mnAutoScrollFlags; // auto scroll flags bool mbNoDeactivate; // true: do not execute Deactivate diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 13364c97ffe0..e70cdc6d99f3 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -477,6 +477,10 @@ void Window::dispose() if( pSVData->maWinData.mpActiveApplicationFrame == this ) pSVData->maWinData.mpActiveApplicationFrame = nullptr; + // reset hint of what was the last wheeled window + if( pSVData->maWinData.mpLastWheelWindow == this ) + pSVData->maWinData.mpLastWheelWindow = nullptr; + // reset marked windows if ( mpWindowImpl->mpFrameData != nullptr ) { diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index d72d48e5fba9..1f46253ec9d8 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1475,27 +1475,27 @@ public: bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt) { static SalWheelMouseEvent aPreviousEvent; - static vcl::DeleteOnDeinit< VclPtr > xPreviousWindow( new VclPtr ); if (!Setup()) return false; VclPtr xMouseWindow = FindTarget(); + ImplSVData* pSVData = ImplGetSVData(); + // avoid the problem that scrolling via wheel to this point brings a widget // under the mouse that also accepts wheel commands, so stick with the old // widget if the time gap is very small - VclPtr tmp = *xPreviousWindow.get(); - if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(tmp)) + if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(pSVData->maWinData.mpLastWheelWindow)) { - xMouseWindow = tmp; + xMouseWindow = pSVData->maWinData.mpLastWheelWindow; } aPreviousEvent = rEvt; - (*xPreviousWindow.get()) = Dispatch(xMouseWindow); + pSVData->maWinData.mpLastWheelWindow = Dispatch(xMouseWindow); - return *xPreviousWindow.get(); + return pSVData->maWinData.mpLastWheelWindow.get(); } class HandleGestureEvent : public HandleGestureEventBase