include/vcl/commandevent.hxx       |    6 +++---
 include/vcl/window.hxx             |    6 +++---
 vcl/inc/salwtype.hxx               |    2 +-
 vcl/source/window/commandevent.cxx |    4 ++--
 vcl/source/window/window2.cxx      |   14 +++++++-------
 vcl/unx/gtk3/gtk3gtkframe.cxx      |   10 ++--------
 6 files changed, 18 insertions(+), 24 deletions(-)

New commits:
commit b53c84af0a34aa9193b0e35363ca2ebe00c3e32c
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue May 16 10:12:09 2017 +0100

    Resolves: rhbz#1367846 improve gtk3 trackpad scrolling
    
    convert number of "lines" scrolled to double and allow
    fractional parts of lines/columns
    
    Change-Id: Ib99c815cfc8823e22fc1d76e201903c34ed0f61b
    Reviewed-on: https://gerrit.libreoffice.org/37669
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 7b143e402ce4..68ea0c5184d7 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -141,7 +141,7 @@ class VCL_DLLPUBLIC CommandWheelData
 private:
     long              mnDelta;
     long              mnNotchDelta;
-    sal_uLong         mnLines;
+    double            mnLines;
     CommandWheelMode  mnWheelMode;
     sal_uInt16        mnCode;
     bool              mbHorz;
@@ -150,13 +150,13 @@ private:
 public:
                     CommandWheelData();
                     CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
-                                      sal_uLong nScrollLines,
+                                      double nScrollLines,
                                       CommandWheelMode nWheelMode, sal_uInt16 
nKeyModifier,
                                       bool bHorz, bool bDeltaIsPixel = false );
 
     long            GetDelta() const { return mnDelta; }
     long            GetNotchDelta() const { return mnNotchDelta; }
-    sal_uLong       GetScrollLines() const { return mnLines; }
+    double          GetScrollLines() const { return mnLines; }
     bool            IsHorz() const { return mbHorz; }
     bool            IsDeltaPixel() const { return mbDeltaIsPixel; }
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index d59ac3e99302..7e67182d5095 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -714,9 +714,9 @@ private:
     SAL_DLLPRIVATE void                 
ImplCallActivateListeners(vcl::Window*);
     SAL_DLLPRIVATE void                 
ImplCallDeactivateListeners(vcl::Window*);
 
-    SAL_DLLPRIVATE static void          ImplHandleScroll( ScrollBar* pHScrl, 
long nX, ScrollBar* pVScrl, long nY );
+    SAL_DLLPRIVATE static void          ImplHandleScroll(ScrollBar* pHScrl, 
double nX, ScrollBar* pVScrl, double nY);
 
-    SAL_DLLPRIVATE tools::Rectangle            
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) 
const;
+    SAL_DLLPRIVATE tools::Rectangle     
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) 
const;
     SAL_DLLPRIVATE long                 ImplGetUnmirroredOutOffX();
 
     // retrieves the list of owner draw decorated windows for this window 
hiearchy
@@ -724,7 +724,7 @@ private:
 
     SAL_DLLPRIVATE vcl::Window*         ImplGetTopmostFrameWindow();
 
-    SAL_DLLPRIVATE tools::Rectangle            ImplGetWindowExtentsRelative( 
vcl::Window *pRelativeWindow, bool bClientOnly ) const;
+    SAL_DLLPRIVATE tools::Rectangle     ImplGetWindowExtentsRelative( 
vcl::Window *pRelativeWindow, bool bClientOnly ) const;
 
     SAL_DLLPRIVATE bool                 ImplStopDnd();
     SAL_DLLPRIVATE void                 ImplStartDnd();
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index 168185913880..605e26c94774 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -151,7 +151,7 @@ struct SalWheelMouseEvent
     long            mnY;            // Y-Position (Pixel, TopLeft-Output)
     long            mnDelta;        // Number of rotations
     long            mnNotchDelta;   // Number of fixed rotations
-    sal_uLong       mnScrollLines;  // Actual number of lines to scroll
+    double          mnScrollLines;  // Actual number of lines to scroll
     sal_uInt16      mnCode;         // SV-Modifiercode 
(KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT)
     bool        mbHorz;         // Horizontal
     bool        mbDeltaIsPixel; // delta value is a pixel value (on touch 
devices)
diff --git a/vcl/source/window/commandevent.cxx 
b/vcl/source/window/commandevent.cxx
index b9525ac3a3fb..b298022abc56 100644
--- a/vcl/source/window/commandevent.cxx
+++ b/vcl/source/window/commandevent.cxx
@@ -64,7 +64,7 @@ CommandWheelData::CommandWheelData()
 {
     mnDelta         = 0;
     mnNotchDelta    = 0;
-    mnLines         = 0;
+    mnLines         = 0.0;
     mnWheelMode     = CommandWheelMode::NONE;
     mnCode          = 0;
     mbHorz          = false;
@@ -72,7 +72,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 d0dd1bcc3c98..740680ca6407 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -648,7 +648,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() )
     {
@@ -665,7 +665,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;
@@ -721,8 +721,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 )
@@ -731,7 +731,7 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd,
                                 nLines = LONG_MAX;
                         }
                         else
-                            nLines = pData->GetNotchDelta() * 
(long)nScrollLines;
+                            nLines = pData->GetNotchDelta() * nScrollLines;
                         if ( nLines )
                         {
                             ImplHandleScroll( nullptr,
@@ -844,8 +844,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 );
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 5a8b5e89a74c..7b42662691bd 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2684,10 +2684,7 @@ gboolean GtkSalFrame::signalScroll(GtkWidget*, 
GdkEventScroll* pEvent, gpointer
                 if (aEvent.mnDelta == 0)
                     aEvent.mnDelta = aEvent.mnNotchDelta;
                 aEvent.mbHorz = true;
-                aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40;
-                if (aEvent.mnScrollLines == 0)
-                    aEvent.mnScrollLines = 1;
-
+                aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40.0;
                 pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent);
             }
 
@@ -2698,10 +2695,7 @@ gboolean GtkSalFrame::signalScroll(GtkWidget*, 
GdkEventScroll* pEvent, gpointer
                 if (aEvent.mnDelta == 0)
                     aEvent.mnDelta = aEvent.mnNotchDelta;
                 aEvent.mbHorz = false;
-                aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40;
-                if (aEvent.mnScrollLines == 0)
-                    aEvent.mnScrollLines = 1;
-
+                aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40.0;
                 pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent);
             }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to