From 79ed410be41b20240f63240b80213791923be73b Mon Sep 17 00:00:00 2001 From: random human Date: Fri, 14 Jun 2019 21:30:40 +0000 Subject: [PATCH] keyboard, pointer, touch: add time_nsec field to relevant events The time_nsec field stores the complete event time in nanoseconds. Note that the type is just 64 bits wide, which is too short to store the complete range of values required by the protocol. However, it is enough for libinput, which is our primary event provider. --- include/wlr/types/wlr_keyboard.h | 1 + include/wlr/types/wlr_pointer.h | 4 ++++ include/wlr/types/wlr_touch.h | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index ae2795418..b8810b0e8 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -96,6 +96,7 @@ enum wlr_key_state { struct wlr_event_keyboard_key { uint32_t time_msec; + uint64_t time_nsec; uint32_t keycode; bool update_state; // if backend doesn't update modifiers on its own enum wlr_key_state state; diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 486e1bc9a..2e7565479 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -38,6 +38,7 @@ struct wlr_pointer { struct wlr_event_pointer_motion { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; double delta_x, delta_y; double unaccel_dx, unaccel_dy; }; @@ -45,6 +46,7 @@ struct wlr_event_pointer_motion { struct wlr_event_pointer_motion_absolute { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; // From 0..1 double x, y; }; @@ -52,6 +54,7 @@ struct wlr_event_pointer_motion_absolute { struct wlr_event_pointer_button { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; uint32_t button; enum wlr_button_state state; }; @@ -71,6 +74,7 @@ enum wlr_axis_orientation { struct wlr_event_pointer_axis { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; enum wlr_axis_source source; enum wlr_axis_orientation orientation; double delta; diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 99316ae03..f3173d4da 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -30,6 +30,7 @@ struct wlr_touch { struct wlr_event_touch_down { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; int32_t touch_id; // From 0..1 double x, y; @@ -38,12 +39,14 @@ struct wlr_event_touch_down { struct wlr_event_touch_up { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; int32_t touch_id; }; struct wlr_event_touch_motion { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; int32_t touch_id; // From 0..1 double x, y; @@ -52,6 +55,7 @@ struct wlr_event_touch_motion { struct wlr_event_touch_cancel { struct wlr_input_device *device; uint32_t time_msec; + uint64_t time_nsec; int32_t touch_id; };