From f7d2bf216afa10268e6a7c1d4613a2fd8f7c7f3c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 16 May 2017 10:12:09 +0100 Subject: Resolves: tdf#103174 & rhbz#1367846 improve gtk3 trackpad scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit convert number of "lines" scrolled to double and allow fractional parts of lines/columns Change-Id: Ib99c815cfc8823e22fc1d76e201903c34ed0f61b Related: rhbz#1367846 queue and merge scroll events Reviewed-on: https://gerrit.libreoffice.org/37779 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit 7f60978b2ccd0e17816b78bde60c6e0e60a9d52e) Change-Id: Ib45f61bbb35bd240829491ac8a79803222974778 Reviewed-on: https://gerrit.libreoffice.org/37913 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- vcl/source/window/commandevent.cxx | 4 ++-- vcl/source/window/window2.cxx | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx index e7f7dcd8569d..8ef928f3a571 100644 --- a/vcl/source/window/commandevent.cxx +++ b/vcl/source/window/commandevent.cxx @@ -73,7 +73,7 @@ CommandWheelData::CommandWheelData() { mnDelta = 0; mnNotchDelta = 0; - mnLines = 0; + mnLines = 0.0; mnWheelMode = CommandWheelMode::NONE; mnCode = 0; mbHorz = false; @@ -81,7 +81,7 @@ CommandWheelData::CommandWheelData() } CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta, - sal_uLong nScrollLines, + double nScrollLines, CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier, bool bHorz, bool bDeltaIsPixel ) { diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 24d1fa79eae2..9607be6e3d21 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -664,7 +664,7 @@ long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const return nP; } -static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN, bool isMultiplyByLineSize ) +static void lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool isMultiplyByLineSize ) { if ( pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode() ) { @@ -681,7 +681,7 @@ static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN, bool isMultiplyBy nN*=pScrl->GetLineSize(); } - const double fVal = (double)(nNewPos - nN); + const double fVal = nNewPos - nN; if ( fVal < LONG_MIN ) nNewPos = LONG_MIN; @@ -737,8 +737,8 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, { if (!pData->IsDeltaPixel()) { - sal_uLong nScrollLines = pData->GetScrollLines(); - long nLines; + double nScrollLines = pData->GetScrollLines(); + double nLines; if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL ) { if ( pData->GetDelta() < 0 ) @@ -747,7 +747,7 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, nLines = LONG_MAX; } else - nLines = pData->GetNotchDelta() * (long)nScrollLines; + nLines = pData->GetNotchDelta() * nScrollLines; if ( nLines ) { ImplHandleScroll( nullptr, @@ -860,8 +860,8 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, // horizontal or vertical scroll bar. nY is correspondingly either // the horizontal or vertical scroll amount. -void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX, - ScrollBar* pVScrl, long nY ) +void Window::ImplHandleScroll( ScrollBar* pHScrl, double nX, + ScrollBar* pVScrl, double nY ) { lcl_HandleScrollHelper( pHScrl, nX, true ); lcl_HandleScrollHelper( pVScrl, nY, true ); -- cgit