Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src Pull up following revision(s) (requested by nia in ticket...



details:   https://anonhg.NetBSD.org/src/rev/1748b9cb982e
branches:  netbsd-9
changeset: 940259:1748b9cb982e
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 08 16:47:12 2020 +0000

description:
Pull up following revision(s) (requested by nia in ticket #1100):

        sys/dev/pckbport/synaptics.c: revision 1.69
        sys/dev/pckbport/synaptics.c: revision 1.70
        share/man/man4/pms.4: revision 1.38

erect a signpost for weary travellers

synaptics: Emulate scrolling when the middle button is held with TrackPoints
idea stolen from various other operating systems.

this configurable with a sysctl in case somebody wants to hold the middle
button, e.g.  with old window managers that close menus when a button is
released.

diffstat:

 share/man/man4/pms.4         |   8 ++++++--
 sys/dev/pckbport/synaptics.c |  35 +++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diffs (120 lines):

diff -r 4812c17e5731 -r 1748b9cb982e share/man/man4/pms.4
--- a/share/man/man4/pms.4      Thu Oct 08 16:04:07 2020 +0000
+++ b/share/man/man4/pms.4      Thu Oct 08 16:47:12 2020 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pms.4,v 1.32.2.1 2020/03/30 18:45:16 martin Exp $
+.\" $NetBSD: pms.4,v 1.32.2.2 2020/10/08 16:47:12 martin Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
 .\"
-.Dd March 30, 2020
+.Dd October 1, 2020
 .Dt PMS 4
 .Os
 .Sh NAME
@@ -215,6 +215,10 @@
 as Z-axis events after the two finger scoll has finished.
 If the variable is set too low then there will be mouse movements observed
 during the two finger scroll.
+.It Dv hw.synaptics.aux_mid_button_scroll
+This causes Y-axis movement on the "passthrough device" (e.g. the TrackPoint
+on ThinkPads) to result in scrolling events instead of Y-axis movement when
+the middle button is held.
 .El
 .Pp
 The following
diff -r 4812c17e5731 -r 1748b9cb982e sys/dev/pckbport/synaptics.c
--- a/sys/dev/pckbport/synaptics.c      Thu Oct 08 16:04:07 2020 +0000
+++ b/sys/dev/pckbport/synaptics.c      Thu Oct 08 16:47:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: synaptics.c,v 1.50.2.6 2020/06/20 13:53:14 martin Exp $        */
+/*     $NetBSD: synaptics.c,v 1.50.2.7 2020/10/08 16:47:12 martin 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.50.2.6 2020/06/20 13:53:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.7 2020/10/08 16:47:12 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -124,6 +124,7 @@
 static int synaptics_fscroll_max = 14;
 static int synaptics_dz_hold = 30;
 static int synaptics_movement_enable = 1;
+static bool synaptics_aux_mid_button_scroll = TRUE;
 
 /* Sysctl nodes. */
 static int synaptics_button_boundary_nodenum;
@@ -152,6 +153,7 @@
 static int synaptics_finger_scroll_max_nodenum;
 static int synaptics_dz_hold_nodenum;
 static int synaptics_movement_enable_nodenum;
+static int synaptics_aux_mid_button_scroll_nodenum;
 
 static int
 synaptics_poll_cmd(struct pms_softc *psc, ...)
@@ -830,6 +832,18 @@
                goto err;
 
        synaptics_dz_hold_nodenum = node->sysctl_num;
+
+       if ((rc = sysctl_createv(clog, 0, NULL, &node,
+           CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+           CTLTYPE_BOOL, "aux_mid_button_scroll",
+           SYSCTL_DESCR("Interpet Y-Axis movement with the middle button held as scrolling on the passthrough device (e.g. TrackPoint)"),
+           pms_sysctl_synaptics_verify, 0,
+           &synaptics_aux_mid_button_scroll,
+           0, CTL_HW, root_num, CTL_CREATE,
+           CTL_EOL)) != 0)
+               goto err;
+
+       synaptics_aux_mid_button_scroll_nodenum = node->sysctl_num;
        return;
 
 err:
@@ -923,6 +937,10 @@
                if (t < 0 || t > 1)
                        return (EINVAL);
        } else
+       if (node.sysctl_num == synaptics_aux_mid_button_scroll_nodenum) {
+               if (t < 0 || t > 1)
+                       return (EINVAL);
+       } else
                return (EINVAL);
 
        *(int *)rnode->sysctl_data = t;
@@ -1140,6 +1158,10 @@
        pms_synaptics_process_packet(psc, &sp);
 }
 
+/*
+ * Passthrough is used for e.g. TrackPoints and additional pointing
+ * devices connected to a Synaptics touchpad.
+ */
 static void
 pms_synaptics_passthrough(struct pms_softc *psc)
 {
@@ -1169,6 +1191,15 @@
        psc->buttons ^= changed;
 
        if (dx || dy || dz || changed) {
+               /*
+                * If the middle button is held, interpret Y-axis
+                * movement as scrolling.
+                */
+               if (synaptics_aux_mid_button_scroll &&
+                   dy && (psc->buttons & 0x2)) {
+                       dz = -dy;
+                       dx = dy = 0;
+               }
                buttons = (psc->buttons & 0x1f) | ((psc->buttons >> 5) & 0x7);
                s = spltty();
                wsmouse_input(psc->sc_wsmousedev,



Home | Main Index | Thread Index | Old Index