File U_Restore-wheel-emulation-for-absolute-devices.patch of Package xf86-input-evdev

From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Jan 14 10:41:46 2016 +1000
Subject: [PATCH]Restore wheel emulation for absolute devices
Patch-mainline: Upstream
Git-repo: git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev
Git-commit: d24431a1863c49aa9edcabf535ffa64bfa87053c
References: FATE#320263
Signed-off-by: Egbert Eich <eich@suse.com>

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.hutterer@who-t.net>
---
 src/evdev.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

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;
         }
     }
openSUSE Build Service is sponsored by