[mutter] wayland: Scale smooth scroll events to pointer motion coordinate space



commit 048f035d30599902c3eaa44cce29a1fda3f8a755
Author: Jonas Ådahl <jadahl gmail com>
Date:   Sat May 3 21:06:08 2014 +0200

    wayland: Scale smooth scroll events to pointer motion coordinate space
    
    Smooth scroll event vectors from clutter have the same dimensions as the
    ones from from Xi2, i.e. where 1.0 is 1 discrete scroll step. To scale
    these to the coordinate space used by wl_pointer.axis
    vertical/horizontal scroll events, multiply the vector by 10.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729601

 src/wayland/meta-wayland-pointer.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index ff6f6e3..a4a5f05 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -383,9 +383,13 @@ handle_scroll_event (MetaWaylandPointer *pointer,
     case CLUTTER_SCROLL_SMOOTH:
       {
         double dx, dy;
+        /* Clutter smooth scroll events are in discrete steps (1 step = 1.0 long
+         * vector along one axis). To convert to smooth scroll events that are
+         * in pointer motion event space, multiply the vector with the 10. */
+        const double factor = 10.0;
         clutter_event_get_scroll_delta (event, &dx, &dy);
-        x_value = wl_fixed_from_double (dx);
-        y_value = wl_fixed_from_double (dy);
+        x_value = wl_fixed_from_double (dx) * factor;
+        y_value = wl_fixed_from_double (dy) * factor;
       }
       break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]