mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 14:40:26 +01:00
touchpad: scale thumb pressure threshold with the resolution
On touchpads with a higher resolution we also see higher pressure values. Scale accordingly, but use the T440s as reference and don't go below that device's threshold. A false positive is worse than a false negative when it comes to thumb detection. https://bugs.freedesktop.org/show_bug.cgi?id=91362 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
7a6026104b
commit
7e9ef68dd6
2 changed files with 20 additions and 13 deletions
|
|
@ -1534,6 +1534,8 @@ 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;
|
||||
int xres, yres;
|
||||
double threshold;
|
||||
|
||||
if (!tp->buttons.is_clickpad)
|
||||
return 0;
|
||||
|
|
@ -1552,12 +1554,17 @@ tp_init_thumb(struct tp_dispatch *tp)
|
|||
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.
|
||||
/* Our reference touchpad is the T440s with 42x42 resolution.
|
||||
* Higher-res touchpads exhibit higher pressure for the same
|
||||
* interaction. On the T440s, the threshold value is 100, you don't
|
||||
* reach that with a normal finger interaction.
|
||||
* Note: "thumb" means massive touch that should not interact, not
|
||||
* "using the tip of my thumb for a pinch gestures".
|
||||
*/
|
||||
tp->thumb.threshold = 100;
|
||||
xres = tp->device->abs.absinfo_x->resolution;
|
||||
yres = tp->device->abs.absinfo_y->resolution;
|
||||
threshold = 100.0 * hypot(xres, yres)/hypot(42, 42);
|
||||
tp->thumb.threshold = max(100, threshold);
|
||||
tp->thumb.detect_thumbs = true;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -4017,7 +4017,7 @@ START_TEST(touchpad_thumb_begin_no_motion)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4041,7 +4041,7 @@ START_TEST(touchpad_thumb_update_no_motion)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4071,7 +4071,7 @@ START_TEST(touchpad_thumb_clickfinger)
|
|||
struct libinput_event *event;
|
||||
struct libinput_event_pointer *ptrev;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4128,7 +4128,7 @@ START_TEST(touchpad_thumb_btnarea)
|
|||
struct libinput_event *event;
|
||||
struct libinput_event_pointer *ptrev;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4164,7 +4164,7 @@ START_TEST(touchpad_thumb_edgescroll)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4195,7 +4195,7 @@ START_TEST(touchpad_thumb_tap_begin)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4225,7 +4225,7 @@ START_TEST(touchpad_thumb_tap_touch)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4255,7 +4255,7 @@ START_TEST(touchpad_thumb_tap_hold)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4286,7 +4286,7 @@ START_TEST(touchpad_thumb_tap_hold_2ndfg)
|
|||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -4333,7 +4333,7 @@ START_TEST(touchpad_thumb_tap_hold_2ndfg_tap)
|
|||
struct libinput_event *event;
|
||||
struct libinput_event_pointer *ptrev;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_MT_PRESSURE, 100 },
|
||||
{ ABS_MT_PRESSURE, 190 },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue