mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-27 12:40:12 +01:00
touchpad: skip thumb detection for touchpads smaller than 50mm
Gets a bit cramped if you're trying to rest the thumb on a touchpad that small. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
bec07c4198
commit
c06a173e58
2 changed files with 17 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue