mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 20:30:27 +01:00
touchpad: on non-resolution touchpads, use 30% as maximum clickfinger spread
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
df83144457
commit
8af1f4b085
2 changed files with 24 additions and 13 deletions
|
|
@ -789,27 +789,38 @@ tp_check_clickfinger_distance(struct tp_dispatch *tp,
|
|||
struct tp_touch *t1,
|
||||
struct tp_touch *t2)
|
||||
{
|
||||
int res_x, res_y;
|
||||
double x, y;
|
||||
|
||||
if (!t1 || !t2)
|
||||
return 0;
|
||||
|
||||
x = abs(t1->point.x - t2->point.x);
|
||||
y = abs(t1->point.y - t2->point.y);
|
||||
|
||||
/* no resolution, so let's assume they're close enough together */
|
||||
if (tp->device->abs.fake_resolution)
|
||||
return 1;
|
||||
if (tp->device->abs.fake_resolution) {
|
||||
int w, h;
|
||||
|
||||
res_x = tp->device->abs.absinfo_x->resolution;
|
||||
res_y = tp->device->abs.absinfo_y->resolution;
|
||||
/* Use a maximum of 30% of the touchpad width or height if
|
||||
* we dont' have resolution. */
|
||||
w = tp->device->abs.absinfo_x->maximum -
|
||||
tp->device->abs.absinfo_x->minimum;
|
||||
h = tp->device->abs.absinfo_y->maximum -
|
||||
tp->device->abs.absinfo_y->minimum;
|
||||
|
||||
x = abs(t1->point.x - t2->point.x)/res_x;
|
||||
y = abs(t1->point.y - t2->point.y)/res_y;
|
||||
return (x < w * 0.3 && y < h * 0.3) ? 1 : 0;
|
||||
} else {
|
||||
/* maximum spread is 40mm horiz, 20mm vert. Anything wider than that
|
||||
* is probably a gesture. The y spread is small so we ignore clicks
|
||||
* with thumbs at the bottom of the touchpad while the pointer
|
||||
* moving finger is still on the pad */
|
||||
|
||||
x /= tp->device->abs.absinfo_x->resolution;
|
||||
y /= tp->device->abs.absinfo_y->resolution;
|
||||
|
||||
return (x < 40 && y < 20) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* maximum spread is 40mm horiz, 20mm vert. Anything wider than that
|
||||
* is probably a gesture. The y spread is small so we ignore clicks
|
||||
* with thumbs at the bottom of the touchpad while the pointer
|
||||
* moving finger is still on the pad */
|
||||
return (x < 40 && y < 20) ? 1 : 0;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
|
|
|||
|
|
@ -5129,7 +5129,7 @@ litest_setup_tests(void)
|
|||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
|
||||
litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_clickfinger_to_area_method, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger",
|
||||
touchpad_clickfinger_to_area_method_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue