git: 8aef1cd698f1 - main - wsp: Use already-calculated distance of fingers for comparison.

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 06 Sep 2024 18:35:23 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8aef1cd698f177986ee4f51ff6f63ea7b0b35098

commit 8aef1cd698f177986ee4f51ff6f63ea7b0b35098
Author:     Joshua Rogers <Joshua@Joshua.Hu>
AuthorDate: 2024-06-10 19:03:24 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-09-06 18:34:31 +0000

    wsp: Use already-calculated distance of fingers for comparison.
    
    Also correctly use tun.max_double_tap_distance for maximum distance
    of fingers for vertical scrolling.
    
    Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
    Reviewed by: imp, wulf
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
---
 sys/dev/usb/input/wsp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c
index 708a26498361..a8d6c14c7421 100644
--- a/sys/dev/usb/input/wsp.c
+++ b/sys/dev/usb/input/wsp.c
@@ -1263,9 +1263,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error)
 				dx = dy = 0;
 				if (sc->dz_count == 0)
 					dz = (sc->dz_sum / tun.z_factor) * (tun.z_invert ? -1 : 1);
-				if (sc->scr_mode == WSP_SCR_HOR || 
-				    abs(sc->pos_x[0] - sc->pos_x[1]) > tun.max_finger_area ||
-				    abs(sc->pos_y[0] - sc->pos_y[1]) > tun.max_finger_area)
+				if (sc->scr_mode == WSP_SCR_HOR || sc->distance > tun.max_double_tap_distance)
 					dz = 0;
 			}
 			if (ntouch == 3)