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 /src/libinput-device.c | |
parent | 870fadced3f19659b60574888432b79713776097 (diff) | |
download | weston-d2510105a6e411790f3d5bd3acd1e0d0e295ff06.tar.gz |
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 'src/libinput-device.c')
-rw-r--r-- | src/libinput-device.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libinput-device.c b/src/libinput-device.c index 69dcbf83..7cc6a357 100644 --- a/src/libinput-device.c +++ b/src/libinput-device.c @@ -86,14 +86,17 @@ handle_pointer_motion(struct libinput_device *libinput_device, { struct evdev_device *device = libinput_device_get_user_data(libinput_device); - wl_fixed_t dx, dy; + struct weston_pointer_motion_event event = { 0 }; + + 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), + }; - dx = wl_fixed_from_double(libinput_event_pointer_get_dx(pointer_event)); - dy = wl_fixed_from_double(libinput_event_pointer_get_dy(pointer_event)); notify_motion(device->seat, libinput_event_pointer_get_time(pointer_event), - dx, - dy); + &event); } static void |