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

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



 configure.ac               |    3 
 include/evdev-properties.h |    4 
 man/evdev.man              |   21 +
 src/Makefile.am            |    4 
 src/apple.c                |    3 
 src/emuWheel.c             |   14 
 src/evdev.c                |  741 +++++++++++++++++++++++----------------------
 src/evdev.h                |   21 -
 8 files changed, 429 insertions(+), 382 deletions(-)

New commits:
commit 5d239ceb260cd554245e8f0dc3627990726ea9b9
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 15 08:41:06 2014 +1000

    evdev 2.9.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 7bc0ed3..1325424 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.8.99.1],
+        [2.9.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 13dea90bc8ef2a2e6f55fb5ff5f54afe41d22f95
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue May 6 09:20:05 2014 +1000

    Use the server's device list for duplicate detection (#78309)
    
    EvdevAddDevice/EvdevRemoveDevice keep a reference to the device to detect
    duplicate devices based on the dev_t.
    
    EvdevAddDevices was called during PreInit, EvdevRemoveDevice was called during
    DEVICE_CLOSE. That makes it imbalanced if the device succeeds PreInit but the
    server skips everything else because MAX_DEVICES is exceeded. So for all
    devices after MAX_DEVICES, we'd add a reference but never remove it,
    eventually reading/writing past evdev_devices.
    
    The server keeps the list of devices for us anyway, so remove the copy of all
    the pointers and instead run through the device list the server gives us.
    
    X.Org Bug 78309 <http://bugs.freedesktop.org/show_bug.cgi?id=78309>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev.c b/src/evdev.c
index 6175015..30f809b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -68,11 +68,6 @@
 /* removed from server, purge when dropping support for server 1.10 */
 #define XI86_SEND_DRAG_EVENTS   0x08
 
-#ifndef MAXDEVICES
-#include <inputstr.h> /* for MAX_DEVICES */
-#define MAXDEVICES MAX_DEVICES
-#endif
-
 #define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
 
 #define MIN_KEYCODE 8
@@ -146,11 +141,6 @@ static Atom prop_device;
 static Atom prop_virtual;
 static Atom prop_scroll_dist;
 
-/* All devices the evdev driver has allocated and knows about.
- * MAXDEVICES is safe as null-terminated array, as two devices (VCP and VCK)
- * cannot be used by evdev, leaving us with a space of 2 at the end. */
-static EvdevPtr evdev_devices[MAXDEVICES] = {NULL};
-
 static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
 {
     InputInfoPtr pInfo;
@@ -216,58 +206,23 @@ static BOOL
 EvdevIsDuplicate(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = pInfo->private;
-    EvdevPtr* dev   = evdev_devices;
+    InputInfoPtr d;
 
-    if (pEvdev->min_maj)
+    nt_list_for_each_entry(d, xf86FirstLocalDevice(), next)
     {
-        while(*dev)
-        {
-            if ((*dev) != pEvdev &&
-                (*dev)->min_maj &&
-                (*dev)->min_maj == pEvdev->min_maj)
-                return TRUE;
-            dev++;
-        }
-    }
-    return FALSE;
-}
+        EvdevPtr e;
 
-/**
- * Add to internal device list.
- */
-static void
-EvdevAddDevice(InputInfoPtr pInfo)
-{
-    EvdevPtr pEvdev = pInfo->private;
-    EvdevPtr* dev = evdev_devices;
-
-    while(*dev)
-        dev++;
-
-    *dev = pEvdev;
-}
-
-/**
- * Remove from internal device list.
- */
-static void
-EvdevRemoveDevice(InputInfoPtr pInfo)
-{
-    EvdevPtr pEvdev = pInfo->private;
-    EvdevPtr *dev   = evdev_devices;
-    int count       = 0;
+        if (strcmp(d->drv->driverName, "evdev") != 0)
+            continue;
 
-    while(*dev)
-    {
-        count++;
-        if (*dev == pEvdev)
-        {
-            memmove(dev, dev + 1,
-                    sizeof(evdev_devices) - (count * sizeof(EvdevPtr)));
-            break;
-        }
-        dev++;
+        e = (EvdevPtr)d->private;
+        if (e != pEvdev &&
+            e->min_maj &&
+            e->min_maj == pEvdev->min_maj)
+            return TRUE;
     }
+
+    return FALSE;
 }
 
 static BOOL
@@ -2026,7 +1981,6 @@ EvdevProc(DeviceIntPtr device, int what)
 	xf86IDrvMsg(pInfo, X_INFO, "Close\n");
         EvdevCloseDevice(pInfo);
         EvdevFreeMasks(pEvdev);
-        EvdevRemoveDevice(pInfo);
         pEvdev->min_maj = 0;
 	break;
 
@@ -2659,8 +2613,6 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
                                          pInfo->type_name);
     pInfo->type_name = pEvdev->type_name;
 
-    EvdevAddDevice(pInfo);
-
     if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
     {
         EvdevMBEmuPreInit(pInfo);

commit b25d71616557b0f3fc5e1ca65ba9e62809d14139
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Apr 29 10:20:42 2014 +1000

    evdev 2.8.99.1
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 2504ec3..7bc0ed3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.8.99],
+        [2.8.99.1],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 41cf9212d02c1d2adca0e85702a1f0faba9e6b37
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Apr 28 12:23:18 2014 +1000

    Map REL_DIAL to horizontal scrolling (#73105)
    
    This was the original behavior introduced in
    f77410e1f97d394e98c854fd174f712666b0544c and stayed that way until smooth
    scrolling erroneously added it as vertical axis in
    b450efdf95999cad08de23ce069f04a66bdae24b. Revert to horizontal scrolling to
    restore the previous behaviour - which unbreaks scrolling on Microsoft mice.
    
    This effectively reverts 54a3120e339e55fc4721543abb15692c3e9ede09 too.
    
    X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index ed84f0f..6175015 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1574,8 +1574,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_VERTICAL,
-                              -pEvdev->smoothScroll.dial_delta,
+                              SCROLL_TYPE_HORIZONTAL,
+                              pEvdev->smoothScroll.dial_delta,
                               SCROLL_FLAG_NONE);
         }
     }
@@ -1652,8 +1652,8 @@ EvdevSetScrollValuators(DeviceIntPtr device)
 
     axnum = pEvdev->rel_axis_map[REL_DIAL];
     if (axnum != -1) {
-        SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
-                          -pEvdev->smoothScroll.dial_delta,
+        SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
+                          pEvdev->smoothScroll.dial_delta,
                           SCROLL_FLAG_NONE);
     }
 

commit 75368052b57aa07252e26642315bcf9a0b2e78eb
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Apr 29 09:50:21 2014 +1000

    Revert "Map REL_DIAL to horizontal scrolling (#73105)"
    
    Whoops, the vertical axis is swapped, so when changing the axis we also need
    to change the direction.
    
    This reverts commit 16c85cbeacb721ed365c6240aabaad921b811fe0.

diff --git a/src/evdev.c b/src/evdev.c
index 6d02bdd..ed84f0f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1574,7 +1574,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_HORIZONTAL,
+                              SCROLL_TYPE_VERTICAL,
                               -pEvdev->smoothScroll.dial_delta,
                               SCROLL_FLAG_NONE);
         }
@@ -1652,7 +1652,7 @@ EvdevSetScrollValuators(DeviceIntPtr device)
 
     axnum = pEvdev->rel_axis_map[REL_DIAL];
     if (axnum != -1) {
-        SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
+        SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
                           -pEvdev->smoothScroll.dial_delta,
                           SCROLL_FLAG_NONE);
     }

commit 16c85cbeacb721ed365c6240aabaad921b811fe0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Apr 28 12:23:18 2014 +1000

    Map REL_DIAL to horizontal scrolling (#73105)
    
    This was the original behavior introduced in
    f77410e1f97d394e98c854fd174f712666b0544c and stayed that way until smooth
    scrolling erroneously added it as vertical axis in
    b450efdf95999cad08de23ce069f04a66bdae24b. Revert to horizontal scrolling to
    restore the previous behaviour - which unbreaks scrolling on Microsoft mice.
    
    This effectively reverts 54a3120e339e55fc4721543abb15692c3e9ede09 too.
    
    X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev.c b/src/evdev.c
index ed84f0f..6d02bdd 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1574,7 +1574,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_VERTICAL,
+                              SCROLL_TYPE_HORIZONTAL,
                               -pEvdev->smoothScroll.dial_delta,
                               SCROLL_FLAG_NONE);
         }
@@ -1652,7 +1652,7 @@ EvdevSetScrollValuators(DeviceIntPtr device)
 
     axnum = pEvdev->rel_axis_map[REL_DIAL];
     if (axnum != -1) {
-        SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+        SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
                           -pEvdev->smoothScroll.dial_delta,
                           SCROLL_FLAG_NONE);
     }

commit ae67f64f02434171e1828b00fbf4277c8166966e
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sat Mar 8 10:28:00 2014 +0100

    evdev: Add support for server managed fds
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index d1ed9ee..ed84f0f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -97,6 +97,10 @@
 #define ABS_MT_TRACKING_ID 0x39
 #endif
 
+#ifndef XI86_SERVER_FD
+#define XI86_SERVER_FD 0x20
+#endif
+
 static const char *evdevDefaults[] = {
     "XkbRules",     "evdev",
     "XkbModel",     "pc104", /* the right model for 'us' */
@@ -2478,32 +2482,32 @@ EvdevOpenDevice(InputInfoPtr pInfo)
         xf86IDrvMsg(pInfo, X_CONFIG, "Device: \"%s\"\n", device);
     }
 
-    if (pInfo->fd < 0)
+    if (!(pInfo->flags & XI86_SERVER_FD) && pInfo->fd < 0)
     {
         do {
             pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
         } while (pInfo->fd < 0 && errno == EINTR);
+    }
 
-        if (pInfo->fd < 0) {
-            xf86IDrvMsg(pInfo, X_ERROR, "Unable to open evdev device \"%s\".\n", device);
-            return BadValue;
-        }
+    if (pInfo->fd < 0) {
+        xf86IDrvMsg(pInfo, X_ERROR, "Unable to open evdev device \"%s\".\n", device);
+        return BadValue;
+    }
 
-        if (libevdev_get_fd(pEvdev->dev) != -1) {
-            struct input_event ev;
+    if (libevdev_get_fd(pEvdev->dev) != -1) {
+        struct input_event ev;
 
-            libevdev_change_fd(pEvdev->dev, pInfo->fd);
-            /* re-sync libevdev's view of the device, but
-               we don't care about the actual events here */
-            libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
-            while (libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev) == LIBEVDEV_READ_STATUS_SYNC)
-                ;
-        } else {
-            int rc = libevdev_set_fd(pEvdev->dev, pInfo->fd);
-            if (rc < 0) {
-                xf86IDrvMsg(pInfo, X_ERROR, "Unable to query fd: %s\n", strerror(-rc));
-                return BadValue;
-            }
+        libevdev_change_fd(pEvdev->dev, pInfo->fd);
+        /* re-sync libevdev's view of the device, but
+           we don't care about the actual events here */
+        libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
+        while (libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev) == LIBEVDEV_READ_STATUS_SYNC)
+            ;
+    } else {
+        int rc = libevdev_set_fd(pEvdev->dev, pInfo->fd);
+        if (rc < 0) {
+            xf86IDrvMsg(pInfo, X_ERROR, "Unable to query fd: %s\n", strerror(-rc));
+            return BadValue;
         }
     }
 
@@ -2531,7 +2535,7 @@ static void
 EvdevCloseDevice(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = pInfo->private;
-    if (pInfo->fd >= 0)
+    if (!(pInfo->flags & XI86_SERVER_FD) && pInfo->fd >= 0)
     {
         close(pInfo->fd);
         pInfo->fd = -1;
@@ -2679,7 +2683,10 @@ _X_EXPORT InputDriverRec EVDEV = {
     EvdevPreInit,
     EvdevUnInit,
     NULL,
-    evdevDefaults
+    evdevDefaults,
+#ifdef XI86_DRV_CAP_SERVER_FD
+    XI86_DRV_CAP_SERVER_FD
+#endif
 };
 
 static void

commit f6fcad8b107e834e26fb3da2c89e05294ff0a74c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 26 14:56:07 2013 +1000

    Fix wheel emulation for absolute device (#68415)
    
    wheel emulation, for some reasons beyond time, got the value from
    pEvdev->vals, then set the value back into pEvdev->vals. Alas, that value is
    always 0, hence oldValue is zero and the delta is nil.
    
    If we're not in relative (touchpad) mode, store the current value in
    old_vals, so they're retrievable for the next event.
    
    X.Org Bug 68415 <http://bugs.freedesktop.org/show_bug.cgi?id=68415>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/emuWheel.c b/src/emuWheel.c
index c0e92b1..04487cf 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -97,7 +97,6 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
     EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
     WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
     int value = pEv->value;
-    int oldValue;
 
     /* Has wheel emulation been configured to be enabled? */
     if (!pEvdev->emulateWheel.enabled)
@@ -117,9 +116,13 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
 
 	if(pEv->type == EV_ABS) {
 	    int axis = pEvdev->abs_axis_map[pEv->code];
-	    oldValue = valuator_mask_get(pEvdev->vals, axis);
-	    valuator_mask_set(pEvdev->vals, axis, value);
-	    value -= oldValue; /* make value into a differential measurement */
+	    int oldValue;
+
+	    if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
+		valuator_mask_set(pEvdev->vals, axis, value);
+		value -= oldValue; /* make value into a differential measurement */
+	    } else
+                value = 0; /* avoid a jump on the first touch */
 	}
 
 	switch(pEv->code) {
diff --git a/src/evdev.c b/src/evdev.c
index c2ce29d..d1ed9ee 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -483,31 +483,39 @@ EvdevProcessValuators(InputInfoPtr pInfo)
     EvdevPtr pEvdev = pInfo->private;
     int *delta = pEvdev->delta;
 
-    /* convert to relative motion for touchpads */
-    if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
-        if (pEvdev->in_proximity) {
-            if (valuator_mask_isset(pEvdev->vals, 0))
-            {
-                if (valuator_mask_isset(pEvdev->old_vals, 0))
-                    delta[REL_X] = valuator_mask_get(pEvdev->vals, 0) -
-                                   valuator_mask_get(pEvdev->old_vals, 0);
-                valuator_mask_set(pEvdev->old_vals, 0,
-                                  valuator_mask_get(pEvdev->vals, 0));
-            }
-            if (valuator_mask_isset(pEvdev->vals, 1))
-            {
-                if (valuator_mask_isset(pEvdev->old_vals, 1))
-                    delta[REL_Y] = valuator_mask_get(pEvdev->vals, 1) -
-                                   valuator_mask_get(pEvdev->old_vals, 1);
-                valuator_mask_set(pEvdev->old_vals, 1,
-                                  valuator_mask_get(pEvdev->vals, 1));
+    if (pEvdev->abs_queued) {
+        /* convert to relative motion for touchpads */
+        if (pEvdev->flags & EVDEV_RELATIVE_MODE) {
+            if (pEvdev->in_proximity) {
+                if (valuator_mask_isset(pEvdev->vals, 0))
+                {
+                    if (valuator_mask_isset(pEvdev->old_vals, 0))
+                        delta[REL_X] = valuator_mask_get(pEvdev->vals, 0) -
+                            valuator_mask_get(pEvdev->old_vals, 0);
+                    valuator_mask_set(pEvdev->old_vals, 0,
+                            valuator_mask_get(pEvdev->vals, 0));
+                }
+                if (valuator_mask_isset(pEvdev->vals, 1))
+                {
+                    if (valuator_mask_isset(pEvdev->old_vals, 1))
+                        delta[REL_Y] = valuator_mask_get(pEvdev->vals, 1) -
+                            valuator_mask_get(pEvdev->old_vals, 1);
+                    valuator_mask_set(pEvdev->old_vals, 1,
+                            valuator_mask_get(pEvdev->vals, 1));
+                }
+            } else {
+                valuator_mask_zero(pEvdev->old_vals);
             }
+            valuator_mask_zero(pEvdev->vals);
+            pEvdev->abs_queued = 0;
+            pEvdev->rel_queued = 1;
         } else {
-            valuator_mask_zero(pEvdev->old_vals);
+            int val;
+            if (valuator_mask_fetch(pEvdev->vals, 0, &val))
+                valuator_mask_set(pEvdev->old_vals, 0, val);
+            if (valuator_mask_fetch(pEvdev->vals, 1, &val))
+                valuator_mask_set(pEvdev->old_vals, 1, val);
         }
-        valuator_mask_zero(pEvdev->vals);
-        pEvdev->abs_queued = 0;
-        pEvdev->rel_queued = 1;
     }
 
     if (pEvdev->rel_queued) {

commit d171b3d9194581cb6ed59dbe45d6cbf009dc0eaa
Author: Peter De Wachter <pdewacht@gmail.com>
Date:   Wed Oct 3 22:08:12 2012 +0200

    Export smooth scroll settings as an XInput property.
    
    A new property "Evdev Scrolling Distance" is created that holds three values
    (vertical, horizontal and dial).
    
    Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/include/evdev-properties.h b/include/evdev-properties.h
index 745a1ba..8ae5ba3 100644
--- a/include/evdev-properties.h
+++ b/include/evdev-properties.h
@@ -87,4 +87,8 @@
 */
 #define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
 
+/* Smooth scroll */
+/* INT32, 3 values (vertical, horizontal, dial) */
+#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
+
 #endif
diff --git a/man/evdev.man b/man/evdev.man
index 85cea10..06613fc 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -229,14 +229,15 @@ need quirks.
 .TP 7
 .BI "Option \*qVertScrollDelta\*q \*q" integer \*q
 The amount of motion considered one unit of scrolling vertically.
-Default: "1".
+Default: "1".  Property: "Evdev Scrolling Distance".
 .TP 7
 .BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
 The amount of motion considered one unit of scrolling horizontally.
-Default: "1".
+Default: "1".  Property: "Evdev Scrolling Distance".
 .TP 7
 .BI "Option \*qDialDelta\*q \*q" integer \*q
 The amount of motion considered one unit of turning the dial.  Default: "1".
+Property: "Evdev Scrolling Distance".
 
 .SH SUPPORTED PROPERTIES
 The following properties are provided by the
@@ -277,6 +278,9 @@ value.
 .TP 7
 .BI "Evdev Wheel Emulation Timeout"
 1 16-bit positive value.
+.TP 7
+.BI "Evdev Scrolling Distance"
+3 32-bit values: vertical, horizontal and dial.
 
 .SH AUTHORS
 Kristian Høgsberg, Peter Hutterer
diff --git a/src/evdev.c b/src/evdev.c
index 812b177..c2ce29d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -140,6 +140,7 @@ static Atom prop_axis_label;
 static Atom prop_btn_label;
 static Atom prop_device;
 static Atom prop_virtual;
+static Atom prop_scroll_dist;
 
 /* All devices the evdev driver has allocated and knows about.
  * MAXDEVICES is safe as null-terminated array, as two devices (VCP and VCK)
@@ -1620,6 +1621,42 @@ out:
 }
 
 static int
+EvdevSetScrollValuators(DeviceIntPtr device)
+{
+#ifdef HAVE_SMOOTH_SCROLLING
+    InputInfoPtr pInfo;
+    EvdevPtr pEvdev;
+    int axnum;
+
+    pInfo = device->public.devicePrivate;
+    pEvdev = pInfo->private;
+
+    axnum = pEvdev->rel_axis_map[REL_WHEEL];
+    if (axnum != -1) {
+        SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+                          -pEvdev->smoothScroll.vert_delta,
+                          SCROLL_FLAG_PREFERRED);
+    }
+
+    axnum = pEvdev->rel_axis_map[REL_DIAL];
+    if (axnum != -1) {
+        SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+                          -pEvdev->smoothScroll.dial_delta,
+                          SCROLL_FLAG_NONE);
+    }
+
+    axnum = pEvdev->rel_axis_map[REL_HWHEEL];
+    if (axnum != -1) {
+        SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
+                          pEvdev->smoothScroll.horiz_delta,
+                          SCROLL_FLAG_NONE);
+    }
+#endif
+
+    return Success;
+}
+
+static int
 EvdevAddRelValuatorClass(DeviceIntPtr device)
 {
     InputInfoPtr pInfo;
@@ -1703,22 +1740,10 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
         xf86InitValuatorAxisStruct(device, axnum, atoms[axnum], -1, -1, 1, 0, 1,
                                    Relative);
         xf86InitValuatorDefaults(device, axnum);
-#ifdef HAVE_SMOOTH_SCROLLING
-        if (axis == REL_WHEEL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
-                              -pEvdev->smoothScroll.vert_delta,
-                              SCROLL_FLAG_PREFERRED);
-        else if (axis == REL_DIAL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
-                              -pEvdev->smoothScroll.dial_delta,
-                              SCROLL_FLAG_NONE);
-        else if (axis == REL_HWHEEL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
-                              pEvdev->smoothScroll.horiz_delta,
-                              SCROLL_FLAG_NONE);
-#endif
     }
 
+    EvdevSetScrollValuators(device);
+
     free(atoms);
 
     return Success;
@@ -2917,6 +2942,22 @@ EvdevInitProperty(DeviceIntPtr dev)
                                    PropModeReplace, pEvdev->num_buttons, atoms, FALSE);
             XISetDevicePropertyDeletable(dev, prop_btn_label, FALSE);
         }
+
+#ifdef HAVE_SMOOTH_SCROLLING
+        {
+            int smooth_scroll_values[3] = {
+                pEvdev->smoothScroll.vert_delta,
+                pEvdev->smoothScroll.horiz_delta,
+                pEvdev->smoothScroll.dial_delta
+            };
+            prop_scroll_dist = MakeAtom(EVDEV_PROP_SCROLL_DISTANCE,
+                                        strlen(EVDEV_PROP_SCROLL_DISTANCE), TRUE);
+            XIChangeDeviceProperty(dev, prop_scroll_dist, XA_INTEGER, 32,
+                                   PropModeReplace, 3, smooth_scroll_values, FALSE);
+            XISetDevicePropertyDeletable(dev, prop_scroll_dist, FALSE);
+        }
+#endif
+
     }
 
 }
@@ -2956,6 +2997,18 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
 
         if (!checkonly)
             pEvdev->swap_axes = *((BOOL*)val->data);
+    } else if (atom == prop_scroll_dist)
+    {
+        if (val->format != 32 || val->type != XA_INTEGER || val->size != 3)
+            return BadMatch;
+
+        if (!checkonly) {
+            int *data = (int *)val->data;
+            pEvdev->smoothScroll.vert_delta = data[0];
+            pEvdev->smoothScroll.horiz_delta = data[1];
+            pEvdev->smoothScroll.dial_delta = data[2];
+            EvdevSetScrollValuators(dev);
+        }
     } else if (atom == prop_axis_label || atom == prop_btn_label ||
                atom == prop_product_id || atom == prop_device ||
                atom == prop_virtual)

commit c3251deb4b988610c3766081345e49f538fca865
Author: Peter De Wachter <pdewacht@gmail.com>
Date:   Wed Oct 3 20:48:24 2012 +0200

    Add configuration options for smooth scrolling.
    
    This patch creates three new xorg.conf options, VertScrollDelta,
    HorizScrollDelta and DialDelta, which adjust the sensitivity of
    smooth scrolling. These options take a positive integer, default
    value is 1.
    
    Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/man/evdev.man b/man/evdev.man
index 220dd13..85cea10 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -226,6 +226,17 @@ Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
 There is rarely a need to use this option, evdev will guess the device type
 based on the device's capabilities. This option is provided for devices that
 need quirks.
+.TP 7
+.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
+The amount of motion considered one unit of scrolling vertically.
+Default: "1".
+.TP 7
+.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
+The amount of motion considered one unit of scrolling horizontally.
+Default: "1".
+.TP 7
+.BI "Option \*qDialDelta\*q \*q" integer \*q
+The amount of motion considered one unit of turning the dial.  Default: "1".
 
 .SH SUPPORTED PROPERTIES
 The following properties are provided by the
diff --git a/src/evdev.c b/src/evdev.c
index 1aa92d2..812b177 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1533,7 +1533,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_VERTICAL, -1.0,
+                              SCROLL_TYPE_VERTICAL,
+                              -pEvdev->smoothScroll.vert_delta,
                               SCROLL_FLAG_PREFERRED);
         }
 
@@ -1546,7 +1547,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_HORIZONTAL, 1.0,
+                              SCROLL_TYPE_HORIZONTAL,
+                              pEvdev->smoothScroll.horiz_delta,
                               SCROLL_FLAG_NONE);
         }
 
@@ -1559,7 +1561,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_VERTICAL, -1.0,
+                              SCROLL_TYPE_VERTICAL,
+                              -pEvdev->smoothScroll.dial_delta,
                               SCROLL_FLAG_NONE);
         }
     }
@@ -1702,11 +1705,17 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
         xf86InitValuatorDefaults(device, axnum);
 #ifdef HAVE_SMOOTH_SCROLLING
         if (axis == REL_WHEEL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
+            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+                              -pEvdev->smoothScroll.vert_delta,
+                              SCROLL_FLAG_PREFERRED);
         else if (axis == REL_DIAL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE);
+            SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+                              -pEvdev->smoothScroll.dial_delta,
+                              SCROLL_FLAG_NONE);
         else if (axis == REL_HWHEEL)
-            SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
+            SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
+                              pEvdev->smoothScroll.horiz_delta,
+                              SCROLL_FLAG_NONE);
 #endif
     }
 
@@ -2329,6 +2338,15 @@ EvdevProbe(InputInfoPtr pInfo)
         xf86IDrvMsg(pInfo, X_INFO, "Adding scrollwheel support\n");
         pEvdev->flags |= EVDEV_BUTTON_EVENTS;
         pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
+
+#ifdef HAVE_SMOOTH_SCROLLING
+        pEvdev->smoothScroll.vert_delta =
+            xf86SetIntOption(pInfo->options, "VertScrollDelta", 1);
+        pEvdev->smoothScroll.horiz_delta =
+            xf86SetIntOption(pInfo->options, "HorizScrollDelta", 1);
+        pEvdev->smoothScroll.dial_delta =
+            xf86SetIntOption(pInfo->options, "DialDelta", 1);
+#endif
     }
 
 out:
diff --git a/src/evdev.h b/src/evdev.h
index 563d108..520d017 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -221,6 +221,11 @@ typedef struct {
         Time                expires;     /* time of expiry */
         Time                timeout;
     } emulateWheel;
+    struct {
+        int                 vert_delta;
+        int                 horiz_delta;
+        int                 dial_delta;
+    } smoothScroll;
     /* run-time calibration */
     struct {
         int                 min_x;

commit cabed4bbb6757e55f067126965f26bb0f716fb55
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Oct 14 11:48:30 2013 +1000

    Use num_slots where appropriate
    
    This was supposed to be added in 43e270fb7a10da20ab89dd699839c1cb6df119b4, but
    got lost somehow.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index d14d08f..1aa92d2 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1342,13 +1342,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
     }
 #ifdef MULTITOUCH
     if (num_mt_axes_total > 0) {
-        int num_slots = 0;
-
-        if (pEvdev->mtdev) {
-            num_slots = pEvdev->mtdev->caps.slot.maximum -
-                          pEvdev->mtdev->caps.slot.minimum + 1;
-        } else
-            num_slots = libevdev_get_num_slots(pEvdev->dev);
+        int nslots = num_slots(pEvdev);
 
         pEvdev->num_mt_vals = num_mt_axes_total;
         pEvdev->mt_mask = valuator_mask_new(num_mt_axes_total);
@@ -1358,7 +1352,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
             goto out;
         }
 
-        pEvdev->last_mt_vals = calloc(num_slots, sizeof(ValuatorMask *));
+        pEvdev->last_mt_vals = calloc(nslots, sizeof(ValuatorMask *));
         if (!pEvdev->last_mt_vals) {
             xf86IDrvMsg(pInfo, X_ERROR,
                         "%s: failed to allocate MT last values mask array.\n",
@@ -1366,7 +1360,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
             goto out;
         }
 
-        for (i = 0; i < num_slots; i++) {
+        for (i = 0; i < nslots; i++) {
             pEvdev->last_mt_vals[i] = valuator_mask_new(num_mt_axes_total);
             if (!pEvdev->last_mt_vals[i]) {
                 xf86IDrvMsg(pInfo, X_ERROR,
@@ -1445,12 +1439,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
         int mode = pEvdev->flags & EVDEV_TOUCHPAD ?
             XIDependentTouch : XIDirectTouch;
 
-        if (pEvdev->mtdev) {
-            if (pEvdev->mtdev->caps.slot.maximum > 0)
-                num_touches = pEvdev->mtdev->caps.slot.maximum -
-                              pEvdev->mtdev->caps.slot.minimum + 1;
-        } else
-            num_touches = num_slots(pEvdev);
+        num_touches = num_slots(pEvdev);
 
         if (!InitTouchClassDeviceStruct(device, num_touches, mode,
                                         num_mt_axes_total)) {

commit d9aadfd5f05abd9a65977d9d36cbe159d6e05386
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Oct 7 09:21:57 2013 +1100

    bump to 2.8.99
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index b8a9c41..c060c3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.8.1],
+        [2.8.99],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 54a3120e339e55fc4721543abb15692c3e9ede09
Author: Peter De Wachter <pdewacht@gmail.com>
Date:   Wed Mar 20 00:35:45 2013 +0100

    Map REL_DIAL to vertical scrolling
    
    This makes the absolute axis codepath behave the same as the relative axis
    path.
    
    Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index b97b841..bafe81f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1574,7 +1574,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
                                        NO_AXIS_LIMITS, NO_AXIS_LIMITS,
                                        0, 0, 0, Relative);
             SetScrollValuator(device, pEvdev->rel_axis_map[idx],
-                              SCROLL_TYPE_HORIZONTAL, 1.0,
+                              SCROLL_TYPE_VERTICAL, -1.0,
                               SCROLL_FLAG_NONE);
         }
     }

commit 164c62a97591d4c9b649460e7442977ea82ac02b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed May 29 07:17:41 2013 +1000

    Use libevdev as backend
    
    Removes the need to ioctl manually and check bits, with all the dangers that
    come with that. libevdev is much better prepared for invalid values, OOB
    checks, etc.
    
    Plus, we get almost free SYN_DROPPED handling as well which we didn't have
    before.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/configure.ac b/configure.ac
index b8a9c41..2953d15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,7 @@ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
 PKG_CHECK_MODULES(UDEV, libudev)
 
 PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
+PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
 
 if test "x$HAVE_XI22" = xyes; then
         # Obtain compiler/linker options for mtdev
diff --git a/src/Makefile.am b/src/Makefile.am
index da76540..5e0c3b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,11 +26,11 @@
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
 
 AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
-AM_CPPFLAGS =-I$(top_srcdir)/include
+AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
 
 @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
 @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
-@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS)
+@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
 @DRIVER_NAME@_drv_ladir = @inputdir@
 
 @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
diff --git a/src/apple.c b/src/apple.c
index 8e00a84..71f1dc3 100644
--- a/src/apple.c
+++ b/src/apple.c
@@ -303,7 +303,8 @@ EvdevAppleInitProperty(DeviceIntPtr dev)
     enum fkeymode fkeymode;
 
     if (!product_check(apple_keyboard_table,
-                       pEvdev->id_vendor, pEvdev->id_product))


Reply to: