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>
This commit is contained in:
Jonas Ådahl
2014-10-05 21:39:14 +02:00
parent 870fadced3
commit d2510105a6
9 changed files with 116 additions and 40 deletions
+8 -3
View File
@@ -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);
}