Add a weston_pointer_axis_event
Use an event struct to pass axis events around. This helps dealing with the
upcoming axis discrete changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 7cc6a35..9860d6e 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -199,23 +199,26 @@
libinput_device_get_user_data(libinput_device);
double value;
enum libinput_pointer_axis axis;
+ struct weston_pointer_axis_event weston_event;
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
value = normalize_scroll(pointer_event, axis);
+ weston_event.value = wl_fixed_from_double(value);
+ weston_event.axis = WL_POINTER_AXIS_VERTICAL_SCROLL;
notify_axis(device->seat,
libinput_event_pointer_get_time(pointer_event),
- WL_POINTER_AXIS_VERTICAL_SCROLL,
- wl_fixed_from_double(value));
+ &weston_event);
}
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
value = normalize_scroll(pointer_event, axis);
+ weston_event.value = wl_fixed_from_double(value);
+ weston_event.axis = WL_POINTER_AXIS_HORIZONTAL_SCROLL;
notify_axis(device->seat,
libinput_event_pointer_get_time(pointer_event),
- WL_POINTER_AXIS_HORIZONTAL_SCROLL,
- wl_fixed_from_double(value));
+ &weston_event);
}
}