Commit d786b55d authored by Peter Hutterer's avatar Peter Hutterer

touchpad: don't enable top palm detection on touchpads <= 55mm high

Tiny enough as it is, let's not take usable space away.

https://bugs.freedesktop.org/show_bug.cgi?id=105434Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent d8db6b59
......@@ -2844,7 +2844,7 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp,
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.right_edge = edges.x;
if (!tp->buttons.has_topbuttons) {
if (!tp->buttons.has_topbuttons && height > 55) {
/* top edge is 5% of the height */
mm.y = height * 0.05;
edges = evdev_device_mm_to_units(device, &mm);
......
......@@ -953,7 +953,7 @@ START_TEST(touchpad_edge_scroll_into_area)
}
END_TEST
static int
static bool
touchpad_has_palm_detect_size(struct litest_device *dev)
{
double width, height;
......@@ -975,6 +975,20 @@ touchpad_has_palm_detect_size(struct litest_device *dev)
return rc == 0 && width >= 70;
}
static bool
touchpad_has_top_palm_detect_size(struct litest_device *dev)
{
double width, height;
int rc;
if (!touchpad_has_palm_detect_size(dev))
return false;
rc = libinput_device_get_size(dev->libinput_device, &width, &height);
return rc == 0 && height > 55;
}
START_TEST(touchpad_palm_detect_at_edge)
{
struct litest_device *dev = litest_current_device();
......@@ -1009,7 +1023,7 @@ START_TEST(touchpad_palm_detect_at_top)
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
if (!touchpad_has_palm_detect_size(dev))
if (!touchpad_has_top_palm_detect_size(dev))
return;
litest_disable_tap(dev->libinput_device);
......@@ -1131,7 +1145,7 @@ START_TEST(touchpad_palm_detect_top_palm_stays_palm)
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
if (!touchpad_has_palm_detect_size(dev))
if (!touchpad_has_top_palm_detect_size(dev))
return;
litest_disable_tap(dev->libinput_device);
......@@ -1178,7 +1192,7 @@ START_TEST(touchpad_palm_detect_top_palm_becomes_pointer)
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
if (!touchpad_has_palm_detect_size(dev))
if (!touchpad_has_top_palm_detect_size(dev))
return;
litest_disable_tap(dev->libinput_device);
......@@ -1231,7 +1245,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_top)
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
if (!touchpad_has_palm_detect_size(dev))
if (!touchpad_has_top_palm_detect_size(dev))
return;
litest_disable_tap(dev->libinput_device);
......@@ -1260,7 +1274,7 @@ START_TEST(touchpad_palm_detect_no_tap_top_edge)
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
if (!touchpad_has_palm_detect_size(dev))
if (!touchpad_has_top_palm_detect_size(dev))
return;
litest_enable_tap(dev->libinput_device);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment