mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-10 05:34:08 -04:00
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:
parent
79ed410be4
commit
e617da0378
9 changed files with 172 additions and 38 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue