From 8bb6935374769ba8dff0713761b914101579cb91 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Thu, 7 Nov 2024 10:09:36 +0100 Subject: [PATCH] tablet-v2: Event time should be milliseconds The event time used for zwp_tablet_pad_group_v2_send_mode_switch was tv_nsec / 1000, which is microseconds resetting every whole second. Use get_current_time_msec to get milliseconds including whole seconds. --- types/tablet_v2/wlr_tablet_v2_pad.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index 052a017d8..2e0439a36 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -7,6 +7,7 @@ #include #include #include +#include "util/time.h" #include "tablet-v2-protocol.h" static const struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface; @@ -457,10 +458,7 @@ uint32_t wlr_send_tablet_v2_tablet_pad_enter( zwp_tablet_pad_v2_send_enter(pad_client->resource, serial, tablet_client->resource, surface->resource); - struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - uint32_t time = now.tv_nsec / 1000; - + uint32_t time = get_current_time_msec(); for (size_t i = 0; i < pad->group_count; ++i) { if (pad_client->groups[i]) { zwp_tablet_pad_group_v2_send_mode_switch(