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/tests/weston-test.c b/tests/weston-test.c
index b593f1e..b6ae91a 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -145,10 +145,15 @@
struct weston_test *test = wl_resource_get_user_data(resource);
struct weston_seat *seat = get_seat(test);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
+ struct weston_pointer_motion_event event = { 0 };
- notify_motion(seat, 100,
- wl_fixed_from_int(x) - pointer->x,
- wl_fixed_from_int(y) - pointer->y);
+ event = (struct weston_pointer_motion_event) {
+ .mask = WESTON_POINTER_MOTION_REL,
+ .dx = wl_fixed_to_double(wl_fixed_from_int(x) - pointer->x),
+ .dy = wl_fixed_to_double(wl_fixed_from_int(y) - pointer->y),
+ };
+
+ notify_motion(seat, 100, &event);
notify_pointer_position(test, resource);
}