summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbru <bru@openbsd.org>2021-03-24 07:40:37 +0000
committerbru <bru@openbsd.org>2021-03-24 07:40:37 +0000
commit55f93ff42336bca6334eea71f9de878a3da64c06 (patch)
tree815c9d281cf5293b5611122dac61b2b1fc58d42e
parentDefine a USB quirk for devices that need to keep their pipes open at (diff)
downloadwireguard-openbsd-55f93ff42336bca6334eea71f9de878a3da64c06.tar.xz
wireguard-openbsd-55f93ff42336bca6334eea71f9de878a3da64c06.zip
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.
-rw-r--r--sys/dev/wscons/wstpad.c12
1 files changed, 3 insertions, 9 deletions
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);