From ec623bc35bcf8f170e30b72903cd7b6edbcf0dd7 Mon Sep 17 00:00:00 2001 From: kikadf Date: Fri, 30 Jan 2026 11:05:59 +0100 Subject: [PATCH] Handle auto-repeat per device instead of globally --- src/wscons.c | 10 +++++----- src/wscons.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wscons.c b/src/wscons.c index 2120f073..6f984cc9 100644 --- a/src/wscons.c +++ b/src/wscons.c @@ -45,8 +45,6 @@ static void wscons_device_init_pointer_acceleration(struct wscons_device *device, struct motion_filter *filter); -static int old_value = -1; - static int udev_input_enable(struct libinput *libinput) { @@ -128,13 +126,13 @@ wscons_process(struct libinput_device *device, struct wscons_event *wsevent) key = wsevent->value; if (wsevent->type == WSCONS_EVENT_KEY_UP) { kstate = LIBINPUT_KEY_STATE_RELEASED; - old_value = -1; + dev->old_value = -1; } else { kstate = LIBINPUT_KEY_STATE_PRESSED; /* ignore auto-repeat */ - if (key == old_value) + if (key == dev->old_value) return; - old_value = key; + dev->old_value = key; } keyboard_notify_key(device, time, wskey_transcode(wscons_device(device)->scanCodeMap, key), kstate); @@ -517,6 +515,8 @@ wscons_device_init(struct wscons_device *wscons_device) { struct libinput_device *device = &wscons_device->base; + wscons_device->old_value = -1; + if (strncmp(device->devname, "/dev/wsmouse", 12) == 0) { /* XXX handle tablets and touchpanel */ wscons_device->capability = LIBINPUT_DEVICE_CAP_POINTER; diff --git a/src/wscons.h b/src/wscons.h index 636e7487..2124eb21 100644 --- a/src/wscons.h +++ b/src/wscons.h @@ -18,6 +18,7 @@ struct wscons_device { struct libinput_device base; enum libinput_device_capability capability; struct TransMapRec *scanCodeMap; + int old_value; struct { struct libinput_device_config_accel config; struct motion_filter *filter;