diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index e5f2a5ce..db56b6f2 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -553,8 +553,12 @@ tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t) if (t->state != TOUCH_BEGIN) return false; + if (t->pressure < 150) + return false; + if (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) return false; evdev_log_debug(tp->device, "palm: palm-tap detected\n"); @@ -656,7 +660,9 @@ tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp, int dirs; if (time < t->palm.time + PALM_TIMEOUT && - (t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) { + (t->point.x > tp->palm.left_edge && + t->point.x < tp->palm.right_edge && + t->point.y > tp->palm.upper_edge)) { delta = device_delta(t->point, t->palm.first); dirs = phys_get_direction(tp_phys_delta(tp, delta)); if ((dirs & DIRECTIONS) && !(dirs & ~DIRECTIONS)) @@ -723,7 +729,8 @@ tp_palm_detect_edge(struct tp_dispatch *tp, /* palm must start in exclusion zone, it's ok to move into the zone without being a palm */ if (t->state != TOUCH_BEGIN || - (t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) + (t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge && + t->point.y > tp->palm.upper_edge)) return false; /* don't detect palm in software button areas, it's @@ -2304,6 +2311,10 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp, mm.x = width * 0.95; edges = evdev_device_mm_to_units(device, &mm); tp->palm.right_edge = edges.x; + + mm.y = height * 0.25; + edges = evdev_device_mm_to_units(device, &mm); + tp->palm.upper_edge = edges.y; } static void @@ -2313,6 +2324,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 ef0171d4..32a827d7 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -334,6 +334,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;