Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 May 2017 23:02:34 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317814 - head/sys/dev/atkbdc
Message-ID:  <201705042302.v44N2Y06014015@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf
Date: Thu May  4 23:02:34 2017
New Revision: 317814
URL: https://svnweb.freebsd.org/changeset/base/317814

Log:
  psm(4): reduce cursor jumping on palm detection
  
  This is done with discarding pointer movements rather then mouse packets
  
  Reviewed by:	gonzo
  Approved by:	gonzo (mentor)
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D10266

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Thu May  4 22:53:45 2017	(r317813)
+++ head/sys/dev/atkbdc/psm.c	Thu May  4 23:02:34 2017	(r317814)
@@ -3017,13 +3017,15 @@ proc_synaptics(struct psm_softc *sc, pac
 
 	ms->button = touchpad_buttons;
 
+	psmgestures(sc, &f[0], nfingers, ms);
+	for (id = 0; id < PSM_FINGERS; id++)
+		psmsmoother(sc, &f[id], id, ms, x, y);
+
 	/* Palm detection doesn't terminate the current action. */
-	if (!psmpalmdetect(sc, &f[0], nfingers)) {
-		psmgestures(sc, &f[0], nfingers, ms);
-		for (id = 0; id < PSM_FINGERS; id++)
-			psmsmoother(sc, &f[id], id, ms, x, y);
-	} else {
-		VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f[0].w));
+	if (psmpalmdetect(sc, &f[0], nfingers)) {
+		*x = *y = *z = 0;
+		ms->button = ms->obutton;
+		return (0);
 	}
 
 	ms->button |= extended_buttons | guest_buttons;
@@ -3077,6 +3079,7 @@ psmpalmdetect(struct psm_softc *sc, fing
 		 *    [min_pressure; max_pressure]
 		 *  - pen aren't supported but PSM_FINGER_IS_PEN is set
 		 */
+		VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f->w));
 		return (1);
 	}
 	return (0);
@@ -4035,20 +4038,14 @@ proc_elantech(struct psm_softc *sc, pack
 
 	ms->button = touchpad_button | trackpoint_button;
 
-	/* Palm detection doesn't terminate the current action. */
-	if (!psmpalmdetect(sc, &f[0], nfingers)) {
-		/* Send finger 1 position to gesture processor */
-		if (PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) ||
-		    nfingers == 0)
-			psmgestures(sc, &f[0], imin(nfingers, 3), ms);
-		/* Send fingers positions to movement smoothers */
-		for (id = 0; id < PSM_FINGERS; id++)
-			if (PSM_FINGER_IS_SET(f[id]) || !(mask & (1 << id)))
-				psmsmoother(sc, &f[id], id, ms, x, y);
-	} else {
-		VLOG(2, (LOG_DEBUG, "elantech: palm detected! (%d)\n",
-		    f[0].w));
-	}
+	/* Send finger 1 position to gesture processor */
+	if (PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) ||
+	    nfingers == 0)
+		psmgestures(sc, &f[0], imin(nfingers, 3), ms);
+	/* Send fingers positions to movement smoothers */
+	for (id = 0; id < PSM_FINGERS; id++)
+		if (PSM_FINGER_IS_SET(f[id]) || !(mask & (1 << id)))
+			psmsmoother(sc, &f[id], id, ms, x, y);
 
 	/* Store current finger positions in action context */
 	for (id = 0; id < ELANTECH_MAX_FINGERS; id++) {
@@ -4059,6 +4056,13 @@ proc_elantech(struct psm_softc *sc, pack
 	}
 	sc->elanaction.mask = mask;
 
+	/* Palm detection doesn't terminate the current action. */
+	if (psmpalmdetect(sc, &f[0], nfingers)) {
+		*x = *y = *z = 0;
+		ms->button = ms->obutton;
+		return (0);
+	}
+
 	/* Use the extra buttons as a scrollwheel */
 	if (ms->button & MOUSE_BUTTON4DOWN)
 		*z = -1;



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