Module Name:    src
Committed By:   nia
Date:           Sat Mar 14 21:56:08 UTC 2020

Modified Files:
        src/sys/dev/pckbport: synaptics.c

Log Message:
synaptics: Automatically scroll when multiple fingers are detected

This will mean we automatically get two-finger scrolling on multitouch
pads.

This works, but the scrolling is janky. Why does it eventually move the
mouse cursor (only one finger detected, but two are still there), and why
does it jump up slightly?


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pckbport/synaptics.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.58 src/sys/dev/pckbport/synaptics.c:1.59
--- src/sys/dev/pckbport/synaptics.c:1.58	Sat Mar 14 21:23:32 2020
+++ src/sys/dev/pckbport/synaptics.c	Sat Mar 14 21:56:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.58 2020/03/14 21:23:32 nia Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.59 2020/03/14 21:56:08 nia Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.58 2020/03/14 21:23:32 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.59 2020/03/14 21:56:08 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,7 +118,7 @@ static int synaptics_scale_y = 16;
 static int synaptics_scale_z = 32;
 static int synaptics_max_speed_x = 32;
 static int synaptics_max_speed_y = 32;
-static int synaptics_max_speed_z = 2;
+static int synaptics_max_speed_z = 1;
 static int synaptics_movement_threshold = 4;
 static int synaptics_fscroll_min = 13;
 static int synaptics_fscroll_max = 14;
@@ -1745,6 +1745,14 @@ pms_synaptics_process_packet(struct pms_
 
 			synaptics_movement(sc, sp, sp->sp_finger,
 				z_emul, &dx, &dy, &dz);
+		} else if (fingers > 1) {
+			/*
+			 * Multiple finger movement. Interpret it as scrolling.
+			 */
+			synaptics_movement(sc, sp, sp->sp_finger, 1,
+				&dx, &dy, &dz);
+			sc->rem_x[0] = sc->rem_y[0] = 0;
+			dx = dy = 0;
 		} else {
 			/*
 			 * No valid finger. Therefore no movement.

Reply via email to