From 5d23794d53610f5e8b0ef99c8b0e8ee7d7b192c8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 9 Jun 2025 10:00:50 +1000 Subject: [PATCH] tablet: disable smoothing for uinput devices When a tablet was created via uinput we trust that the tablet's events are preprocessed to the point where we no longer need to apply smoothing to the axes. Closes #1120 Part-of: --- src/evdev-tablet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 248023de..aebd17d4 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -2838,7 +2838,8 @@ tablet_is_aes(struct evdev_device *device, WacomDevice *wacom) static void tablet_init_smoothing(struct evdev_device *device, struct tablet_dispatch *tablet, - bool is_aes) + bool is_aes, + bool is_virtual) { size_t history_size = ARRAY_LENGTH(tablet->history.samples); struct quirks_context *quirks = NULL; @@ -2848,11 +2849,11 @@ tablet_init_smoothing(struct evdev_device *device, quirks = evdev_libinput_context(device)->quirks; q = quirks_fetch_for_device(quirks, device->udev_device); - /* By default, always enable smoothing except on AES devices. + /* By default, always enable smoothing except on AES or uinput devices. * AttrTabletSmoothing can override this, if necessary. */ if (!q || !quirks_get_bool(q, QUIRK_ATTR_TABLET_SMOOTHING, &use_smoothing)) - use_smoothing = !is_aes; + use_smoothing = !is_aes && !is_virtual; /* Setting the history size to 1 means we never do any actual smoothing. */ if (!use_smoothing) @@ -2986,6 +2987,7 @@ tablet_init(struct tablet_dispatch *tablet, goto out; bool is_aes = tablet_is_aes(device, wacom); + bool is_virtual = evdev_device_is_virtual(device); bool is_display_tablet = tablet_is_display_tablet(wacom); if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN)) { @@ -3010,7 +3012,7 @@ tablet_init(struct tablet_dispatch *tablet, evdev_init_sendevents(device, &tablet->base); tablet_init_left_handed(device, wacom); - tablet_init_smoothing(device, tablet, is_aes); + tablet_init_smoothing(device, tablet, is_aes, is_virtual); for (axis = LIBINPUT_TABLET_TOOL_AXIS_X; axis <= LIBINPUT_TABLET_TOOL_AXIS_MAX;