backend, virtual_keyboard: set the time_nsec field of relevant events

Backends modified: libinput (with microsecond precision), X11 (with
millisecond precision), RDP (with millisecond precision), and Wayland
(with nanosecond precision if the host server supports the
input-timestamps protocol, otherwise millisecond precision); and
virtual-keyboard protocol (with millisecond precision).
This commit is contained in:
random human 2019-06-14 22:24:03 +00:00
parent 79ed410be4
commit e617da0378
No known key found for this signature in database
GPG key ID: 73E5A60444CC77A3
9 changed files with 172 additions and 38 deletions

View file

@ -20,6 +20,7 @@ static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
enum wlr_key_state st, xcb_timestamp_t time) {
struct wlr_event_keyboard_key ev = {
.time_msec = time,
.time_nsec = time * 1000000,
.keycode = key,
.state = st,
.update_state = true,
@ -32,6 +33,7 @@ static void send_button_event(struct wlr_x11_output *output, uint32_t key,
struct wlr_event_pointer_button ev = {
.device = &output->pointer_dev,
.time_msec = time,
.time_nsec = time * 1000000,
.button = key,
.state = st,
};
@ -44,6 +46,7 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta,
struct wlr_event_pointer_axis ev = {
.device = &output->pointer_dev,
.time_msec = time,
.time_nsec = time * 1000000,
.source = WLR_AXIS_SOURCE_WHEEL,
.orientation = WLR_AXIS_ORIENTATION_VERTICAL,
// 15 is a typical value libinput sends for one scroll
@ -59,6 +62,7 @@ static void send_pointer_position_event(struct wlr_x11_output *output,
struct wlr_event_pointer_motion_absolute ev = {
.device = &output->pointer_dev,
.time_msec = time,
.time_nsec = time * 1000000,
.x = (double)x / output->wlr_output.width,
.y = (double)y / output->wlr_output.height,
};