Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2019 16:43:42 +0000 (UTC)
From:      Philip Paeps <philip@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349766 - stable/12/sys/dev/atkbdc
Message-ID:  <201907051643.x65Ghgxs091746@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: philip
Date: Fri Jul  5 16:43:41 2019
New Revision: 349766
URL: https://svnweb.freebsd.org/changeset/base/349766

Log:
  MFC r349098:
    Add macOS-like three finger drag trackpad gesture to psm(4)

Modified:
  stable/12/sys/dev/atkbdc/psm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/atkbdc/psm.c
==============================================================================
--- stable/12/sys/dev/atkbdc/psm.c	Fri Jul  5 12:35:49 2019	(r349765)
+++ stable/12/sys/dev/atkbdc/psm.c	Fri Jul  5 16:43:41 2019	(r349766)
@@ -235,6 +235,7 @@ typedef struct synapticsinfo {
 	int			 softbutton3_x;
 	int			 max_x;
 	int			 max_y;
+	int			 three_finger_drag;
 	int			 natural_scroll;
 } synapticsinfo_t;
 
@@ -571,6 +572,7 @@ enum {
 	SYNAPTICS_SYSCTL_SOFTBUTTONS_Y =	SYN_OFFSET(softbuttons_y),
 	SYNAPTICS_SYSCTL_SOFTBUTTON2_X =	SYN_OFFSET(softbutton2_x),
 	SYNAPTICS_SYSCTL_SOFTBUTTON3_X =	SYN_OFFSET(softbutton3_x),
+	SYNAPTICS_SYSCTL_THREE_FINGER_DRAG = 	SYN_OFFSET(three_finger_drag),
 	SYNAPTICS_SYSCTL_NATURAL_SCROLL =	SYN_OFFSET(natural_scroll),
 #define	SYNAPTICS_SYSCTL_LAST	SYNAPTICS_SYSCTL_NATURAL_SCROLL
 };
@@ -3784,6 +3786,7 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, i
 		int vscroll_hor_area, vscroll_ver_area;
 		int two_finger_scroll;
 		int max_x, max_y;
+		int three_finger_drag;
 
 		/* Read sysctl. */
 		/* XXX Verify values? */
@@ -3798,7 +3801,7 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, i
 		two_finger_scroll = sc->syninfo.two_finger_scroll;
 		max_x = sc->syninfo.max_x;
 		max_y = sc->syninfo.max_y;
-
+		three_finger_drag = sc->syninfo.three_finger_drag;
 		/* Read current absolute position. */
 		x0 = f->x;
 		y0 = f->y;
@@ -3887,8 +3890,8 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, i
 				    ~MOUSE_BUTTON1DOWN) | center_button;
 		}
 
-		/* If in tap-hold, add the recorded button. */
-		if (gest->in_taphold)
+		/* If in tap-hold or three fingers, add the recorded button. */
+		if (gest->in_taphold || (nfingers == 3 && three_finger_drag))
 			ms->button |= gest->tap_button;
 
 		/*
@@ -5754,6 +5757,7 @@ synaptics_sysctl(SYSCTL_HANDLER_ARGS)
 			return (EINVAL);
 		break;
         case SYNAPTICS_SYSCTL_TOUCHPAD_OFF:
+	case SYNAPTICS_SYSCTL_THREE_FINGER_DRAG:
 	case SYNAPTICS_SYSCTL_NATURAL_SCROLL:
 		if (arg < 0 || arg > 1)
 			return (EINVAL);
@@ -6146,6 +6150,14 @@ synaptics_sysctl_create_tree(struct psm_softc *sc, con
 	    sc, SYNAPTICS_SYSCTL_TOUCHPAD_OFF,
 	    synaptics_sysctl, "I",
 	    "Turn off touchpad");
+
+	sc->syninfo.three_finger_drag = 0;
+	SYSCTL_ADD_PROC(&sc->syninfo.sysctl_ctx,
+	    SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
+	    "three_finger_drag", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
+	    sc, SYNAPTICS_SYSCTL_THREE_FINGER_DRAG,
+	    synaptics_sysctl, "I",
+	    "Enable dragging with three fingers");
 
 	/* hw.psm.synaptics.natural_scroll. */
 	sc->syninfo.natural_scroll = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907051643.x65Ghgxs091746>