From e92f2975798c6372856b5eeab959777e63c29f44 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 19 Dec 2017 14:54:53 +1000 Subject: [PATCH libinput] touchpad: ignore palm touches when handling clickfingers https://bugs.freedesktop.org/show_bug.cgi?id=104188 Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-buttons.c | 18 +++++++++--------- test/test-touchpad-buttons.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index a0ecefd2..88530a61 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -998,16 +998,11 @@ static uint32_t tp_clickfinger_set_button(struct tp_dispatch *tp) { uint32_t button; - unsigned int nfingers = tp->nfingers_down; + unsigned int nfingers = 0; struct tp_touch *t; struct tp_touch *first = NULL, *second = NULL; - if (nfingers != 2) - goto out; - - /* two fingers down on the touchpad. Check for distance - * between the fingers. */ tp_for_each_touch(tp, t) { if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE) continue; @@ -1015,16 +1010,21 @@ tp_clickfinger_set_button(struct tp_dispatch *tp) if (t->thumb.state == THUMB_STATE_YES) continue; + if (t->palm.state != PALM_NONE) + continue; + + nfingers++; + if (!first) first = t; else if (!second) second = t; } - if (!first || !second) { - nfingers = 1; + /* Only check for finger distance when there are 2 fingers on the + * touchpad */ + if (nfingers != 2) goto out; - } if (tp_clickfinger_within_distance(tp, first, second)) nfingers = 2; diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c index 9f38e833..e551f31b 100644 --- a/test/test-touchpad-buttons.c +++ b/test/test-touchpad-buttons.c @@ -781,8 +781,8 @@ START_TEST(touchpad_clickfinger_3fg_tool_position) litest_drain_events(li); /* one in thumb area, one in normal area + TRIPLETAP. spread is wide - * but any 3fg touch+click counts as middle */ - litest_touch_down(dev, 0, 5, 99); + * but any non-palm 3fg touch+click counts as middle */ + litest_touch_down(dev, 0, 20, 99); litest_touch_down(dev, 1, 90, 15); litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); -- 2.13.6