From 3ef22c8ed0362b4054bdcdae18389b6f43ea7e70 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 29 May 2023 18:08:01 +1000 Subject: [PATCH] Log a bug if a client tries to send a discrete value 1 Discrete values are multiples of 120 and it's unlikely the device to be emulated is *that* precise, so let's assume it's a bug and the client wasn't aware of the 120-multiple requirement. --- src/libei-device.c | 5 +++++ src/libeis-device.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/libei-device.c b/src/libei-device.c index 9c3f777..b8ca54e 100644 --- a/src/libei-device.c +++ b/src/libei-device.c @@ -1482,6 +1482,11 @@ ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y) return; } + if (abs(x) == 1 || abs(y) == 1) { + log_bug_client(ei_device_get_context(device), + "%s: suspicious discrete event value 1, did you mean 120?", __func__); + } + ei_device_resume_scrolling(device, x, y); ei_send_pointer_scroll_discrete(device, x, y); diff --git a/src/libeis-device.c b/src/libeis-device.c index 03e35bc..6302b58 100644 --- a/src/libeis-device.c +++ b/src/libeis-device.c @@ -1158,6 +1158,11 @@ eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y) if (device->state != EIS_DEVICE_STATE_EMULATING) return; + if (abs(x) == 1 || abs(y) == 1) { + log_bug_client(eis_device_get_context(device), + "%s: suspicious discrete event value 1, did you mean 120?", __func__); + } + eis_device_resume_scrolling(device, x, y); device->send_frame_event = true;