From: bru Date: Wed, 24 Mar 2021 07:40:37 +0000 (+0000) Subject: Make tap detection less restrictive for multi-finger taps. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=55f93ff42336bca6334eea71f9de878a3da64c06;p=openbsd Make tap detection less restrictive for multi-finger taps. In order to distinguish tap gestures from short movements, the mechanism checks whether the distance between the first and the last position of a touch exceeds the 'maxdist' limit. Some touchpads provide unreliable coordinates when more than one contact is being made simultaneously, and in this case the filter may be too strong - and superfluous, because only one-finger contacts should trigger pointer movement. --- diff --git a/sys/dev/wscons/wstpad.c b/sys/dev/wscons/wstpad.c index ccd2b4ba4b2..65cd6b73f7f 100644 --- a/sys/dev/wscons/wstpad.c +++ b/sys/dev/wscons/wstpad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wstpad.c,v 1.28 2021/03/21 16:20:49 bru Exp $ */ +/* $OpenBSD: wstpad.c,v 1.29 2021/03/24 07:40:37 bru Exp $ */ /* * Copyright (c) 2015, 2016 Ulf Brosziewski @@ -657,14 +657,8 @@ wstpad_is_tap(struct wstpad *tp, struct tpad_touch *t) struct timespec ts; int dx, dy, dist = 0; - /* - * No distance limit applies if there has been more than one contact - * on a single-touch device. We cannot use (t->x - t->orig.x) in this - * case. Accumulated deltas might be an alternative, but some - * touchpads provide unreliable coordinates at the start or end of a - * multi-finger touch. - */ - if (IS_MT(tp) || tp->tap.contacts < 2) { + /* Try to distinguish one-finger taps from short movements. */ + if (tp->tap.contacts == (tp->ignore ? 2 : 1)) { dx = abs(t->x - t->orig.x) << 12; dy = abs(t->y - t->orig.y) * tp->ratio; dist = (dx >= dy ? dx + 3 * dy / 8 : dy + 3 * dx / 8);