Author: wulf
Date: Sat Apr 20 21:02:41 2019
New Revision: 346456
URL: https://svnweb.freebsd.org/changeset/base/346456

Log:
  psm(4): do not process gestures when palm is present
  
  Ignoring of gesture processing when the palm is detected helps to reduce
  some of the erratic pointer behavior.
  
  This fixes regression introduced in r317814
  
  Reported by:  Ben LeMasurier <b...@crypt.ly>
  MFC after:    2 weeks

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

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c   Sat Apr 20 21:00:44 2019        (r346455)
+++ head/sys/dev/atkbdc/psm.c   Sat Apr 20 21:02:41 2019        (r346456)
@@ -3214,7 +3214,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, 
        static int guest_buttons;
        static int ew_finger_count;
        static finger_t f[PSM_FINGERS];
-       int w, id, nfingers, ewcode, extended_buttons, clickpad_pressed;
+       int w, id, nfingers, palm, ewcode, extended_buttons, clickpad_pressed;
 
        extended_buttons = 0;
 
@@ -3577,12 +3577,16 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, 
 
        ms->button = touchpad_buttons;
 
-       psmgestures(sc, &f[0], nfingers, ms);
+       palm = psmpalmdetect(sc, &f[0], nfingers);
+
+       /* Palm detection doesn't terminate the current action. */
+       if (!palm)
+               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)) {
+       if (palm) {
                *x = *y = *z = 0;
                ms->button = ms->obutton;
                return (0);
@@ -4324,7 +4328,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m
 {
        static int touchpad_button, trackpoint_button;
        finger_t fn, f[ELANTECH_MAX_FINGERS];
-       int pkt, id, scale, i, nfingers, mask;
+       int pkt, id, scale, i, nfingers, mask, palm;
 
        if (!elantech_support)
                return (0);
@@ -4713,10 +4717,14 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m
 
        ms->button = touchpad_button | trackpoint_button;
 
+       /* Palm detection doesn't terminate the current action. */
+       palm = 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)
+       if ((PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) ||
+           nfingers == 0) && !palm)
                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)))
@@ -4731,8 +4739,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m
        }
        sc->elanaction.mask = mask;
 
-       /* Palm detection doesn't terminate the current action. */
-       if (psmpalmdetect(sc, &f[0], nfingers)) {
+       if (palm) {
                *x = *y = *z = 0;
                ms->button = ms->obutton;
                return (0);


_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to