This patch adapts the synaptics driver to the changes described in 1/3 and
2/3.

wsconsio.h defines alternative names for the ABSOLUTE_Z and ABSOLUTE_W
events, namely
    WSCONS_EVENT_TOUCH_PRESSURE and
    WSCONS_EVENT_TOUCH_CONTACTS,
and wsmouse uses the latter exclusively for the plain contact count.  For
contact width, wsconsio.h defines the new event type
    WSCONS_EVENT_TOUCH_WIDTH.

The event type
    WSCONS_EVENT_TOUCH_RESET
is introduced in order to make the synaptics driver work properly with
input that is derived from MT state (I'm not happy with the event name,
perhaps someone has a better idea). This event - which has no value -
is generated whenever the absolute coordinates are being updated, but
no pointer motion events must be generated. Usually touchpad drivers
suppress pointer motion when the contact count changes. But this is not
sufficient for the MT case, because wsmouse may change the "pointer-
controlling" input slot even even when the contact count is constant.


Index: src/wsconscomm.c
===================================================================
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v
retrieving revision 1.13
diff -u -p -r1.13 wsconscomm.c
--- src/wsconscomm.c    29 Aug 2015 08:48:28 -0000      1.13
+++ src/wsconscomm.c    11 Mar 2016 20:46:30 -0000
@@ -215,45 +215,29 @@ WSConsReadHwState(InputInfoPtr pInfo,
             hw->y = priv->maxy - event->value + priv->miny;
             hw->cumulative_dy = hw->y;
             break;
-        case WSCONS_EVENT_MOUSE_ABSOLUTE_Z:
+        case WSCONS_EVENT_TOUCH_PRESSURE:
             hw->z = event->value;
             break;
-        case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
-            if (priv->model == MODEL_ELANTECH) {
-                /* Elantech touchpads report number of fingers directly. */
-                hw->fingerWidth = 5;
-                hw->numFingers = event->value;
-                break;
-            }
-            /* XXX magic number mapping which is mirrored in pms driver */
-            switch (event->value) {
-            case 0:
-                hw->fingerWidth = 5;
-                hw->numFingers = 2;
-                break;
-            case 1:
+        case WSCONS_EVENT_TOUCH_CONTACTS:
+            hw->numFingers = event->value;
+            if (hw->numFingers == 0)
+                hw->fingerWidth = 0;
+            else if (hw->fingerWidth == 0)
                 hw->fingerWidth = 5;
-                hw->numFingers = 3;
-                break;
-            case 4 ... 5:
-                hw->fingerWidth = event->value;
-                hw->numFingers = 1;
-                break;
-            }
+            break;
+        case WSCONS_EVENT_TOUCH_WIDTH:
+            hw->fingerWidth = event->value;
+            break;
+        case WSCONS_EVENT_TOUCH_RESET:
+            /*
+             * The contact count or the active MT-slot has changed.
+             * Suppress pointer motion and two-finger scrolling.
+             */
+            priv->count_packet_finger = 0;
+            priv->vert_scroll_twofinger_on = FALSE;
+            priv->horiz_scroll_twofinger_on = FALSE;
             break;
         case WSCONS_EVENT_SYNC:
-            if (hw->z == 0) {
-                hw->fingerWidth = 0;
-                hw->numFingers = 0;
-            } else if (hw->numFingers == 0) {
-                /*
-                 * Because W may be 0 already, a two-finger touch on a
-                 * Synaptics touchpad doesn't necessarily produce an update
-                 * event for W.
-                 */
-                hw->fingerWidth = 5;
-                hw->numFingers = 2;
-            }
             hw->millis = 1000 * event->time.tv_sec +
                 event->time.tv_nsec / 1000000;
             SynapticsCopyHwState(hwRet, hw);

Reply via email to