configure.ac   |    2 +-
 man/evdev.man  |   13 +++++++++++++
 src/emuWheel.c |   13 +++----------
 src/evdev.c    |   20 +++++++++++++++++---
 4 files changed, 34 insertions(+), 14 deletions(-)

New commits:
commit f12eca9f8392934031cb250e7a2a5ed1d5ca11cf
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Apr 29 09:13:35 2016 +1000

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

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

commit 33dc3d7128456d51b1fe6228096e6b714a3e900b
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Wed Apr 27 09:01:16 2016 +1000

    Prevent buffer overrun accessing btn_labels
    
    We go up to BTN_JOYSTICK, hence group can have a value of up to including 
15.
    The actual btn_labels only has 6 elements though.
    
    Found by coverity.
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 0fcb0bb..2c88343 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2790,6 +2790,9 @@ static void EvdevInitButtonLabels(EvdevPtr pEvdev, int 
natoms, Atom *atoms)
         int group = (button % 0x100)/16;
         int idx = button - ((button/16) * 16);
 
+        if (group >= ArrayLength(btn_labels))
+            break;
+
         if (!libevdev_has_event_code(pEvdev->dev, EV_KEY, button))
             continue;
 

commit 7b0a65d989117d1b071101221ff1b97c1b4d1946
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Jan 15 14:01:02 2016 +1000

    Don't reset the other axis on wheel emulation scroll buildup
    
    The idea was that of a direction lock: as we move vertically we should not
    build up any horizontal scroll motion even if we move slightly diagonally.
    
    The effect was though that the axis would be reset completely as soon as an
    event from the other axis occured. With the default threshold of 10, if one 
in
    ten events was a REL_X, we'd never get a wheel event.
    
    Drop this code, it's not needed. By default wheel emulation doesn't do
    horizontal scrolling, if a config snippet sets XAxisMapping the user wants
    horizontal scrolling. And since we just add the value anyway, as long as the
    user does a roughly vertical motion we won't get over the threshold anyway.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=93617
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/src/emuWheel.c b/src/emuWheel.c
index f1d1990..c82c240 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -95,7 +95,7 @@ BOOL
 EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
 {
     EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
-    WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
+    WheelAxisPtr pAxis = NULL;
     int value = pEv->value;
 
     /* Has wheel emulation been configured to be enabled? */
@@ -130,13 +130,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct 
input_event *pEv)
        /* ABS_X has the same value as REL_X, so this case catches both */
        case REL_X:
            pAxis = &(pEvdev->emulateWheel.X);
-           pOtherAxis = &(pEvdev->emulateWheel.Y);
            break;
 
        /* ABS_Y has the same value as REL_Y, so this case catches both */
        case REL_Y:
            pAxis = &(pEvdev->emulateWheel.Y);
-           pOtherAxis = &(pEvdev->emulateWheel.X);
            break;
 
        default:
@@ -144,15 +142,10 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct 
input_event *pEv)
        }
 
        /* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
-          wheel.  Reset the inertia of the other axis when a scroll event
-          was sent to avoid the buildup of erroneous scroll events if the
-          user doesn't move in a perfectly straight line.
+          wheel.
         */
        if (pAxis)
-       {
-           if (EvdevWheelEmuInertia(pInfo, pAxis, value))
-               pOtherAxis->traveled_distance = 0;
-       }
+           EvdevWheelEmuInertia(pInfo, pAxis, value);
 
        /* Eat motion events while emulateWheel button pressed. */
        return TRUE;

commit d24431a1863c49aa9edcabf535ffa64bfa87053c
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Thu Jan 14 10:41:46 2016 +1000

    Restore wheel emulation for absolute devices
    
    Wheel emulation relies on oldVals, which stopped updating in 3dcf6f123c5.
    
    Since wheel emulation may filter the abs event, store the event before we do
    anything with it. If we really want the abs_event, abs_queued will be set to
    1, otherwise the value will be ignored.
    
    And now that we know abs_value is always valied, we can copy its value into
    old_vals, so that wheel emulation can calculate the delta correctly.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=93617
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 3176660..0fcb0bb 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -430,6 +430,14 @@ static void
 EvdevProcessValuators(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = pInfo->private;
+    int val;
+
+    if (pEvdev->abs_vals) {
+            if (valuator_mask_fetch(pEvdev->abs_vals, 0, &val))
+                    valuator_mask_set(pEvdev->old_vals, 0, val);
+            if (valuator_mask_fetch(pEvdev->abs_vals, 1, &val))
+                    valuator_mask_set(pEvdev->old_vals, 1, val);
+    }
 
     /* Apply transformations on relative coordinates */
     if (pEvdev->rel_queued) {
@@ -765,6 +773,12 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct 
input_event *ev)
     if (ev->code > ABS_MAX)
         return;
 
+    /* Always store the current abs valuator, we need it to update old_vals
+     * which is required by wheel emulation */
+    map = pEvdev->abs_axis_map[ev->code];
+    if (map < 2)
+            valuator_mask_set(pEvdev->abs_vals, map, value);
+
     if (EvdevWheelEmuFilterMotion(pInfo, ev))
         return;
 
@@ -781,10 +795,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct 
input_event *ev)
                 valuator_mask_set(pEvdev->rel_vals, map, value - oldval);
                 pEvdev->rel_queued = 1;
             }
-            valuator_mask_set(pEvdev->old_vals, map, value);
         } else {
-            /* the normal case: just store the number. */
-            valuator_mask_set(pEvdev->abs_vals, map, value);
             pEvdev->abs_queued = 1;
         }
     }

commit ce7d8fdebc0123227be91ba5d89126a36f089ff5
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Thu Jan 14 11:18:56 2016 +1000

    man: add a warning that wheel emu inertia must be set and it isn't inertia
    
    First, it's not actually inertia, it's simply the scroll distance, yay for 
the
    misnomer.
    
    And it needs to be set for any device that is more fine-grained than a
    mouse, especially absolute devices. For example the VirtualBox device has an
    abs max of 32767, so a simple motion may have a delta of to 2000 units and
    that results in 200 scroll events. That's a bit excessive.
    
    Related to: https://bugs.freedesktop.org/show_bug.cgi?id=93617
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/man/evdev.man b/man/evdev.man
index e70ae1f..8d84364 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -125,6 +125,19 @@ Property: "Evdev Wheel Emulation Button".
 Specifies how far (in pixels) the pointer must move to generate button
 press/release events in wheel emulation mode.  Default: 10. Property: "Evdev
 Wheel Emulation Inertia".
+.IP
+This value must be set for any device does not resemble a standard mouse.
+Specifically, on absolute devices such as tablets the value should be set to
+a reasonable fraction of the expected movement to avoid excess scroll events.
+.IP
+.B WARNING:
+the name \*qinertia\*q is a misnomer. This option defines the distance
+required to generate one scroll event similar to the
+.B VertScrollDelta
+and
+.B HorizScrollDelta
+options. It does not enable inertia in the
+physical sense, scrolling stops immediately once the movement has stopped.
 .TP 7
 .BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
 Specifies the time in milliseconds the

Reply via email to