diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 17d2ac81a..9065fdc84 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -442,7 +442,7 @@ notify_scroll (ClutterInputDevice *input_device, ClutterStage *stage; ClutterEvent *event = NULL; ClutterPoint point; - const gdouble scroll_factor = 10.0f; + gdouble scroll_factor; /* We can drop the event on the floor if no stage has been * associated with the device yet. */ @@ -460,7 +460,11 @@ notify_scroll (ClutterInputDevice *input_device, event->scroll.device = seat->core_pointer; _clutter_xkb_translate_state (event, seat->xkb, seat->button_state); + /* libinput pointer axis events are in pointer motion coordinate space. + * To convert to Xi2 discrete step coordinate space, multiply the factor + * 1/10. */ event->scroll.direction = CLUTTER_SCROLL_SMOOTH; + scroll_factor = 1.0 / 10.0; clutter_event_set_scroll_delta (event, scroll_factor * dx, scroll_factor * dy); diff --git a/clutter/wayland/clutter-input-device-wayland.c b/clutter/wayland/clutter-input-device-wayland.c index a3c9c1958..7bfb615b7 100644 --- a/clutter/wayland/clutter-input-device-wayland.c +++ b/clutter/wayland/clutter-input-device-wayland.c @@ -167,6 +167,7 @@ clutter_wayland_handle_axis (void *data, ClutterStageCogl *stage_cogl; ClutterEvent *event; gdouble delta_x, delta_y; + gdouble delta_factor; if (!device->pointer_focus) return; @@ -179,15 +180,19 @@ clutter_wayland_handle_axis (void *data, event->scroll.x = device->x; event->scroll.y = device->y; + /* Wayland pointer axis events are in pointer motion coordinate space. + * To convert to Xi2 discrete step coordinate space, multiply the factor + * 1/10. */ + delta_factor = 1.0 / 10.0; if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) { - delta_x = -wl_fixed_to_double(value) * 23; + delta_x = wl_fixed_to_double (value) * delta_factor; delta_y = 0; } else { delta_x = 0; - delta_y = -wl_fixed_to_double(value) * 23; /* XXX: based on my bcm5794 */ + delta_y = wl_fixed_to_double (value) * delta_factor; } clutter_event_set_scroll_delta (event, delta_x, delta_y);