input: Make pointer grab motion callbacks take an event struct
Instead of only passing absolute pointer coordinates, effectively
loosing motion event data, pass a struct that can potentially contain
different types of motion events, currently being absolute and relative.
A helper function to get resulting absolute coordinates was added for
when previous callbacks simply used the (x, y) coordinates.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 69dcbf8..7cc6a35 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -86,14 +86,17 @@
{
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
- wl_fixed_t dx, dy;
+ struct weston_pointer_motion_event event = { 0 };
- dx = wl_fixed_from_double(libinput_event_pointer_get_dx(pointer_event));
- dy = wl_fixed_from_double(libinput_event_pointer_get_dy(pointer_event));
+ event = (struct weston_pointer_motion_event) {
+ .mask = WESTON_POINTER_MOTION_REL,
+ .dx = libinput_event_pointer_get_dx(pointer_event),
+ .dy = libinput_event_pointer_get_dy(pointer_event),
+ };
+
notify_motion(device->seat,
libinput_event_pointer_get_time(pointer_event),
- dx,
- dy);
+ &event);
}
static void