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

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



 configure.ac               |    2 -
 include/evdev-properties.h |    2 +
 man/evdev.man              |    8 +++++++
 src/emuMB.c                |   47 +++++++++++++++++++++++++++++++++++++++++++--
 src/evdev.c                |    9 +++-----
 src/evdev.h                |    1 
 6 files changed, 61 insertions(+), 8 deletions(-)

New commits:
commit 1dd61111adea1d137877ca1a9642e1552a152355
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Jan 18 13:14:29 2017 +1000

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

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

commit 231061d004ee4e924bb736adc428287367d2001c
Author: Alexander Volkov <a.volkov@rusbitech.ru>
Date:   Mon Dec 26 17:39:32 2016 +0300

    Don't send pointer events in addition to touch events
    
    Updating abs_vals for touch events since d24431a1863c49aa9edcabf535ffa64bfa87053c
    leads to posting Motion events with updated coordinates to the X server,
    which in turn resends them to clients.
    
    Don't queue Motion events for touch events, the X server should
    synthesize them itself.
    
    Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
    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 96fd97d..f627fd0 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -784,7 +784,6 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
 
     if (ev->code >= ABS_MT_SLOT) {
         EvdevProcessTouchEvent(pInfo, ev);
-        pEvdev->abs_queued = 1;
     } else if (!pEvdev->mt_mask) {
         map = pEvdev->abs_axis_map[ev->code];
 

commit 425ed6017a42937f69c1e8450ea8f3c6c6c20928
Author: David Strobach <lalochcz@gmail.com>
Date:   Thu Nov 17 20:47:31 2016 +0100

    Middle emulation - make the emulated button number configurable
    
    Sometimes it may be desirable to remap physical middle button
    to something else and use emulation instead. The emulation is
    however hardcoded to emulate physical button 2, so the emulated
    button gets remapped together with the physical one. This patch
    adds the Emulate3Button configuration option to allow for user
    selection of the emulated button number and a configuration
    like this:
    
    Section "InputClass"
        Identifier "Middle button emulation config"
        MatchProduct ".... some device ..."
        MatchDriver "evdev"
        Option "Emulate3Buttons" "on"
        Option "Emulate3Button" "9"
    EndSection
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/include/evdev-properties.h b/include/evdev-properties.h
index 8ae5ba3..c61aa49 100644
--- a/include/evdev-properties.h
+++ b/include/evdev-properties.h
@@ -33,6 +33,8 @@
 #define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
 /* CARD32 */
 #define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
+/* CARD8 */
+#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
 
 /* Wheel emulation */
 /* BOOL */
diff --git a/man/evdev.man b/man/evdev.man
index 8d84364..e39736a 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -94,6 +94,11 @@ Sets the timeout (in milliseconds) that the driver waits before deciding
 if two buttons where pressed "simultaneously" when 3 button emulation is
 enabled.  Default: 50. Property: "Evdev Middle Button Timeout".
 .TP 7
+.BI "Option \*qEmulate3Button\*q \*q" integer \*q
+Specifies the physical button number to be emitted if middle button emulation
+is triggered.
+Default: 2.  Property: "Evdev Middle Button Button".
+.TP 7
 .BI "Option \*qEmulateWheel\*q \*q" boolean \*q
 Enable/disable "wheel" emulation.  Wheel emulation means emulating button
 press/release events when the mouse is moved while a specific real button
@@ -283,6 +288,9 @@ value.
 .BI "Evdev Middle Button Timeout"
 1 16-bit positive value.
 .TP 7
+.BI "Evdev Middle Button Button"
+1 8-bit value, allowed range 0-32, 0 disables the button.
+.TP 7
 .BI "Evdev Wheel Emulation"
 1 boolean value (8 bit, 0 or 1).
 .TP 7
diff --git a/src/emuMB.c b/src/emuMB.c
index d1777aa..4f00e0d 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -45,6 +45,7 @@
 
 static Atom prop_mbemu     = 0; /* Middle button emulation on/off property */
 static Atom prop_mbtimeout = 0; /* Middle button timeout property */
+static Atom prop_mbbuton   = 0; /* Middle button target button property */
 /*
  * Lets create a simple finite-state machine for 3 button emulation:
  *
@@ -185,6 +186,7 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = pInfo->private;
     int id;
+    int mapped_id;
 
 #if HAVE_THREADED_INPUT
     input_lock();
@@ -194,7 +196,10 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
 
     pEvdev->emulateMB.pending = FALSE;
     if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
-        EvdevPostButtonEvent(pInfo, abs(id),
+        mapped_id = abs(id);
+        if (mapped_id == 2)
+            mapped_id = pEvdev->emulateMB.button;
+        EvdevPostButtonEvent(pInfo, mapped_id,
                              (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
         pEvdev->emulateMB.state =
             stateTab[pEvdev->emulateMB.state][4][2];
@@ -226,6 +231,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
 {
     EvdevPtr pEvdev = pInfo->private;
     int id;
+    int mapped_id;
     int *btstate;
     int ret = FALSE;
 
@@ -244,7 +250,10 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
 
     if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
     {
-        EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
+        mapped_id = abs(id);
+        if (mapped_id == 2)
+            mapped_id = pEvdev->emulateMB.button;
+        EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
         ret = TRUE;
     }
     if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
@@ -301,12 +310,23 @@ void
 EvdevMBEmuPreInit(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
+    int bt;
 
     pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
                                                   "Emulate3Buttons",
                                                   FALSE);
     pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
                                                  "Emulate3Timeout", 50);
+    bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
+    if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
+        xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
+                    bt);
+        xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
+
+        pEvdev->emulateMB.enabled = FALSE;
+    }
+
+    pEvdev->emulateMB.button = bt;
 }
 
 void
@@ -338,6 +358,7 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
 {
     InputInfoPtr pInfo  = dev->public.devicePrivate;
     EvdevPtr     pEvdev = pInfo->private;
+    int bt;
 
     if (atom == prop_mbemu)
     {
@@ -353,6 +374,18 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
 
         if (!checkonly)
             pEvdev->emulateMB.timeout = *((CARD32*)val->data);
+    } else if (atom == prop_mbbuton)
+    {
+        if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
+            return BadMatch;
+
+        bt = *((CARD8*)val->data);
+
+        if (bt < 0 || bt > EVDEV_MAXBUTTONS)
+            return BadValue;
+
+        if (!checkonly)
+            pEvdev->emulateMB.button = bt;
     }
 
     return Success;
@@ -390,5 +423,15 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
         return;
     XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
 
+    prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
+                              strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
+                              TRUE);
+    rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
+                                &pEvdev->emulateMB.button, FALSE);
+
+    if (rc != Success)
+        return;
+    XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
+
     XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
 }
diff --git a/src/evdev.h b/src/evdev.h
index c506296..7081182 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -196,6 +196,7 @@ typedef struct {
         int                 state;       /* state machine (see bt3emu.c) */
         Time                expires;     /* time of expiry */
         Time                timeout;
+        uint8_t             button;      /* phys button to emit */
     } emulateMB;
     /* Third mouse button emulation */
     struct emulate3B {

commit 7251e42dfbac11eb1619b0a3881ee463b6d76c95
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Oct 21 09:42:23 2016 +1000

    Fix off-by-one error counting axes
    
    We stopped counting one too early, but still initialized that axis later,
    leading to a bug macro to trigger.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=97956
    
    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 5ace238..96fd97d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1238,7 +1238,7 @@ EvdevCountMTAxes(EvdevPtr pEvdev, int *num_mt_axes_total,
         return;
 
     /* Absolute multitouch axes: adjust mapping and axes counts. */
-    for (axis = ABS_MT_SLOT; axis < ABS_MAX; axis++)
+    for (axis = ABS_MT_SLOT; axis <= ABS_MAX; axis++)
     {
         int j;
         Bool skip = FALSE;
@@ -1288,7 +1288,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
         goto out;
 
     /* Find number of absolute axis, including MT ones, will decrease later. */
-    for (i = 0; i < ABS_MAX; i++)
+    for (i = 0; i <= ABS_MAX; i++)
         if (libevdev_has_event_code(pEvdev->dev, EV_ABS, i))
             num_axes++;
 
@@ -1456,7 +1456,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
         }
 
         for (i = 0; i < num_touches; i++) {
-            for (axis = ABS_MT_TOUCH_MAJOR; axis < ABS_MAX; axis++) {
+            for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) {
                 if (pEvdev->abs_axis_map[axis] >= 0) {
                     int val = pEvdev->mtdev ? 0 : libevdev_get_current_slot(pEvdev->dev);
                     /* XXX: read initial values from mtdev when it adds support
@@ -1669,7 +1669,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device, int num_scroll_axes)
     if (!libevdev_has_event_type(pEvdev->dev, EV_REL))
         goto out;
 
-    for (i = 0; i < REL_MAX; i++) {
+    for (i = 0; i <= REL_MAX; i++) {
         if (i == REL_WHEEL || i == REL_HWHEEL || i == REL_DIAL)
             continue;
 


Reply to: