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

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



 Makefile.am                    |    8 
 README                         |    6 
 conf/11-x11-synaptics.fdi      |   10 
 conf/50-synaptics.conf         |   21 
 configure.ac                   |   38 -
 include/Makefile.am            |    1 
 include/synaptics-properties.h |    9 
 man/Makefile.am                |    3 
 man/synaptics.man              |   94 +-
 man/syndaemon.man              |   41 -
 src/Makefile.am                |    9 
 src/alpscomm.c                 |   25 
 src/alpscomm.h                 |   33 
 src/eventcomm.c                |  384 ++++++----
 src/eventcomm.h                |    6 
 src/properties.c               |  172 +++-
 src/ps2comm.c                  |  129 +--
 src/ps2comm.h                  |   15 
 src/psmcomm.c                  |   55 -
 src/synaptics.c                | 1473 +++++++++++++++++++++++------------------
 src/synapticsstr.h             |   65 +
 src/synproto.h                 |   33 
 test/.gitignore                |    6 
 test/Makefile.am               |   15 
 test/eventcomm-test.c          |  285 +++++++
 test/fake-symbols.c            |  452 ++++++++++++
 test/fake-symbols.h            |  187 +++++
 test/test-pad.c                |  121 ---
 test/testprotocol.c            |   82 --
 tools/Makefile.am              |    3 
 tools/synclient.c              |    3 
 tools/syndaemon.c              |   63 +
 32 files changed, 2542 insertions(+), 1305 deletions(-)

New commits:
commit 9f9b55ab55ed5251c1607c59d8817231d076d82c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Dec 12 11:35:37 2011 +1000

    test: fix build errors introduced by upstream server change
    
    Introduced by upstream change xorg-server-1.11.99.1-33-g09e4b78,
        Fix gcc -Wwrite-strings warnings in xf86 ddx
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index a312aa0..2d94622 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -44,7 +44,7 @@ xf86ReplaceIntOption(OPTTYPE optlist, const char *name, const int val)
 }
 
 _X_EXPORT char *
-xf86SetStrOption(OPTTYPE optlist, const char *name, char *deflt)
+xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char *deflt)
 {
     return NULL;
 }
@@ -60,7 +60,7 @@ xf86AddNewOption(OPTTYPE head, const char *name, const char *val)
 {
     return NULL;
 }
-_X_EXPORT char *
+_X_EXPORT CONST char *
 xf86FindOptionValue(OPTTYPE options, const char *name)
 {
     return NULL;
diff --git a/test/fake-symbols.h b/test/fake-symbols.h
index 7c74f7a..a297d28 100644
--- a/test/fake-symbols.h
+++ b/test/fake-symbols.h
@@ -3,8 +3,10 @@
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
 #define OPTTYPE XF86OptionPtr
+#define CONST const
 #else
 #define OPTTYPE pointer
+#define CONST 
 #endif
 
 extern int xf86ReadSerial (int fd, void *buf, int count);
@@ -17,15 +19,16 @@ extern int xf86SetSerialSpeed (int fd, int speed);
 extern OPTTYPE xf86ReplaceIntOption(OPTTYPE optlist, const char *name, const int val);
 extern OPTTYPE xf86AddNewOption(OPTTYPE head, const char *name, const char *val);
 extern char* xf86OptionName(OPTTYPE opt);
-extern char* xf86FindOptionValue(OPTTYPE options, const char *name);
+extern CONST char* xf86FindOptionValue(OPTTYPE options, const char *name);
 extern int xf86NameCmp(const char *s1, const char *s2);
 extern char* xf86CheckStrOption(OPTTYPE optlist, const char *name, char *deflt);
 
 
-extern char * xf86SetStrOption(OPTTYPE optlist, const char *name, char *deflt);
+extern char * xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char *deflt);
+extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt);
 extern int xf86SetBoolOption(OPTTYPE optlist, const char *name, int deflt);
 extern OPTTYPE xf86AddNewOption(OPTTYPE head, const char *name, const char *val);
-extern char* xf86FindOptionValue(OPTTYPE options, const char *name);
+extern CONST char* xf86FindOptionValue(OPTTYPE options, const char *name);
 extern char* xf86OptionName(OPTTYPE opt);
 extern char *xf86OptionValue(OPTTYPE opt);
 extern int xf86NameCmp(const char *s1, const char *s2);

commit b7e65f04f5f0c17ac8a26393134cc7e8418ccdec
Author: Cyril Brulebois <kibi@debian.org>
Date:   Mon Dec 12 01:35:27 2011 +0100

    Revert: "eventcomm: replace synaptics-custom TEST_BIT with server's BitIsOn."
    
    This commit reverts 13543b156d78bc4d01a19844a5ee8f283269621b
    
    As seen in Debian's #648488, this switch causes a regression on
    PowerPC, especially seen on iBook G4 with appletouch. Take a defensive
    stance and revert back to a working state until things have been figured
    out and fixed properly.
    
    Since things have evolved and since that revert triggers a lot of
    conflicts, the following method was applied:
     - manual reintroduction of the 3 removed macros: OFF, LONG, TEST_BIT
     - coccinelle semantic patch to revert from BitIsOn to TEST_BIT
    
    Coccinelle semantic patch:
      @@
      expression a,b;
      @@
      -BitIsOn(a,b)
      +TEST_BIT(b,a)
    
    Bugzilla: http://bugs.debian.org/648488
    Signed-off-by: Cyril Brulebois <kibi@debian.org>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index cd08f13..40e9bdf 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -47,6 +47,9 @@
 
 #define LONG_BITS (sizeof(long) * 8)
 #define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
+#define OFF(x)   ((x) % LONG_BITS)
+#define LONG(x)  ((x) / LONG_BITS)
+#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
 
 /**
  * Protocol-specific data.
@@ -122,16 +125,16 @@ event_query_is_touchpad(int fd, BOOL test_grab)
     SYSCALL(rc = ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits));
     if (rc < 0)
 	goto unwind;
-    if (!BitIsOn(evbits, EV_SYN) ||
-	!BitIsOn(evbits, EV_ABS) ||
-	!BitIsOn(evbits, EV_KEY))
+    if (!TEST_BIT(EV_SYN, evbits) ||
+	!TEST_BIT(EV_ABS, evbits) ||
+	!TEST_BIT(EV_KEY, evbits))
 	goto unwind;
 
     SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
     if (rc < 0)
 	goto unwind;
-    if (!BitIsOn(absbits, ABS_X) ||
-	!BitIsOn(absbits, ABS_Y))
+    if (!TEST_BIT(ABS_X, absbits) ||
+	!TEST_BIT(ABS_Y, absbits))
 	goto unwind;
 
     SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
@@ -139,12 +142,12 @@ event_query_is_touchpad(int fd, BOOL test_grab)
 	goto unwind;
 
     /* we expect touchpad either report raw pressure or touches */
-    if (!BitIsOn(absbits, ABS_PRESSURE) && !BitIsOn(keybits, BTN_TOUCH))
+    if (!TEST_BIT(ABS_PRESSURE, absbits) && !TEST_BIT(BTN_TOUCH, keybits))
 	goto unwind;
     /* all Synaptics-like touchpad report BTN_TOOL_FINGER */
-    if (!BitIsOn(keybits, BTN_TOOL_FINGER))
+    if (!TEST_BIT(BTN_TOOL_FINGER, keybits))
 	goto unwind;
-    if (BitIsOn(keybits, BTN_TOOL_PEN))
+    if (TEST_BIT(BTN_TOOL_PEN, keybits))
 	goto unwind;			    /* Don't match wacom tablets */
 
     ret = TRUE;
@@ -269,8 +272,8 @@ event_query_axis_ranges(InputInfoPtr pInfo)
     SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
     if (rc >= 0)
     {
-	priv->has_pressure = (BitIsOn(absbits, ABS_PRESSURE) != 0);
-	priv->has_width = (BitIsOn(absbits, ABS_TOOL_WIDTH) != 0);
+	priv->has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0);
+	priv->has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0);
     }
     else
 	xf86IDrvMsg(pInfo, X_ERROR, "failed to query ABS bits (%s)\n", strerror(errno));
@@ -287,16 +290,16 @@ event_query_axis_ranges(InputInfoPtr pInfo)
     SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
     if (rc >= 0)
     {
-	priv->has_left = (BitIsOn(keybits, BTN_LEFT) != 0);
-	priv->has_right = (BitIsOn(keybits, BTN_RIGHT) != 0);
-	priv->has_middle = (BitIsOn(keybits, BTN_MIDDLE) != 0);
-	priv->has_double = (BitIsOn(keybits, BTN_TOOL_DOUBLETAP) != 0);
-	priv->has_triple = (BitIsOn(keybits, BTN_TOOL_TRIPLETAP) != 0);
-
-	if ((BitIsOn(keybits, BTN_0) != 0) ||
-	    (BitIsOn(keybits, BTN_1) != 0) ||
-	    (BitIsOn(keybits, BTN_2) != 0) ||
-	    (BitIsOn(keybits, BTN_3) != 0))
+	priv->has_left = (TEST_BIT(BTN_LEFT, keybits) != 0);
+	priv->has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0);
+	priv->has_middle = (TEST_BIT(BTN_MIDDLE, keybits) != 0);
+	priv->has_double = (TEST_BIT(BTN_TOOL_DOUBLETAP, keybits) != 0);
+	priv->has_triple = (TEST_BIT(BTN_TOOL_TRIPLETAP, keybits) != 0);
+
+	if ((TEST_BIT(BTN_0, keybits) != 0) ||
+	    (TEST_BIT(BTN_1, keybits) != 0) ||
+	    (TEST_BIT(BTN_2, keybits) != 0) ||
+	    (TEST_BIT(BTN_3, keybits) != 0))
 	    priv->has_scrollbuttons = 1;
     }
 

commit 0cd5a77c3a455e942929eb4d5412fa51630ed13f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Nov 30 09:59:37 2011 +1000

    If protocol is auto-dev and the device path is set, unset the protocol
    
    The remainder of the handling code will take try through all protocols,
    taking the device into account (as of
    xf86-input-synaptics-1.4.0-34-g241254e)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index 8fbddc8..9490106 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -274,6 +274,13 @@ SetDeviceAndProtocol(InputInfoPtr pInfo)
 
     proto = xf86SetStrOption(pInfo->options, "Protocol", NULL);
     device = xf86SetStrOption(pInfo->options, "Device", NULL);
+
+    /* If proto is auto-dev, unset and let the code do the rest */
+    if (proto && !strcmp(proto, "auto-dev")) {
+        free(proto);
+        proto = NULL;
+    }
+
     for (i = 0; protocols[i].name; i++) {
         if ((!device || !proto) &&
             protocols[i].proto_ops->AutoDevProbe &&

commit d1301412d7b7acd6325f0561c109f2b8e1c7a999
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Nov 30 09:39:12 2011 +1000

    Return true/false from SetDeviceAndProtocol
    
    Instead of requiring the caller to know which private field indicates
    failure, just return true on success or false on failure.
    
    No functional change.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index 1c9b6db..8fbddc8 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -265,7 +265,7 @@ SanitizeDimensions(InputInfoPtr pInfo)
     }
 }
 
-static void
+static Bool
 SetDeviceAndProtocol(InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = pInfo->private;
@@ -286,6 +286,8 @@ SetDeviceAndProtocol(InputInfoPtr pInfo)
     free(device);
 
     priv->proto_ops = protocols[i].proto_ops;
+
+    return (priv->proto_ops != NULL);
 }
 
 /*
@@ -714,8 +716,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
     }
 
     /* may change pInfo->options */
-    SetDeviceAndProtocol(pInfo);
-    if (priv->proto_ops == NULL) {
+    if (!SetDeviceAndProtocol(pInfo)) {
         xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver unable to detect protocol\n");
         goto SetupProc_fail;
     }

commit 2603ad69b997c999404ecc441e0d64ea2cc22018
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Oct 18 15:46:03 2011 +1000

    Use the scroll distances as increment for scrolling valuator axes
    
    XI2.1 allows an 'increment' for each scrolling variable. Use that instead of
    hiding it away inside the driver.
    
    For circular scrolling, the increment is the one of the respective scrolling
    axis.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/properties.c b/src/properties.c
index 5f11cf2..f15a6fb 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -425,8 +425,22 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             return BadMatch;
 
         dist = (INT32*)prop->data;
-        para->scroll_dist_vert = dist[0];
-        para->scroll_dist_horiz = dist[1];
+        if (para->scroll_dist_vert != dist[0])
+        {
+            para->scroll_dist_vert = dist[0];
+#ifdef HAVE_SMOOTH_SCROLL
+            SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
+                              para->scroll_dist_vert, 0);
+#endif
+        }
+        if (para->scroll_dist_horiz != dist[1])
+        {
+            para->scroll_dist_horiz = dist[1];
+#ifdef HAVE_SMOOTH_SCROLL
+            SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL,
+                              para->scroll_dist_horiz, 0);
+#endif
+        }
     } else if (property == prop_scrolledge)
     {
         CARD8 *edge;
diff --git a/src/synaptics.c b/src/synaptics.c
index 9daa45a..1c9b6db 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1101,8 +1101,10 @@ DeviceInit(DeviceIntPtr dev)
     if (!priv->scroll_events_mask)
         return !Success;
 
-    SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL, 1, 0);
-    SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL, 1, 0);
+    SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL,
+                      priv->synpara.scroll_dist_horiz, 0);
+    SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
+                      priv->synpara.scroll_dist_vert, 0);
 #endif
 
     if (!alloc_shm_data(pInfo))
@@ -2232,17 +2234,15 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 
     if (priv->vert_scroll_edge_on || priv->vert_scroll_twofinger_on) {
 	/* + = down, - = up */
-	double delta = para->scroll_dist_vert;
-	if (delta > 0 && hw->y != priv->scroll.last_y) {
-	    priv->scroll.delta_y += (hw->y - priv->scroll.last_y) / delta;
+	if (para->scroll_dist_vert > 0 && hw->y != priv->scroll.last_y) {
+	    priv->scroll.delta_y += (hw->y - priv->scroll.last_y);
 	    priv->scroll.last_y = hw->y;
 	}
     }
     if (priv->horiz_scroll_edge_on || priv->horiz_scroll_twofinger_on) {
 	/* + = right, - = left */
-	double delta = para->scroll_dist_horiz;
-	if (delta > 0 && hw->x != priv->scroll.last_x) {
-	    priv->scroll.delta_x += (hw->x - priv->scroll.last_x) / delta;
+	if (para->scroll_dist_horiz > 0 && hw->x != priv->scroll.last_x) {
+	    priv->scroll.delta_x += (hw->x - priv->scroll.last_x);
 	    priv->scroll.last_x = hw->x;
 	}
     }
@@ -2252,9 +2252,9 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 	double diff = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
 	if (delta >= 0.005 && diff != 0.0) {
 	    if (priv->circ_scroll_vert)
-		priv->scroll.delta_y += diff / delta;
+		priv->scroll.delta_y += diff / delta * para->scroll_dist_vert;
 	    else
-		priv->scroll.delta_x += diff / delta;
+		priv->scroll.delta_x += diff / delta * para->scroll_dist_horiz;;
 	    priv->scroll.last_a = angle(priv, hw->x, hw->y);
         }
     }

commit 4f46057a33b20df62d919e49a394ab6cb7aa6aa1
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Thu Jun 9 20:03:11 2011 +0100

    Scroll: Initial smooth scrolling support
    
    Post smooth-scrolling events through the new X server API when
    available, rather than legacy jerky button events.
    
    [Amended to use the final smooth scrolling API]
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Amendments-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index cea52a6..9daa45a 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -72,6 +72,7 @@
 #include <exevents.h>
 
 #include <X11/Xatom.h>
+#include <X11/extensions/XI2.h>
 #include <xserver-properties.h>
 #include <ptrveloc.h>
 
@@ -802,6 +803,10 @@ static void SynapticsUnInit(InputDriverPtr drv,
         free(priv->timer);
     if (priv && priv->proto_data)
         free(priv->proto_data);
+#ifdef HAVE_SMOOTH_SCROLL
+    if (priv && priv->scroll_events_mask)
+        valuator_mask_free(&priv->scroll_events_mask);
+#endif
     free(pInfo->private);
     pInfo->private = NULL;
     xf86DeleteInput(pInfo, 0);
@@ -931,6 +936,12 @@ static void InitAxesLabels(Atom *labels, int nlabels)
     switch(nlabels)
     {
         default:
+#ifdef HAVE_SMOOTH_SCROLL
+        case 4:
+            labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL);
+        case 3:
+            labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL);
+#endif
         case 2:
             labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
         case 1:
@@ -973,11 +984,16 @@ DeviceInit(DeviceIntPtr dev)
     unsigned char map[SYN_MAX_BUTTONS + 1];
     int i;
     int min, max;
+    int num_axes = 2;
     Atom btn_labels[SYN_MAX_BUTTONS] = { 0 };
-    Atom axes_labels[2] = { 0 };
+    Atom axes_labels[4] = { 0 };
     DeviceVelocityPtr pVel;
 
-    InitAxesLabels(axes_labels, 2);
+#ifdef HAVE_SMOOTH_SCROLL
+    num_axes += 2;
+#endif
+
+    InitAxesLabels(axes_labels, num_axes);
     InitButtonLabels(btn_labels, SYN_MAX_BUTTONS);
 
     DBG(3, "Synaptics DeviceInit called\n");
@@ -992,7 +1008,7 @@ DeviceInit(DeviceIntPtr dev)
                             btn_labels,
 			    SynapticsCtrl,
 			    GetMotionHistorySize(),
-                            2,
+                            num_axes,
                             axes_labels);
 
     /*
@@ -1074,6 +1090,21 @@ DeviceInit(DeviceIntPtr dev)
             );
     xf86InitValuatorDefaults(dev, 1);
 
+#ifdef HAVE_SMOOTH_SCROLL
+    xf86InitValuatorAxisStruct(dev, 2, axes_labels[2], 0, -1, 0, 0, 0,
+                               Relative);
+    priv->scroll_axis_horiz = 2;
+    xf86InitValuatorAxisStruct(dev, 3, axes_labels[3], 0, -1, 0, 0, 0,
+                               Relative);
+    priv->scroll_axis_vert = 3;
+    priv->scroll_events_mask = valuator_mask_new(MAX_VALUATORS);
+    if (!priv->scroll_events_mask)
+        return !Success;
+
+    SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL, 1, 0);
+    SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL, 1, 0);
+#endif
+
     if (!alloc_shm_data(pInfo))
 	return !Success;
 
@@ -2393,6 +2424,26 @@ post_scroll_events(const InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
 
+#ifdef HAVE_SMOOTH_SCROLL
+    valuator_mask_zero(priv->scroll_events_mask);
+
+    if (priv->scroll.delta_y != 0.0)
+    {
+        valuator_mask_set_double(priv->scroll_events_mask,
+                                 priv->scroll_axis_vert,
+                                 priv->scroll.delta_y);
+        priv->scroll.delta_y = 0;
+    }
+    if (priv->scroll.delta_x != 0.0)
+    {
+        valuator_mask_set_double(priv->scroll_events_mask,
+                                 priv->scroll_axis_horiz,
+                                 priv->scroll.delta_x);
+        priv->scroll.delta_x = 0;
+    }
+    if (valuator_mask_num_valuators(priv->scroll_events_mask))
+        xf86PostMotionEventM(pInfo->dev, FALSE, priv->scroll_events_mask);
+#else
     while (priv->scroll.delta_y <= -1.0)
     {
         post_button_click(pInfo, 4);
@@ -2416,6 +2467,7 @@ post_scroll_events(const InputInfoPtr pInfo)
         post_button_click(pInfo, 7);
         priv->scroll.delta_x -= 1.0;
     }
+#endif
 }
 
 static inline int
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 1f6dc08..1ec8246 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -23,6 +23,7 @@
 #define _SYNAPTICSSTR_H_
 
 #include "synproto.h"
+#include <xserver-properties.h>
 
 #ifdef DBG
 #  undef DBG
@@ -39,6 +40,10 @@
 #define xf86IDrvMsg(pInfo, type, ...) xf86Msg(type, __VA_ARGS__)
 #endif
 
+#ifdef AXIS_LABEL_PROP_REL_VSCROLL
+#define HAVE_SMOOTH_SCROLL
+#endif
+
 /******************************************************************************
  *		Definitions
  *					structs, typedefs, #defines, enums
@@ -254,6 +259,12 @@ typedef struct _SynapticsPrivateRec
     enum TouchpadModel model;		/* The detected model */
     unsigned short id_vendor;		/* vendor id */
     unsigned short id_product;		/* product id */
+
+#ifdef HAVE_SMOOTH_SCROLL
+    int scroll_axis_horiz;              /* Horizontal smooth-scrolling axis */
+    int scroll_axis_vert;               /* Vertical smooth-scrolling axis */
+    ValuatorMask *scroll_events_mask;   /* ValuatorMask for smooth-scrolling */
+#endif
 } SynapticsPrivate;
 
 #endif /* _SYNAPTICSSTR_H_ */

commit 15bef1f7092d37aeaa916ed7642ae3b6e684660c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Oct 21 16:52:57 2011 +1000

    eventcomm: print strerror(errno), not of rc
    
    Found by coverity.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index e0a6965..cd08f13 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -227,7 +227,7 @@ event_get_abs(InputInfoPtr pInfo, int fd, int code,
     SYSCALL(rc = ioctl(fd, EVIOCGABS(code), &abs));
     if (rc < 0) {
 	xf86IDrvMsg(pInfo, X_ERROR, "%s EVIOCGABS error on %d (%s)\n",
-		    __func__, code, strerror(rc));
+		    __func__, code, strerror(errno));
 	return errno;
     }
 

commit cefc85ad44af340b3d2cad76ec1dc54ceba0558f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Oct 18 15:46:57 2011 +1000

    Fix compiler warning - unused variable 'para'
    
    synaptics.c: In function 'post_scroll_events':
    synaptics.c:2426:26: warning: unused variable 'para' [-Wunused-variable]
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index d0e9bb4..cea52a6 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2392,7 +2392,6 @@ static void
 post_scroll_events(const InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
-    SynapticsParameters *para = &priv->synpara;
 
     while (priv->scroll.delta_y <= -1.0)
     {

commit 26831a6eeac6762ad4d99532f62ebbab0827de10
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Thu Jun 9 20:03:10 2011 +0100

    Scroll: Prepare ScrollData for smooth scrolling
    
    Convert ScrollData from up/down/left/right members for button presses,
    to more fine-grained delta_x and delta_y members, and move these to
    priv->scroll.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index e05147e..d0e9bb4 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1941,10 +1941,6 @@ out:
     return delay;
 }
 
-struct ScrollData {
-    int left, right, up, down;
-};
-
 static double
 estimate_delta_circ(SynapticsPrivate *priv)
 {
@@ -2025,13 +2021,11 @@ stop_coasting(SynapticsPrivate *priv)
 
 static int
 HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
-		edge_type edge, Bool finger, struct ScrollData *sd)
+		edge_type edge, Bool finger)
 {
     SynapticsParameters *para = &priv->synpara;
     int delay = 1000000000;
 
-    sd->left = sd->right = sd->up = sd->down = 0;
-
     if ((priv->synpara.touchpad_off == 2) || (priv->finger_state == FS_BLOCKED)) {
 	stop_coasting(priv);
 	priv->circ_scroll_on = FALSE;
@@ -2207,96 +2201,56 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 
     if (priv->vert_scroll_edge_on || priv->vert_scroll_twofinger_on) {
 	/* + = down, - = up */
-	int delta = para->scroll_dist_vert;
-	if (delta > 0) {
-	    while (hw->y - priv->scroll.last_y > delta) {
-		sd->down++;
-		priv->scroll.last_y += delta;
-	    }
-	    while (hw->y - priv->scroll.last_y < -delta) {
-		sd->up++;
-		priv->scroll.last_y -= delta;
-	    }
+	double delta = para->scroll_dist_vert;
+	if (delta > 0 && hw->y != priv->scroll.last_y) {
+	    priv->scroll.delta_y += (hw->y - priv->scroll.last_y) / delta;
+	    priv->scroll.last_y = hw->y;
 	}
     }
     if (priv->horiz_scroll_edge_on || priv->horiz_scroll_twofinger_on) {
 	/* + = right, - = left */
-	int delta = para->scroll_dist_horiz;
-	if (delta > 0) {
-	    while (hw->x - priv->scroll.last_x > delta) {
-		sd->right++;
-		priv->scroll.last_x += delta;
-	    }
-	    while (hw->x - priv->scroll.last_x < -delta) {
-		sd->left++;
-		priv->scroll.last_x -= delta;
-	    }
+	double delta = para->scroll_dist_horiz;
+	if (delta > 0 && hw->x != priv->scroll.last_x) {
+	    priv->scroll.delta_x += (hw->x - priv->scroll.last_x) / delta;
+	    priv->scroll.last_x = hw->x;
 	}
     }
     if (priv->circ_scroll_on) {
 	/* + = counter clockwise, - = clockwise */
 	double delta = para->scroll_dist_circ;
-	if (delta >= 0.005) {
-	    while (diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) > delta) {
-		if (priv->circ_scroll_vert)
-		    sd->up++;
-		else
-		    sd->right++;
-		priv->scroll.last_a += delta;
-		if (priv->scroll.last_a > M_PI)
-		    priv->scroll.last_a -= 2 * M_PI;
-	    }
-	    while (diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) < -delta) {
-		if (priv->circ_scroll_vert)
-		    sd->down++;
-		else
-		    sd->left++;
-		priv->scroll.last_a -= delta;
-		if (priv->scroll.last_a < -M_PI)
-		    priv->scroll.last_a += 2 * M_PI;
-	    }
-	}
+	double diff = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
+	if (delta >= 0.005 && diff != 0.0) {
+	    if (priv->circ_scroll_vert)
+		priv->scroll.delta_y += diff / delta;
+	    else
+		priv->scroll.delta_x += diff / delta;
+	    priv->scroll.last_a = angle(priv, hw->x, hw->y);
+        }
     }
 
     if (priv->scroll.coast_speed_y) {
 	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
 	double ddy = para->coasting_friction * dtime;
-	priv->scroll.coast_delta_y += priv->scroll.coast_speed_y * dtime;
+	priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
 	delay = MIN(delay, POLL_MS);
-	while (priv->scroll.coast_delta_y > 1.0) {
-	    sd->down++;
-	    priv->scroll.coast_delta_y -= 1.0;
-	}
-	while (priv->scroll.coast_delta_y < -1.0) {
-	    sd->up++;
-	    priv->scroll.coast_delta_y += 1.0;
-	}
 	if (abs(priv->scroll.coast_speed_y) < ddy) {
 	    priv->scroll.coast_speed_y = 0;
 	    priv->scroll.packets_this_scroll = 0;
 	} else {
-	    priv->scroll.coast_speed_y += (priv->scroll.coast_speed_y < 0 ? ddy : -1*ddy);
+	    priv->scroll.coast_speed_y += (priv->scroll.coast_speed_y < 0 ? ddy : -ddy);
 	}
     }
 
     if (priv->scroll.coast_speed_x) {
 	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
 	double ddx = para->coasting_friction * dtime;
-	priv->scroll.coast_delta_x += priv->scroll.coast_speed_x * dtime;
+	priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
 	delay = MIN(delay, POLL_MS);
-	while (priv->scroll.coast_delta_x > 1.0) {
-	    sd->right++;
-	    priv->scroll.coast_delta_x -= 1.0;
-	}
-	while (priv->scroll.coast_delta_x < -1.0) {
-	    sd->left++;
-	    priv->scroll.coast_delta_x += 1.0;
-	}
 	if (abs(priv->scroll.coast_speed_x) < ddx) {
 	    priv->scroll.coast_speed_x = 0;
 	    priv->scroll.packets_this_scroll = 0;
 	} else {
-	    priv->scroll.coast_speed_x += (priv->scroll.coast_speed_x < 0 ? ddx : -1*ddx);
+	    priv->scroll.coast_speed_x += (priv->scroll.coast_speed_x < 0 ? ddx : -ddx);
 	}
     }
 
@@ -2435,26 +2389,40 @@ post_button_click(const InputInfoPtr pInfo, const int button)
 
 
 static void
-post_scroll_events(const InputInfoPtr pInfo, struct ScrollData scroll)
+post_scroll_events(const InputInfoPtr pInfo)
 {
-    while (scroll.up-- > 0)
+    SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
+    SynapticsParameters *para = &priv->synpara;
+
+    while (priv->scroll.delta_y <= -1.0)
+    {
         post_button_click(pInfo, 4);
+        priv->scroll.delta_y += 1.0;
+    }
 
-    while (scroll.down-- > 0)
+    while (priv->scroll.delta_y >= 1.0)
+    {
         post_button_click(pInfo, 5);
+        priv->scroll.delta_y -= 1.0;
+    }
 
-    while (scroll.left-- > 0)
+    while (priv->scroll.delta_x <= -1.0)
+    {
         post_button_click(pInfo, 6);
+        priv->scroll.delta_x += 1.0;
+    }
 
-    while (scroll.right-- > 0)
+    while (priv->scroll.delta_x >= 1.0)
+    {
         post_button_click(pInfo, 7);
+        priv->scroll.delta_x -= 1.0;
+    }
 }
 
 static inline int
 repeat_scrollbuttons(const InputInfoPtr pInfo,
                      const struct SynapticsHwState *hw,
-		     int buttons, CARD32 now, int delay,
-		     struct ScrollData *sd)
+		     int buttons, CARD32 now, int delay)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     SynapticsParameters *para = &priv->synpara;
@@ -2492,13 +2460,13 @@ repeat_scrollbuttons(const InputInfoPtr pInfo,
 		id = ffs(change);
 		change &= ~(1 << (id - 1));
 		if (id == 4)
-		    sd->up++;
+		    priv->scroll.delta_y -= 1.0;
 		else if (id == 5)
-		    sd->down++;
+		    priv->scroll.delta_y += 1.0;
 		else if (id == 6)
-		    sd->left++;
+		    priv->scroll.delta_x -= 1.0;
 		else if (id == 7)
-		    sd->right++;
+		    priv->scroll.delta_x += 1.0;
 	    }
 
 	    priv->nextRepeat = now + repeat_delay;
@@ -2529,7 +2497,6 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     int dx, dy, buttons, id;
     edge_type edge = NO_EDGE;
     int change;
-    struct ScrollData scroll;
     int double_click = FALSE;
     int delay = 1000000000;
     int timeleft;
@@ -2594,8 +2561,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     if (inside_active_area)
     {
 	/* Don't bother about scrolling in the dead area of the touchpad. */
-	timeleft = HandleScrolling(priv, hw, edge, (finger >= FS_TOUCHED),
-				   &scroll);
+	timeleft = HandleScrolling(priv, hw, edge, (finger >= FS_TOUCHED));
 	if (timeleft > 0)
 	    delay = MIN(delay, timeleft);
 
@@ -2663,15 +2629,14 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     }
 
     if (priv->has_scrollbuttons)
-	delay = repeat_scrollbuttons(pInfo, hw, buttons, now, delay, &scroll);
+	delay = repeat_scrollbuttons(pInfo, hw, buttons, now, delay);
 
     /* Process scroll events only if coordinates are
      * in the Synaptics Area
      */
     if (inside_active_area &&
-        (scroll.down != 0 || scroll.up != 0 || scroll.left != 0 ||
-         scroll.right != 0)) {
-	post_scroll_events(pInfo, scroll);
+        (priv->scroll.delta_x != 0.0 || priv->scroll.delta_y != 0.0)) {
+	post_scroll_events(pInfo);
 	priv->scroll.last_millis = hw->millis;
     }
 
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 5469b0c..1f6dc08 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -196,6 +196,8 @@ typedef struct _SynapticsPrivateRec
     struct {
         int last_x;			/* last x-scroll position */
         int last_y;			/* last y-scroll position */
+        double delta_x;			/* accumulated horiz scroll delta */
+        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 */

commit 7c0361d4ec6b1f1325cb6551d0ee2e7f5cfae15b
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Thu Jun 9 20:03:05 2011 +0100

    Adjust acceleration scheme for input ABI v14
    
    v14 wants doubles, rather than floats, from acceleration schemes.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index c44d1f7..e05147e 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -593,11 +593,22 @@ static void set_default_parameters(InputInfoPtr pInfo)
     }
 }
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
+static double SynapticsAccelerationProfile(DeviceIntPtr dev,
+                                           DeviceVelocityPtr vel,
+                                           double velocity,
+                                           double thr,
+                                           double acc) {
+#else
 static float SynapticsAccelerationProfile(DeviceIntPtr dev,
                                           DeviceVelocityPtr vel,
-                                          float velocity,
-                                          float thr,
-                                          float acc) {
+                                          float velocity_f,
+                                          float thr_f,
+                                          float acc_f) {
+    double velocity = velocity_f;
+    double thr = thr_f;
+    double acc = acc_f;
+#endif
     InputInfoPtr pInfo = dev->public.devicePrivate;
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     SynapticsParameters* para = &priv->synpara;

commit a15af628154ac37f24896a30614f3be6ecdb65c4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Oct 12 11:20:06 2011 +1000

    test: wrap ABI 14 xf86OptionRec type changes
    
    ABI 13 still uses pointer as type for most option calls, ABI 14 uses the
    proper type now. Wrap this so we can build against both versions.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index 71c3bc5..a312aa0 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -26,7 +26,7 @@ xf86WaitForInput (int fd, int timeout)
 }
 
 _X_EXPORT int
-xf86OpenSerial (pointer options)
+xf86OpenSerial (OPTTYPE options)
 {
     return 0;
 }
@@ -37,43 +37,43 @@ xf86SetSerialSpeed (int fd, int speed)
     return 0;
 }
 
-_X_EXPORT pointer
-xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
+_X_EXPORT OPTTYPE
+xf86ReplaceIntOption(OPTTYPE optlist, const char *name, const int val)
 {
     return NULL;
 }
 
 _X_EXPORT char *
-xf86SetStrOption(pointer optlist, const char *name, char *deflt)
+xf86SetStrOption(OPTTYPE optlist, const char *name, char *deflt)
 {
     return NULL;
 }
 
 _X_EXPORT int
-xf86SetBoolOption(pointer optlist, const char *name, int deflt)
+xf86SetBoolOption(OPTTYPE optlist, const char *name, int deflt)
 {
     return 0;
 }
 
-_X_EXPORT pointer
-xf86AddNewOption(pointer head, const char *name, const char *val)
+_X_EXPORT OPTTYPE
+xf86AddNewOption(OPTTYPE head, const char *name, const char *val)
 {
     return NULL;
 }
 _X_EXPORT char *
-xf86FindOptionValue(pointer options, const char *name)
+xf86FindOptionValue(OPTTYPE options, const char *name)
 {


Reply to: