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=105434

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-03-13 09:33:57 +10:00
parent d8db6b5927
commit d786b55daa
2 changed files with 21 additions and 7 deletions

View file

@ -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);

View file

@ -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);