From de1ed2e73bf4afe9908fe45dd5eaf109a8be57f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 29 Jul 2015 14:18:02 +0800 Subject: [PATCH] input: Provide microsecond timestamps in motion events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide timestamps with microsecond granularity if the backend can provide it. Backends that can't should set it to 0. Signed-off-by: Jonas Ã…dahl Reviewed-by: Peter Hutterer --- libweston/compositor.h | 1 + libweston/libinput-device.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libweston/compositor.h b/libweston/compositor.h index 29cc8dfd..45af3e66 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -248,6 +248,7 @@ enum weston_pointer_motion_mask { struct weston_pointer_motion_event { uint32_t mask; + uint64_t time_usec; double x; double y; double dx; diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c index cfd76599..782f6569 100644 --- a/libweston/libinput-device.c +++ b/libweston/libinput-device.c @@ -86,6 +86,8 @@ handle_pointer_motion(struct libinput_device *libinput_device, struct evdev_device *device = libinput_device_get_user_data(libinput_device); struct weston_pointer_motion_event event = { 0 }; + uint64_t time_usec = + libinput_event_pointer_get_time_usec(pointer_event); double dx_unaccel, dy_unaccel; dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event); @@ -94,6 +96,7 @@ handle_pointer_motion(struct libinput_device *libinput_device, event = (struct weston_pointer_motion_event) { .mask = WESTON_POINTER_MOTION_REL | WESTON_POINTER_MOTION_REL_UNACCEL, + .time_usec = time_usec, .dx = libinput_event_pointer_get_dx(pointer_event), .dy = libinput_event_pointer_get_dy(pointer_event), .dx_unaccel = dx_unaccel,