Bugzilla – Attachment 183655 Details for
Bug 143209
Edge Scrolling no longer works properly on my touchpad beginning with version 6.2 and newer.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch that fixes the bug. Developed against libreoffice-core commit 0eec6d44c65f895c6fe2172792717418627db05d.
0001-vcl-track-partial-scroll-deltas.patch (text/plain), 5.95 KB, created by
jeyov45316
on 2022-11-18 03:52:06 UTC
(
hide
)
Description:
Patch that fixes the bug. Developed against libreoffice-core commit 0eec6d44c65f895c6fe2172792717418627db05d.
Filename:
MIME Type:
Creator:
jeyov45316
Created:
2022-11-18 03:52:06 UTC
Size:
5.95 KB
patch
obsolete
>From 35c4a884dc3ccf9013b4caa650b96e08e66136dd Mon Sep 17 00:00:00 2001 >From: Jonas Eyov <jeyov45316@singalore.com> >Date: Fri, 18 Nov 2022 03:40:57 +0000 >Subject: [PATCH] vcl: track partial scroll deltas > >previously, Window::HandleScrollCommand only checked each event for >being a large enough scroll to advance one unit. this happened in >lcl_HandleScrollHelper by way of o3tl::saturating_cast, which meant >that nonzero upward/leftward scrolls were always worth at least one >unit, while downward/rightward scrolls needed to be larger than 1 to >count. > >now, we accumulate partial scroll offsets in WindowImpl and perfor a >saturating cast on the absolute value, so behavior is symmetric and >sensitive to accumulated small scroll values. this feels smoother >and is more correct. > >Fixes: https://bugs.documentfoundation.org/show_bug.cgi > >Change-Id: Id3692d14edd45ed26f2952e3418e4d82806e1fc4 >--- > vcl/inc/window.h | 2 ++ > vcl/source/window/window.cxx | 2 ++ > vcl/source/window/window2.cxx | 38 +++++++++++++++++++++-------------- > 3 files changed, 27 insertions(+), 15 deletions(-) > >diff --git a/vcl/inc/window.h b/vcl/inc/window.h >index 639bee80e..64f404d73 100644 >--- a/vcl/inc/window.h >+++ b/vcl/inc/window.h >@@ -256,6 +256,8 @@ public: > vcl::Cursor* mpCursor; > PointerStyle maPointer; > Fraction maZoom; >+ double partialScrollX; >+ double partialScrollY; > OUString maText; > std::optional<vcl::Font> > mpControlFont; >diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx >index 4705fe516..05366d7fb 100644 >--- a/vcl/source/window/window.cxx >+++ b/vcl/source/window/window.cxx >@@ -590,6 +590,8 @@ WindowImpl::WindowImpl( vcl::Window& rWindow, WindowType nType ) > { > mxOutDev = VclPtr<vcl::WindowOutputDevice>::Create(rWindow); > maZoom = Fraction( 1, 1 ); >+ partialScrollX = 0.0; >+ partialScrollY = 0.0; > maWinRegion = vcl::Region(true); > maWinClipRegion = vcl::Region(true); > mpWinData = nullptr; // Extra Window Data, that we don't need for all windows >diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx >index b6c4ee254..06dbdd319 100644 >--- a/vcl/source/window/window2.cxx >+++ b/vcl/source/window/window2.cxx >@@ -598,12 +598,14 @@ tools::Long Window::GetDrawPixel( OutputDevice const * pDev, tools::Long nPixels > return nP; > } > >-static void lcl_HandleScrollHelper( Scrollable* pScrl, double nN, bool isMultiplyByLineSize ) >+// returns how much was actually scrolled (so that abs(retval) <= abs(nN)) >+static double lcl_HandleScrollHelper( Scrollable* pScrl, double nN, bool isMultiplyByLineSize ) > { > if (!pScrl || !nN || pScrl->Inactive()) >- return; >+ return 0.0; > > tools::Long nNewPos = pScrl->GetThumbPos(); >+ double scrolled = nN; > > if ( nN == double(-LONG_MAX) ) > nNewPos += pScrl->GetPageSize(); >@@ -616,13 +618,23 @@ static void lcl_HandleScrollHelper( Scrollable* pScrl, double nN, bool isMultipl > nN*=pScrl->GetLineSize(); > } > >- const double fVal = nNewPos - nN; >+ // compute how many quantized units to scroll >+ tools::Long magnitude = o3tl::saturating_cast<tools::Long>(abs(nN)); >+ tools::Long change = copysign(magnitude, nN); >+ >+ nNewPos = nNewPos - change; > >- nNewPos = o3tl::saturating_cast<tools::Long>(fVal); >+ scrolled = double(change); >+ // convert back to chunked/continuous >+ if(isMultiplyByLineSize){ >+ scrolled /= pScrl->GetLineSize(); >+ } > } > >+ printf("DoScroll %ld, scrolled %lf\n", nNewPos, scrolled); > pScrl->DoScroll( nNewPos ); > >+ return scrolled; > } > > bool Window::HandleScrollCommand( const CommandEvent& rCmd, >@@ -668,6 +680,9 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, > { > double nScrollLines = pData->GetScrollLines(); > double nLines; >+ double* partialScroll = pData->IsHorz() >+ ? &mpWindowImpl->partialScrollX >+ : &mpWindowImpl->partialScrollY; > if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL ) > { > if ( pData->GetDelta() < 0 ) >@@ -676,13 +691,12 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, > nLines = double(LONG_MAX); > } > else >- nLines = pData->GetNotchDelta() * nScrollLines; >+ nLines = *partialScroll + pData->GetNotchDelta() * nScrollLines; > if ( nLines ) > { >- ImplHandleScroll( nullptr, >- 0L, >- pData->IsHorz() ? pHScrl : pVScrl, >- nLines ); >+ Scrollable* pScrl = pData->IsHorz() ? pHScrl : pVScrl; >+ double scrolled = lcl_HandleScrollHelper( pScrl, nLines, true ); >+ *partialScroll = nLines - scrolled; > bRet = true; > } > } >@@ -806,12 +820,6 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, > return bRet; > } > >-// Note that when called for CommandEventId::Wheel above, despite its name, >-// pVScrl isn't necessarily the vertical scroll bar. Depending on >-// whether the scroll is horizontal or vertical, it is either the >-// horizontal or vertical scroll bar. nY is correspondingly either >-// the horizontal or vertical scroll amount. >- > void Window::ImplHandleScroll( Scrollable* pHScrl, double nX, > Scrollable* pVScrl, double nY ) > { >-- >2.38.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 143209
: 183655