From f4e62a0b0c1389486c949247f2c15655f7124d05 Mon Sep 17 00:00:00 2001 From: Ming-Yang Lu Date: Sun, 2 Jul 2017 18:15:17 +0800 Subject: [PATCH libinput 2/2] touchpad: add upper edge into exclusion zone This reduce unexpected cursor moves when placing thumb finger near border of trackpoint buttons and upper edge of touchpad. https://bugs.freedesktop.org/show_bug.cgi?id=101574 --- src/evdev-mt-touchpad.c | 10 ++++++++-- src/evdev-mt-touchpad.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 47c39b3d..fa3d8a32 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -554,7 +554,8 @@ static inline bool tp_palm_in_edge(const struct tp_dispatch *tp, const struct tp_touch *t) { return t->point.x > tp->palm.left_edge && - t->point.x < tp->palm.right_edge; + t->point.x < tp->palm.right_edge && + t->point.y > tp->palm.upper_edge; } bool @@ -660,7 +661,7 @@ tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp, uint64_t time) { const int PALM_TIMEOUT = ms2us(200); - const int DIRECTIONS = NE|E|SE|SW|W|NW; + const int DIRECTIONS = NE|E|SE|SW|W|NW|S; struct device_float_coords delta; int dirs; @@ -2324,6 +2325,10 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp, mm.x = width * 0.92; edges = evdev_device_mm_to_units(device, &mm); tp->palm.right_edge = edges.x; + + mm.y = width * 0.05; + edges = evdev_device_mm_to_units(device, &mm); + tp->palm.upper_edge = edges.y; } static int @@ -2369,6 +2374,7 @@ tp_init_palmdetect(struct tp_dispatch *tp, tp->palm.right_edge = INT_MAX; tp->palm.left_edge = INT_MIN; + tp->palm.upper_edge = INT_MIN; if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD && !tp_is_tpkb_combo_below(device)) diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 6d014607..d601f7e5 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -335,6 +335,7 @@ struct tp_dispatch { struct { int32_t right_edge; /* in device coordinates */ int32_t left_edge; /* in device coordinates */ + int32_t upper_edge; /* in device coordinates */ bool trackpoint_active; struct libinput_event_listener trackpoint_listener; -- 2.13.2