From 048f035d30599902c3eaa44cce29a1fda3f8a755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 3 May 2014 21:06:08 +0200 Subject: [PATCH] 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 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index ff6f6e3e0..a4a5f05e7 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;