diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2014-10-05 21:39:14 +0200 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2015-11-20 11:44:56 +0800 |
commit | d2510105a6e411790f3d5bd3acd1e0d0e295ff06 (patch) | |
tree | 69857f69085216be3028c0a60ef8c9ac5d2a26d6 /tests | |
parent | 870fadced3f19659b60574888432b79713776097 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/weston-test.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/weston-test.c b/tests/weston-test.c index b593f1e8..b6ae91a4 100644 --- a/tests/weston-test.c +++ b/tests/weston-test.c @@ -145,10 +145,15 @@ move_pointer(struct wl_client *client, struct wl_resource *resource, 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); } |