diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 35d0d853..19669fef 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -1497,6 +1497,7 @@ tp_init_thumb(struct tp_dispatch *tp) { struct evdev_device *device = tp->device; const struct input_absinfo *abs; + double w = 0.0, h = 0.0; abs = libevdev_get_abs_info(device->evdev, ABS_MT_PRESSURE); if (!abs) @@ -1505,6 +1506,13 @@ tp_init_thumb(struct tp_dispatch *tp) if (abs->maximum - abs->minimum < 255) return 0; + /* if the touchpad is less than 50mm high, skip thumb detection. + * it's too small to meaningfully interact with a thumb on the + * touchpad */ + evdev_device_get_size(device, &w, &h); + if (h < 50) + return 0; + /* The touchpads we looked at so far have a clear thumb threshold of * ~100, you don't reach that with a normal finger interaction. * Note: "thumb" means massive touch that should not interact, not diff --git a/test/touchpad.c b/test/touchpad.c index 64bdd440..eb083c9d 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -3904,7 +3904,15 @@ END_TEST static int has_thumb_detect(struct litest_device *dev) { - return libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE); + double w, h; + + if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) + return 0; + + if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) + return 0; + + return h >= 50.0; } START_TEST(touchpad_thumb_begin_no_motion)