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

xserver-xorg-input-synaptics: Changes to 'upstream-ubuntu'



 COPYING                        |    2 
 configure.ac                   |   15 
 include/Makefile.am            |    2 
 include/synaptics-properties.h |   18 
 include/synaptics.h            |   72 -
 man/synaptics.man              |  187 --
 src/Makefile.am                |    4 
 src/alpscomm.c                 |   98 -
 src/eventcomm.c                |  696 ++++------
 src/eventcomm.h                |    8 
 src/properties.c               |  623 ++++-----
 src/ps2comm.c                  |  535 +++----
 src/ps2comm.h                  |   21 
 src/psmcomm.c                  |   72 -
 src/synaptics.c                | 2755 +++++++++++++++++------------------------
 src/synapticsstr.h             |  371 ++---
 src/synproto.c                 |   59 
 src/synproto.h                 |   56 
 test/eventcomm-test.c          |   87 -
 test/fake-symbols.c            |  233 +--
 test/fake-symbols.h            |  198 +-
 tools/synclient.c              |  610 +++------
 tools/syndaemon.c              |  605 ++++-----
 23 files changed, 3192 insertions(+), 4135 deletions(-)

New commits:
commit a9d247d076b3d0d1df84f013b3733bd6297dd79b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 17 15:52:50 2012 +1000

    Remove absolute mode
    
    Moving a touchpad in absolute mode is unusual - touchpads are disconnected
    from the output device, so direct interaction is hard. There appears to be
    little usage of it (I haven't seen bug reports from people claiming to use
    it). Joe Shaw, author of the code and only known user doesn't have a use for
    it anymore, so purge it from the repo.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index 146afd8..8b78b9a 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2839,10 +2839,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
 
     dx = dy = 0;
 
-    if (!priv->absolute_events) {
-        timeleft = ComputeDeltas(priv, hw, edge, &dx, &dy, inside_active_area);
-        delay = MIN(delay, timeleft);
-    }
+    timeleft = ComputeDeltas(priv, hw, edge, &dx, &dy, inside_active_area);
+    delay = MIN(delay, timeleft);
 
     buttons = ((hw->left ? 0x01 : 0) |
                (hw->middle ? 0x02 : 0) |
@@ -2867,14 +2865,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     }
 
     /* Post events */
-    if (finger >= FS_TOUCHED) {
-        if (priv->absolute_events && inside_active_area) {
-            xf86PostMotionEvent(pInfo->dev, 1, 0, 2, hw->x, hw->y);
-        }
-        else if (dx || dy) {
-            xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
-        }
-    }
+    if (finger >= FS_TOUCHED && (dx || dy))
+        xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
 
     if (priv->mid_emu_state == MBE_LEFT_CLICK) {
         post_button_click(pInfo, 1);
@@ -2933,25 +2925,9 @@ ControlProc(InputInfoPtr pInfo, xDeviceCtl * control)
 static int
 SwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
 {
-    InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
-    SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
-
     DBG(3, "SwitchMode called\n");
 
-    switch (mode) {
-    case Absolute:
-        priv->absolute_events = TRUE;
-        break;
-
-    case Relative:
-        priv->absolute_events = FALSE;
-        break;
-
-    default:
-        return XI_BadMode;
-    }
-
-    return Success;
+    return XI_BadMode;
 }
 
 static void
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 5b0120a..384b7bb 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -201,7 +201,6 @@ struct _SynapticsPrivateRec {
 
     struct SynapticsHwState *local_hw_state;    /* used in place of local hw state variables */
 
-    Bool absolute_events;       /* post absolute motion events instead of relative */
     SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY];     /* movement history */
     int hist_index;             /* Last added entry in move_hist[] */
     int hyst_center_x;          /* center x of hysteresis */

commit 6d47d334d8a876e7e094306c313246b87016b78a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 17 12:10:04 2012 +1000

    Don't allow for scroll distances of 0 (#49965)
    
    It'll either hang the server or blow up with divisions by 0, whichever one
    comes first.
    
    X.Org Bug 49965 <http://bugs.freedesktop.org/show_bug.cgi?id=49965>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/properties.c b/src/properties.c
index 0cbca09..72ba896 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -471,6 +471,9 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             return BadMatch;
 
         dist = (INT32 *) prop->data;
+        if (dist[0] == 0 || dist[1] == 0)
+            return BadValue;
+
         if (para->scroll_dist_vert != dist[0]) {
             para->scroll_dist_vert = dist[0];
             SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
@@ -589,6 +592,9 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             return BadMatch;
 
         circdist = *(float *) prop->data;
+        if (circdist == 0)
+            return BadValue;
+
         para->scroll_dist_circ = circdist;
     }
     else if (property == prop_circscroll_trigger) {

commit cd569377cda9b5a4ee00c0137db14f625c76c40f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 17 11:02:02 2012 +1000

    Reset hw->x/y to INT_MIN and skip HandleState until we have x/y events
    
    The driver assumes x/y is always valid but after coming from a resume we may
    get a few events with either ABS_X or ABS_Y (not both). Thus we process with
    hw->x == 0 and hw->y == somevalue, causing cursor jumps when calculating
    deltas whenver the real hw->x comes in.
    
    Fix this by resetting hw->x/y to INT_MIN and skip state processing until
    both axes are available.
    
    For clickpads, this means handling of data will be delayed until we get
    at least one motion on each axis. Button presses won't be recognised either
    until that happens. It requires some skill to not trigger motion on both
    axes, even more to press a button without doing so.
    
    For non-clickpads, handling of motion events will be delayed likewise. If a
    physical button is pressed immediately after resume we have to assume deltas
    of x/y.
    - If the next event is a new touch, it will have ABS_X/ABS_Y set anyway
    - If the finger was already down, a button event is generated, and the
      finger has generated ABS_X or ABS_Y only before the event, the next event
      containing the missing data will cause a jump. The fix for this is more
      invasive and this is quite a corner-case.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index d912ee5..146afd8 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2767,6 +2767,19 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
         return delay;
     }
 
+    /* We need both and x/y, the driver can't handle just one of the two
+     * yet. But since it's possible to hit a phys button on non-clickpads
+     * without ever getting motion data first, we must continue with 0/0 for
+     * that case. */
+    if (hw->x == INT_MIN || hw->y == INT_MAX) {
+        if (para->clickpad)
+            return delay;
+        else if (hw->left || hw->right || hw->middle) {
+            hw->x = (hw->x == INT_MIN) ? 0 : hw->x;
+            hw->y = (hw->y == INT_MIN) ? 0 : hw->y;
+        }
+    }
+
     /* If a physical button is pressed on a clickpad, use cumulative relative
      * touch movements for motion */
     if (para->clickpad && (hw->left || hw->right || hw->middle)) {
diff --git a/src/synproto.c b/src/synproto.c
index d3f05ca..91e20e6 100644
--- a/src/synproto.c
+++ b/src/synproto.c
@@ -123,8 +123,8 @@ void
 SynapticsResetHwState(struct SynapticsHwState *hw)
 {
     hw->millis = 0;
-    hw->x = 0;
-    hw->y = 0;
+    hw->x = INT_MIN;
+    hw->y = INT_MIN;
     hw->z = 0;
     hw->cumulative_dx = 0;
     hw->cumulative_dy = 0;

commit 0054b144f3daf00e46a35b2f165befb209df94fc
Author: Chase Douglas <chase.douglas@canonical.com>
Date:   Wed May 16 07:49:25 2012 -0700

    Reset open slots array on device disable
    
    The open slots array is used for clickpad cumulative delta computation.
    If the array is not reset and becomes corrupted during the device
    disable/enable cycle, the cumulative deltas may be wrong. This manifests
    as jumpy cursor behavior on some clickpads after suspend/resume.
    
    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index 4946ec2..d912ee5 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -978,6 +978,7 @@ SynapticsReset(SynapticsPrivate * priv)
     priv->lastButtons = 0;
     priv->prev_z = 0;
     priv->prevFingers = 0;
+    memset(priv->open_slots, 0, priv->num_slots * sizeof(int));
 }
 
 static Bool

commit 53557a5cab1e253dc8f4393207954ae0fe76068f
Author: Chun Yang <Chuck.Yang@gmail.com>
Date:   Tue May 15 14:51:42 2012 -0500

    Fix coasting for negative ScrollDelta
    
    Fix the coasting direction for when VertScrollDelta or HorizScrollDelta is
    negative.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=49966
    
    Regression introduced in 0de4445ff8e75aab208faf6383e76045934c6720
    
    Signed-off-by: Chun Yang <Chuck.Yang@gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index ff47857..4946ec2 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2393,7 +2393,7 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
         double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
         double ddy = para->coasting_friction * dtime;
 
-        priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime * para->scroll_dist_vert;
+        priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime * abs(para->scroll_dist_vert);
         delay = MIN(delay, POLL_MS);
         if (abs(priv->scroll.coast_speed_y) < ddy) {
             priv->scroll.coast_speed_y = 0;
@@ -2408,7 +2408,7 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
     if (priv->scroll.coast_speed_x) {
         double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
         double ddx = para->coasting_friction * dtime;
-        priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime * para->scroll_dist_vert;
+        priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime * abs(para->scroll_dist_horiz);
         delay = MIN(delay, POLL_MS);
         if (abs(priv->scroll.coast_speed_x) < ddx) {
             priv->scroll.coast_speed_x = 0;

commit 1ee5bd0af6ac5c1b95d99f27f407223cd460fdb8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue May 15 11:22:43 2012 +1000

    Remove defunct HAVE_MULTITOUCH compiler warning
    
    Seems like this was a rebase gone wrong, HAVE_MULTITOUCH was removed in
    3430f4af41184752d698dcbf4919469e36b3216c
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 8b6afb9..6cfbcc7 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -608,10 +608,8 @@ count_fingers(InputInfoPtr pInfo, const struct CommData *comm)
     else if (comm->threeFingers)
         fingers = 3;
 
-#ifdef HAVE_MULTITOUCH
     if (priv->has_touch && proto_data->num_touches > fingers)
         fingers = proto_data->num_touches;
-#endif
 
     return fingers;
 }

commit 55fc42e7c9b4948cadd4f98ef7b6a3b12e268e3e
Author: Chase Douglas <chase.douglas@canonical.com>
Date:   Mon May 14 10:20:01 2012 -0700

    Ignore pre-existing touches
    
    If a touch is physically active when the device is enabled, then all
    events for that touch must be ignored. In particular, we cannot close
    the touch or we will decrement touch count counters below zero. If these
    counters go below zero memory corruption can occur.
    
    Note that a device is disabled and enabled every time the user types on
    the keyboard if synclient is used to disable the trackpad while typing.
    This is a very common option.
    
    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index d9430e1..8b6afb9 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -545,8 +545,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
         if (slot_index < 0)
             return;
 
-        if (hw->slot_state[slot_index] == SLOTSTATE_EMPTY ||
-            hw->slot_state[slot_index] == SLOTSTATE_OPEN_EMPTY)
+        if (hw->slot_state[slot_index] == SLOTSTATE_OPEN_EMPTY)
             hw->slot_state[slot_index] = SLOTSTATE_UPDATE;
         if (ev->code == ABS_MT_TRACKING_ID) {
             if (ev->value >= 0) {
@@ -561,7 +560,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
                                 "Attempted to copy values from out-of-range "
                                 "slot, touch events may be incorrect.\n");
             }
-            else {
+            else if (hw->slot_state[slot_index] != SLOTSTATE_EMPTY) {
                 hw->slot_state[slot_index] = SLOTSTATE_CLOSE;
                 proto_data->num_touches--;
             }

commit 77d766b1d535dff9a27c7db343ede85d9f44850b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri May 11 12:27:39 2012 +1000

    Avoid out-of-bounds access by running num_active_touches < 0 (#49439)
    
    If a touch is active during driver init, the slot will be set to
    SLOTSTATE_CLOSE when it finishes. That could decrease num_active_touches to
    less than 0, causing out-of-bounds access.
    
    X.Org Bug 49439 <http://bugs.freedesktop.org/show_bug.cgi?id=49439>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index e792977..ff47857 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2624,7 +2624,9 @@ UpdateTouchState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
                     priv->open_slots[j] = priv->open_slots[j + 1];
             }
 
-            priv->num_active_touches--;
+            BUG_WARN(priv->num_active_touches == 0);
+            if (priv->num_active_touches > 0)
+                priv->num_active_touches--;
         }
     }
 

commit 0352c67fa2a7224b5a3bf03a934b3c7af42b4f51
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri May 11 10:54:47 2012 +1000

    tools: coasting speed is not capped at 20, cap it at 255
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/tools/synclient.c b/tools/synclient.c
index 4623728..6239617 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -117,7 +117,7 @@ static struct Parameter params[] = {
     {"PalmDetect",            PT_BOOL,   0, 1,     SYNAPTICS_PROP_PALM_DETECT,	8,	0},
     {"PalmMinWidth",          PT_INT,    0, 15,    SYNAPTICS_PROP_PALM_DIMENSIONS,	32,	0},
     {"PalmMinZ",              PT_INT,    0, 255,   SYNAPTICS_PROP_PALM_DIMENSIONS,	32,	1},
-    {"CoastingSpeed",         PT_DOUBLE, 0, 20,    SYNAPTICS_PROP_COASTING_SPEED,	0 /* float*/,	0},
+    {"CoastingSpeed",         PT_DOUBLE, 0, 255,    SYNAPTICS_PROP_COASTING_SPEED,	0 /* float*/,	0},
     {"CoastingFriction",      PT_DOUBLE, 0, 255,   SYNAPTICS_PROP_COASTING_SPEED,	0 /* float*/,	1},
     {"PressureMotionMinZ",    PT_INT,    1, 255,   SYNAPTICS_PROP_PRESSURE_MOTION,	32,	0},
     {"PressureMotionMaxZ",    PT_INT,    1, 255,   SYNAPTICS_PROP_PRESSURE_MOTION,	32,	1},

commit 0de4445ff8e75aab208faf6383e76045934c6720
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed May 9 14:26:40 2012 +1000

    Fix coasting speed trigger
    
    CoastingSpeed is defined as scrolls/s. The previous code just used
    delta/seconds which depended on the device coordinate range and exceeded the
    default CoastingSpeed at almost any scroll event.
    
    Divide the estimated delta by the scroll distance to get the accurate
    scrolls/s number. Since that now changes the contents of what's in
    coast_speed_y, change the users of that too.
    
    http://bugzilla.redhat.com/813686
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index a4507c6..e792977 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2109,7 +2109,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
             double dy =
                 estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y);
             if (pkt_time > 0) {
-                double scrolls_per_sec = dy / pkt_time;
+                double scrolls_per_sec = (dy / abs(para->scroll_dist_vert)) / pkt_time;
 
                 if (fabs(scrolls_per_sec) >= para->coasting_speed) {
                     priv->scroll.coast_speed_y = scrolls_per_sec;
@@ -2121,7 +2121,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
             double dx =
                 estimate_delta(HIST(0).x, HIST(1).x, HIST(2).x, HIST(3).x);
             if (pkt_time > 0) {
-                double scrolls_per_sec = dx / pkt_time;
+                double scrolls_per_sec = (dx / abs(para->scroll_dist_vert)) / pkt_time;
 
                 if (fabs(scrolls_per_sec) >= para->coasting_speed) {
                     priv->scroll.coast_speed_x = scrolls_per_sec;
@@ -2133,7 +2133,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
             double da = estimate_delta_circ(priv);
 
             if (pkt_time > 0) {
-                double scrolls_per_sec = da / pkt_time;
+                double scrolls_per_sec = (da / para->scroll_dist_circ) / pkt_time;
 
                 if (fabs(scrolls_per_sec) >= para->coasting_speed) {
                     if (vert) {
@@ -2391,10 +2391,9 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
 
     if (priv->scroll.coast_speed_y) {
         double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
-        double ddy =
-            para->coasting_friction * dtime * abs(para->scroll_dist_vert);
+        double ddy = para->coasting_friction * dtime;
 
-        priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
+        priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime * para->scroll_dist_vert;
         delay = MIN(delay, POLL_MS);
         if (abs(priv->scroll.coast_speed_y) < ddy) {
             priv->scroll.coast_speed_y = 0;
@@ -2408,9 +2407,8 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
 
     if (priv->scroll.coast_speed_x) {
         double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
-        double ddx =
-            para->coasting_friction * dtime * abs(para->scroll_dist_horiz);
-        priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
+        double ddx = para->coasting_friction * dtime;
+        priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime * para->scroll_dist_vert;
         delay = MIN(delay, POLL_MS);
         if (abs(priv->scroll.coast_speed_x) < ddx) {
             priv->scroll.coast_speed_x = 0;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 4bc2ed5..5b0120a 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -169,7 +169,7 @@ typedef struct _SynapticsParameters {
     Bool palm_detect;           /* Enable Palm Detection */
     int palm_min_width;         /* Palm detection width */
     int palm_min_z;             /* Palm detection depth */
-    double coasting_speed;      /* Coasting threshold scrolling speed */
+    double coasting_speed;      /* Coasting threshold scrolling speed in scrolls/s */
     double coasting_friction;   /* Number of scrolls per second per second to change coasting speed */
     int press_motion_min_z;     /* finger pressure at which minimum pressure motion factor is applied */
     int press_motion_max_z;     /* finger pressure at which maximum pressure motion factor is applied */
@@ -213,8 +213,8 @@ struct _SynapticsPrivateRec {
         double delta_y;         /* accumulated vert scroll delta */
         double last_a;          /* last angle-scroll position */
         CARD32 last_millis;     /* time last scroll event posted */
-        double coast_speed_x;   /* Horizontal coasting speed */
-        double coast_speed_y;   /* Vertical coasting speed */
+        double coast_speed_x;   /* Horizontal coasting speed in scrolls/s */
+        double coast_speed_y;   /* Vertical coasting speed in scrolls/s */
         double coast_delta_x;   /* Accumulated horizontal coast delta */
         double coast_delta_y;   /* Accumulated vertical coast delta */
         int packets_this_scroll;        /* Events received for this scroll */

commit a1d6784d790f081f8a6ea3a10d3cfa578aa10d5b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed May 9 12:23:46 2012 +1000

    Don't check for soft buttons if a button is already down
    
    Moving into a different soft button's area during drag-n-drop would trigger
    a click of that button.
    
    We only have the current button state and we mess with it, so the conditions
    for a possible clickpad soft-button event are:
    - hw->left is down now
    - none of left|right|middle were down before. since we change hw->left to
      hw->right/left we need to check all three
    
    If hw->left is down but one of the other buttons was already down, copy that
    button state and continue.
    
    http://bugzilla.redhat.com/819348
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index 7881926..a4507c6 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2539,14 +2539,23 @@ update_hw_button_state(const InputInfoPtr pInfo, struct SynapticsHwState *hw,
 
     /* If this is a clickpad and the user clicks in a soft button area, press
      * the soft button instead. */
-    if (para->clickpad && hw->left && !hw->right && !hw->middle) {
-        if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
-            hw->left = 0;
-            hw->right = 1;
-        }
-        else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
-            hw->left = 0;
-            hw->middle = 1;
+    if (para->clickpad) {
+        /* hw->left is down, but no other buttons were already down */
+        if (!old->left && !old->right && !old->middle &&
+            hw->left && !hw->right && !hw->middle) {
+                if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
+                    hw->left = 0;
+                    hw->right = 1;
+                }
+                else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
+                    hw->left = 0;
+                    hw->middle = 1;
+                }
+        }
+        else if (hw->left) {
+            hw->left = old->left;
+            hw->right = old->right;
+            hw->middle = old->middle;
         }
     }
 

commit 4d4d859296b93f1e2bd1c059f5864f19d87de58a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue May 8 08:19:48 2012 +1000

    Rename force_empty parameter to set_slot_empty
    
    Original version of d13e83b921a398b9472b07874cf5061c8a0ea6a6 had
    'force_empty', the rename only covered the definition, not the declaration
    of the function.
    
    No functional changes.
    
    Reported-by: Nicola Soranzo <nsoranzo@tiscali.it>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synproto.h b/src/synproto.h
index 7c648b6..cf0034c 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -120,7 +120,7 @@ extern void SynapticsCopyHwState(struct SynapticsHwState *dst,
                                  const struct SynapticsHwState *src);
 extern void SynapticsResetHwState(struct SynapticsHwState *hw);
 extern void SynapticsResetTouchHwState(struct SynapticsHwState *hw,
-                                       Bool force_empty);
+                                       Bool set_slot_empty);
 
 extern Bool SynapticsIsSoftButtonAreasValid(int *values);
 

commit b6f3ccd40237d2d8df653f0dcba2ca7336c13f2b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Mar 23 16:27:42 2012 +1000

    Format Makefile.am, drop @DRIVER_NAME@.c usage
    
    The driver name doesn't change often enough for this to warrant it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index 5333ba5..101bd46 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,9 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_CFLAGS = $(XORG_CFLAGS)
 
-@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c synapticsstr.h \
+@DRIVER_NAME@_drv_la_SOURCES = \
+	synaptics.c \
+	synapticsstr.h \
 	synproto.c \
 	synproto.h \
 	properties.c

commit ebd36c7494062e9f9a47fcd20148de886ebdd46a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Mar 23 16:25:54 2012 +1000

    Move synaptics.h leftovers to synapticsstr.h, drop synaptics.h
    
    This leaves us with a duplicated define for the maxbuttons but I'll live
    with that for now.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/include/Makefile.am b/include/Makefile.am
index f078e5e..8234020 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -18,4 +18,4 @@
 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-sdk_HEADERS = synaptics.h synaptics-properties.h
+sdk_HEADERS = synaptics-properties.h
diff --git a/include/synaptics.h b/include/synaptics.h
deleted file mode 100644
index 9ea3ced..0000000
--- a/include/synaptics.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of Red Hat
- * not be used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.  Red
- * Hat makes no representations about the suitability of this software
- * for any purpose.  It is provided "as is" without express or implied
- * warranty.
- *
- * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef	_SYNAPTICS_H_
-#define _SYNAPTICS_H_
-
-#include <X11/Xdefs.h>
-
-/******************************************************************************
- *		Public definitions.
- *			Used by driver and the shared memory configurator
- *****************************************************************************/
-typedef enum {
-    RT_TAP = 0,                 /* Right top corner */
-    RB_TAP,                     /* Right bottom corner */
-    LT_TAP,                     /* Left top corner */
-    LB_TAP,                     /* Left bottom corner */
-    F1_TAP,                     /* Non-corner tap, one finger */
-    F2_TAP,                     /* Non-corner tap, two fingers */
-    F3_TAP,                     /* Non-corner tap, three fingers */
-    MAX_TAP
-} TapEvent;
-
-typedef enum {
-    F1_CLICK1 = 0,              /* Click left, one finger */
-    F2_CLICK1,                  /* Click left, two fingers */
-    F3_CLICK1,                  /* Click left, three fingers */
-    MAX_CLICK
-} ClickFingerEvent;
-
-#define SYN_MAX_BUTTONS 12      /* Max number of mouse buttons */
-
-#endif /* _SYNAPTICS_H_ */
diff --git a/src/alpscomm.c b/src/alpscomm.c
index 0bf0447..c565636 100644
--- a/src/alpscomm.c
+++ b/src/alpscomm.c
@@ -34,7 +34,6 @@
 
 #include <xorg-server.h>
 #include "synproto.h"
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "ps2comm.h"
 #include <xf86.h>
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 4025eee..d9430e1 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -39,7 +39,6 @@
 #include <string.h>
 #include <stdio.h>
 #include "synproto.h"
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include <xf86.h>
 #include <mtdev.h>
diff --git a/src/properties.c b/src/properties.c
index 49eb6c0..0cbca09 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -35,7 +35,6 @@
 #include <xf86Xinput.h>
 #include <exevents.h>
 
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "synaptics-properties.h"
 
diff --git a/src/ps2comm.c b/src/ps2comm.c
index f88b5cb..7c8e631 100644
--- a/src/ps2comm.c
+++ b/src/ps2comm.c
@@ -38,7 +38,6 @@
 
 #include <xorg-server.h>
 #include "synproto.h"
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "ps2comm.h"
 #include <xf86.h>
diff --git a/src/psmcomm.c b/src/psmcomm.c
index 478202a..4086aba 100644
--- a/src/psmcomm.c
+++ b/src/psmcomm.c
@@ -45,7 +45,6 @@
 #include <errno.h>
 #include <string.h>
 #include "synproto.h"
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "ps2comm.h"            /* ps2_print_ident() */
 #include <xf86.h>
diff --git a/src/synaptics.c b/src/synaptics.c
index cb0467b..7881926 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -74,7 +74,6 @@
 #include <xserver-properties.h>
 #include <ptrveloc.h>
 
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "synaptics-properties.h"
 
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 3a1fd3d..4bc2ed5 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -46,6 +46,26 @@
  *****************************************************************************/
 #define SYNAPTICS_MOVE_HISTORY	5
 #define SYNAPTICS_MAX_TOUCHES	10
+#define SYN_MAX_BUTTONS 12      /* Max number of mouse buttons */
+
+typedef enum {
+    RT_TAP = 0,                 /* Right top corner */
+    RB_TAP,                     /* Right bottom corner */
+    LT_TAP,                     /* Left top corner */
+    LB_TAP,                     /* Left bottom corner */
+    F1_TAP,                     /* Non-corner tap, one finger */
+    F2_TAP,                     /* Non-corner tap, two fingers */
+    F3_TAP,                     /* Non-corner tap, three fingers */
+    MAX_TAP
+} TapEvent;
+
+typedef enum {
+    F1_CLICK1 = 0,              /* Click left, one finger */
+    F2_CLICK1,                  /* Click left, two fingers */
+    F3_CLICK1,                  /* Click left, three fingers */
+    MAX_CLICK
+} ClickFingerEvent;
+
 
 typedef struct _SynapticsMoveHist {
     int x, y;
diff --git a/src/synproto.c b/src/synproto.c
index adec615..d3f05ca 100644
--- a/src/synproto.c
+++ b/src/synproto.c
@@ -22,7 +22,6 @@
  */
 
 #include "synproto.h"
-#include "synaptics.h"
 #include "synapticsstr.h"
 
 static int
diff --git a/test/eventcomm-test.c b/test/eventcomm-test.c
index d471e98..144d6dc 100644
--- a/test/eventcomm-test.c
+++ b/test/eventcomm-test.c
@@ -31,7 +31,6 @@
 #include <stdio.h>
 #include <assert.h>
 
-#include "synaptics.h"
 #include "synapticsstr.h"
 #include "eventcomm.h"
 
diff --git a/tools/synclient.c b/tools/synclient.c
index 74eb504..4623728 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -43,13 +43,14 @@
 #include <X11/Xatom.h>
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XInput.h>
-#include "synaptics.h"
 #include "synaptics-properties.h"
 
 #ifndef XATOM_FLOAT
 #define XATOM_FLOAT "FLOAT"
 #endif
 
+#define SYN_MAX_BUTTONS 12
+
 union flong {                   /* Xlibs 64-bit property handling madness */
     long l;
     float f;
diff --git a/tools/syndaemon.c b/tools/syndaemon.c
index 5109052..d24f09c 100644
--- a/tools/syndaemon.c
+++ b/tools/syndaemon.c
@@ -45,7 +45,6 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 
-#include "synaptics.h"
 #include "synaptics-properties.h"
 
 typedef enum {

commit 3430f4af41184752d698dcbf4919469e36b3216c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Mar 23 16:19:18 2012 +1000

    Require xserver 1.12 and inputproto 2.2
    
    This drops conditional compilation of multitouch support, smooth scrolling
    support and old ABIs.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/configure.ac b/configure.ac
index 7996106..2b3ee75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ m4_ifndef([XORG_DRIVER_CHECK_EXT],
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 
 # Obtain compiler/linker options for the Synaptics driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.7] xproto inputproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [inputproto >= 2.1.99.3] [xorg-server >= 1.12] xproto inputproto $REQUIRED_MODULES)
 
 # X Server SDK location is required to install Synaptics header files
 # This location is also relayed in the xorg-synaptics.pc file
@@ -64,11 +64,6 @@ AC_SUBST([sdkdir])
 DRIVER_NAME=synaptics
 AC_SUBST([DRIVER_NAME])
 
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
-if test "x$HAVE_XI22" = xyes; then
-    AC_DEFINE(HAVE_MULTITOUCH, 1, [XI2.2 available])
-fi
-
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
@@ -126,10 +121,8 @@ esac
 if test "x$BUILD_EVENTCOMM" = xyes; then
     AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
 
-    if test "x$HAVE_XI22" = xyes; then
-        # Obtain compiler/linker options for mtdev
-        PKG_CHECK_MODULES(MTDEV, mtdev)
-    fi
+    # Obtain compiler/linker options for mtdev
+    PKG_CHECK_MODULES(MTDEV, mtdev)
 fi
 if test "x$BUILD_PSMCOMM" = xyes; then
     AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled])
diff --git a/src/eventcomm.c b/src/eventcomm.c
index fc2fae0..4025eee 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -42,9 +42,7 @@
 #include "synaptics.h"
 #include "synapticsstr.h"
 #include <xf86.h>
-#ifdef HAVE_MULTITOUCH
 #include <mtdev.h>
-#endif
 
 #ifndef INPUT_PROP_BUTTONPAD
 #define INPUT_PROP_BUTTONPAD 0x02
@@ -73,13 +71,11 @@ struct eventcomm_proto_data {
     BOOL need_grab;
     int st_to_mt_offset[2];
     double st_to_mt_scale[2];
-#ifdef HAVE_MULTITOUCH
     struct mtdev *mtdev;
     int axis_map[MT_ABS_SIZE];
     int cur_slot;
     ValuatorMask **last_mt_vals;
     int num_touches;
-#endif
 };
 
 struct eventcomm_proto_data *
@@ -97,7 +93,6 @@ EventProtoDataAlloc(void)
     return proto_data;
 }
 
-#ifdef HAVE_MULTITOUCH
 static int
 last_mt_vals_slot(const SynapticsPrivate * priv)
 {
@@ -180,7 +175,6 @@ InitializeTouch(InputInfoPtr pInfo)
             valuator_mask_set(proto_data->last_mt_vals[i], 4 + j, 0);
     }
 }
-#endif
 
 static Bool
 EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
@@ -203,9 +197,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
 
     proto_data->need_grab = FALSE;
 
-#ifdef HAVE_MULTITOUCH
     InitializeTouch(pInfo);
-#endif
 
     return TRUE;
 }
@@ -213,9 +205,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
 static Bool
 EventDeviceOffHook(InputInfoPtr pInfo)
 {
-#ifdef HAVE_MULTITOUCH
     UninitializeTouch(pInfo);
-#endif
 
     return Success;
 }
@@ -416,7 +406,6 @@ event_query_axis_ranges(InputInfoPtr pInfo)
         event_get_abs(pInfo, pInfo->fd, ABS_TOOL_WIDTH,
                       &priv->minw, &priv->maxw, NULL, NULL);
 
-#if HAVE_MULTITOUCH
     if (priv->has_touch) {
         int st_minx = priv->minx;
         int st_maxx = priv->maxx;
@@ -435,7 +424,6 @@ event_query_axis_ranges(InputInfoPtr pInfo)
         proto_data->st_to_mt_scale[1] =
             (priv->maxy - priv->miny) / (st_maxy - st_miny);
     }
-#endif
 
     SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
     if (rc >= 0) {
@@ -502,19 +490,15 @@ EventQueryHardware(InputInfoPtr pInfo)
 static Bool
 SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)


Reply to: