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:
+8
-3
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user