diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2018-03-13 09:33:57 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2018-04-09 11:23:38 +1000 |
commit | f36bb869eebc864e2f14095fe859cba07fe54e2b (patch) | |
tree | c0388a5ab0636eed00d7e4816f98ac2ab6e8729c | |
parent | 75215aaf5e5467a1cfbc198e219a8edd544ba71a (diff) |
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>
(cherry picked from commit d786b55daa99c6f891da05ec91617eccdc843333)
-rw-r--r-- | src/evdev-mt-touchpad.c | 2 | ||||
-rw-r--r-- | test/test-touchpad.c | 26 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index c803b1dc..d6e1e4f9 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -2786,7 +2786,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); diff --git a/test/test-touchpad.c b/test/test-touchpad.c index 427fc13c..4759bfb6 100644 --- a/test/test-touchpad.c +++ b/test/test-touchpad.c @@ -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); |