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

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



 configure.ac               |   15 
 include/evdev-properties.h |   21 
 man/evdev.man              |   28 
 src/Makefile.am            |    5 
 src/apple.c                |  312 ++++++++
 src/draglock.c             |   33 
 src/emuMB.c                |    7 
 src/emuThird.c             |  416 +++++++++++
 src/emuWheel.c             |   54 -
 src/evdev.c                | 1610 +++++++++++++++++++++++++--------------------
 src/evdev.h                |  117 ++-
 11 files changed, 1839 insertions(+), 779 deletions(-)

New commits:
commit 99340147b9092a5aaec997eca407282a51e1f063
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Mar 15 15:46:32 2012 +1000

    Fix inverted horizontal scroll (#46205)
    
    REL_HWHEEL has a positive increment, not a negative one like REL_WHEEL.
    
    X.Org Bug 46205 <http://bugs.freedesktop.org/show_bug.cgi?id=46205>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/evdev.c b/src/evdev.c
index d540b87..8cf630c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1600,7 +1600,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
         else if (axis == REL_DIAL)
             SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, 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, 1.0, SCROLL_FLAG_NONE);
 #endif
     }
 

commit 76b1d58a9791257fa8b4e6d3322fcb082c86b18a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Mar 7 20:39:09 2012 +1000

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

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

commit 224a28de25fda654040a9fd4e5c4d748c9e29809
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Jan 25 16:03:34 2012 +1000

    Only force REL_X/Y if no ABS_X/Y exists
    
    5c5b2c8db851df7921cedd888222a6630a007fd8 added forced x/y axes if a device
    has any axes of the same mode. This was too broad a brush, some devices have
    a relative wheel but absolute x/y axes and would now get misdetected as
    purely relative device.
    
    Only force relative axes if a device no rel x/y _and_ no abs x/y.
    
    Reproducible: virtual machine with QEMU USB Tablet will stop working
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/evdev.c b/src/evdev.c
index 32fe38b..d540b87 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2146,7 +2146,8 @@ EvdevProbe(InputInfoPtr pInfo)
             if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
                 EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) {
                 xf86IDrvMsg(pInfo, X_PROBED, "Found x and y relative axes\n");
-            } else
+            } else if (!EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) ||
+                       !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))
                 EvdevForceXY(pInfo, Relative);
         } else {
             xf86IDrvMsg(pInfo, X_INFO, "Relative axes present but ignored.\n");

commit bc2f01ab838119a962f5e5eabb36e33d4c084f2c
Author: Chase Douglas <chase.douglas@canonical.com>
Date:   Thu Jan 19 14:17:34 2012 -0800

    Copy last valuator values into new touch valuator masks
    
    Evdev is a 100% stateful protocol. The following represents three
    touches. Two touches begin and end at the same time at (500, 500) and
    (1000, 1000). The third touch begins after the first two end, and is at
    (500, 500).
    
    ABS_MT_SLOT		0	/* Set touch slot */
    ABS_MT_TRACKING_ID	0	/* New touch with ID 0 in slot 0 */
    ABS_MT_POSITION_X	500	/* Initial X position */
    ABS_MT_POSITION_Y	500	/* Initial Y position */
    ABS_MT_SLOT		1	/* Set touch slot */
    ABS_MT_TRACKING_ID	1	/* New touch with ID 1 in slot 1 */
    ABS_MT_POSITION_X	1000	/* Initial X position */
    ABS_MT_POSITION_Y	1000	/* Initial Y position */
    SYNC				/* End of frame */
    ABS_MT_SLOT		0	/* Go back to slot 0 */
    ABS_MT_TRACKING_ID	-1	/* Touch in slot 0 ended */
    ABS_MT_SLOT		1	/* Go to slot 1 */
    ABS_MT_TRACKING_ID	-1	/* Touch in slot 1 ended */
    SYNC				/* End of frame */
    ABS_MT_SLOT		0	/* Go back to slot 0 */
    ABS_MT_TRACKING_ID	2	/* New touch in slot 0 with ID 2 */
    SYNC				/* End of frame */
    ABS_MT_TRACKING_ID	-1	/* Touch in last slot (0) ended */
    SYNC				/* End of frame */
    
    Note that touch 2 has the same X and Y position as touch 0. This is
    implied because no new value was emitted for slot 0. In fact, Linux will
    not emit an event in the same slot with the same event type and code
    unless the value has changed. Thus, we can only assume that all the MT
    valuators have the same values as they were when they were last sent for
    the given slot.
    
    This change adds an array of valuator mask to hold all the last valuator
    values that came from evdev for each slot. When a new touch begins, all
    the last values are copied into it.
    
    This patch assumes initial axis values of 0 in each slot. Linux and
    mtdev do not provide a facility to query the current values of axes in
    each slot yet. This may cause spurious incorrect touch valuator values
    at the beginning of an X session, but there's nothing we can do about it
    right now.
    
    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 1cdba41..32fe38b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -746,6 +746,24 @@ EvdevProcessTouch(InputInfoPtr pInfo)
     valuator_mask_zero(pEvdev->mt_mask);
 }
 
+static int
+num_slots(EvdevPtr pEvdev)
+{
+    int value = pEvdev->absinfo[ABS_MT_SLOT].maximum -
+                pEvdev->absinfo[ABS_MT_SLOT].minimum + 1;
+
+    /* If we don't know how many slots there are, assume at least 10 */
+    return value > 1 ? value : 10;
+}
+
+static int
+last_mt_vals_slot(EvdevPtr pEvdev)
+{
+    int value = pEvdev->cur_slot - pEvdev->absinfo[ABS_MT_SLOT].minimum;
+
+    return value < num_slots(pEvdev) ? value : -1;
+}
+
 static void
 EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
 {
@@ -757,16 +775,29 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
         pEvdev->cur_slot = ev->value;
     } else
     {
+        int slot_index = last_mt_vals_slot(pEvdev);
+
         if (pEvdev->slot_state == SLOTSTATE_EMPTY)
             pEvdev->slot_state = SLOTSTATE_UPDATE;
         if (ev->code == ABS_MT_TRACKING_ID) {
-        if (ev->value >= 0)
-            pEvdev->slot_state = SLOTSTATE_OPEN;
-        else
-            pEvdev->slot_state = SLOTSTATE_CLOSE;
+            if (ev->value >= 0) {
+                pEvdev->slot_state = SLOTSTATE_OPEN;
+
+                if (slot_index >= 0)
+                    valuator_mask_copy(pEvdev->mt_mask,
+                                       pEvdev->last_mt_vals[slot_index]);
+                else
+                    xf86IDrvMsg(pInfo, X_WARNING,
+                                "Attempted to copy values from out-of-range "
+                                "slot, touch events may be incorrect.\n");
+            } else
+                pEvdev->slot_state = SLOTSTATE_CLOSE;
         } else {
             map = pEvdev->axis_map[ev->code];
             valuator_mask_set(pEvdev->mt_mask, map, ev->value);
+            if (slot_index >= 0)
+                valuator_mask_set(pEvdev->last_mt_vals[slot_index], map,
+                                  ev->value);
         }
     }
 }
@@ -1027,6 +1058,28 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
 #undef ABS_Y_VALUE
 #undef ABS_VALUE
 
+static void
+EvdevFreeMasks(EvdevPtr pEvdev)
+{
+    int i;
+
+    valuator_mask_free(&pEvdev->vals);
+    valuator_mask_free(&pEvdev->old_vals);
+    valuator_mask_free(&pEvdev->prox);
+#ifdef MULTITOUCH
+    valuator_mask_free(&pEvdev->mt_mask);
+    if (pEvdev->last_mt_vals)
+    {
+        for (i = 0; i < num_slots(pEvdev); i++)
+            valuator_mask_free(&pEvdev->last_mt_vals[i]);
+        free(pEvdev->last_mt_vals);
+        pEvdev->last_mt_vals = NULL;
+    }
+    for (i = 0; i < EVDEV_MAXQUEUE; i++)
+        valuator_mask_free(&pEvdev->queue[i].touchMask);
+#endif
+}
+
 /* just a magic number to reduce the number of reads */
 #define NUM_EVENTS 16
 
@@ -1258,6 +1311,24 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
             goto out;
         }
 
+        pEvdev->last_mt_vals = calloc(num_slots(pEvdev), sizeof(ValuatorMask *));
+        if (!pEvdev->last_mt_vals) {
+            xf86IDrvMsg(pInfo, X_ERROR,
+                        "%s: failed to allocate MT last values mask array.\n",
+                        device->name);
+            goto out;
+        }
+
+        for (i = 0; i < num_slots(pEvdev); i++) {
+            pEvdev->last_mt_vals[i] = valuator_mask_new(num_mt_axes_total);
+            if (!pEvdev->last_mt_vals[i]) {
+                xf86IDrvMsg(pInfo, X_ERROR,
+                            "%s: failed to allocate MT last values mask.\n",
+                            device->name);
+                goto out;
+            }
+        }
+
         for (i = 0; i < EVDEV_MAXQUEUE; i++) {
             pEvdev->queue[i].touchMask =
                 valuator_mask_new(num_mt_axes_total);
@@ -1321,6 +1392,17 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
                     device->name);
             goto out;
         }
+
+        for (i = 0; i < num_slots(pEvdev); i++) {
+            for (axis = ABS_MT_TOUCH_MAJOR; axis < ABS_MAX; axis++) {
+                if (pEvdev->axis_map[axis] >= 0) {
+                    /* XXX: read initial values from mtdev when it adds support
+                     *      for doing so. */
+                    valuator_mask_set(pEvdev->last_mt_vals[i],
+                                      pEvdev->axis_map[axis], 0);
+                }
+            }
+        }
     }
 #endif
 
@@ -1426,14 +1508,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
     return Success;
 
 out:
-    valuator_mask_free(&pEvdev->vals);
-    valuator_mask_free(&pEvdev->old_vals);
-    valuator_mask_free(&pEvdev->prox);
-#ifdef MULTITOUCH
-    valuator_mask_free(&pEvdev->mt_mask);
-    for (i = 0; i < EVDEV_MAXQUEUE; i++)
-        valuator_mask_free(&pEvdev->queue[i].touchMask);
-#endif
+    EvdevFreeMasks(pEvdev);
     return !Success;
 }
 
@@ -1767,9 +1842,6 @@ EvdevProc(DeviceIntPtr device, int what)
 {
     InputInfoPtr pInfo;
     EvdevPtr pEvdev;
-#ifdef MULTITOUCH
-    int i;
-#endif
 
     pInfo = device->public.devicePrivate;
     pEvdev = pInfo->private;
@@ -1806,16 +1878,7 @@ EvdevProc(DeviceIntPtr device, int what)
             close(pInfo->fd);
             pInfo->fd = -1;
         }
-        valuator_mask_free(&pEvdev->vals);
-        valuator_mask_free(&pEvdev->old_vals);
-        valuator_mask_free(&pEvdev->prox);
-#ifdef MULTITOUCH
-        valuator_mask_free(&pEvdev->mt_mask);
-        for (i = 0; i < EVDEV_MAXQUEUE; i++)
-            valuator_mask_free(&pEvdev->queue[i].touchMask);
-        if (pEvdev->mtdev)
-            mtdev_close(pEvdev->mtdev);
-#endif
+        EvdevFreeMasks(pEvdev);
         EvdevRemoveDevice(pInfo);
         pEvdev->min_maj = 0;
 	break;
diff --git a/src/evdev.h b/src/evdev.h
index 1713b89..309b215 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -158,6 +158,7 @@ typedef struct {
     ValuatorMask *old_vals; /* old values for calculating relative motion */
     ValuatorMask *prox;     /* last values set while not in proximity */
     ValuatorMask *mt_mask;
+    ValuatorMask **last_mt_vals;
     int cur_slot;
     enum SlotState slot_state;
 #ifdef MULTITOUCH

commit 9d9c9870c88f2c636799a68cde8efcab59a4a2a5
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Jan 13 09:51:36 2012 +1000

    Prefere relative axis labelling over absolute axis labelling
    
    If a device has both relative and absolute axes, we'd initialise the
    relative axes but label them with the absolute labels.
    
    The current code is broken for mixed mode devices. Most of these devices
    operate primarily in relative mode, but have some absolute axes available
    for secondary functionality. For now, label the relative axes properly. We
    can fix the absolute axes later.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/src/evdev.c b/src/evdev.c
index effac40..1cdba41 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -120,7 +120,7 @@ static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
 static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
 static int EvdevOpenDevice(InputInfoPtr pInfo);
 
-static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
+static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms);
 static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
 static void EvdevInitProperty(DeviceIntPtr dev);
 static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
@@ -1297,7 +1297,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
             i++;
     }
 
-    EvdevInitAxesLabels(pEvdev, pEvdev->num_vals + num_mt_axes, atoms);
+    EvdevInitAxesLabels(pEvdev, Absolute, pEvdev->num_vals + num_mt_axes, atoms);
 
     if (!InitValuatorClassDeviceStruct(device, num_axes + num_mt_axes, atoms,
                                        GetMotionHistorySize(), Absolute)) {
@@ -1496,7 +1496,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
         i++;
     }
 
-    EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
+    EvdevInitAxesLabels(pEvdev, Relative, pEvdev->num_vals, atoms);
 
     if (!InitValuatorClassDeviceStruct(device, num_axes, atoms,
                                        GetMotionHistorySize(), Relative)) {
@@ -2637,18 +2637,18 @@ static char* btn_labels[][16] = {
     }
 };
 
-static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
+static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms)
 {
     Atom atom;
     int axis;
     char **labels;
     int labels_len = 0;
 
-    if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
+    if (mode == Absolute)
     {
         labels     = abs_labels;
         labels_len = ArrayLength(abs_labels);
-    } else if ((pEvdev->flags & EVDEV_RELATIVE_EVENTS))
+    } else if (mode == Relative)
     {
         labels     = rel_labels;
         labels_len = ArrayLength(rel_labels);
@@ -2810,8 +2810,19 @@ EvdevInitProperty(DeviceIntPtr dev)
         /* Axis labelling */
         if ((pEvdev->num_vals > 0) && (prop_axis_label = XIGetKnownProperty(AXIS_LABEL_PROP)))
         {
+            int mode;
             Atom atoms[pEvdev->num_vals];
-            EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
+
+            if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
+                mode = Absolute;
+            else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
+                mode = Relative;
+            else {
+                xf86IDrvMsg(pInfo, X_ERROR, "BUG: mode is neither absolute nor relative\n");
+                mode = Absolute;
+            }
+
+            EvdevInitAxesLabels(pEvdev, mode, pEvdev->num_vals, atoms);
             XIChangeDeviceProperty(dev, prop_axis_label, XA_ATOM, 32,
                                    PropModeReplace, pEvdev->num_vals, atoms, FALSE);
             XISetDevicePropertyDeletable(dev, prop_axis_label, FALSE);

commit 5c5b2c8db851df7921cedd888222a6630a007fd8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Jan 12 11:03:30 2012 +1000

    Force x/y axes to exist on devices with any other axes (#44655)
    
    Too much in the server relies on x/y to exist and to be axes 0 and 1. So if
    any relative axes exist, initialize REL_X/Y or ABS_X/Y as well.
    
    For servers up to 1.11: a scrollwheel-only device now has relative axes
    where it only had buttons before.
    
    For servers 1.12 or later: the device now has x/y in addition to the scroll
    axes.
    
    X.Org Bug 44655 <http://bugs.freedesktop.org/show_bug.cgi?id=44655>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
    Reviewed-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/src/evdev.c b/src/evdev.c
index 989a255..effac40 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1958,6 +1958,38 @@ EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab)
     return TRUE;
 }
 
+/**
+ * Some devices only have other axes (e.g. wheels), but we
+ * still need x/y for these. The server relies on devices having
+ * x/y as axes 0/1 and core/XI 1.x clients expect it too (#44655)
+ */
+static void
+EvdevForceXY(InputInfoPtr pInfo, int mode)
+{
+    EvdevPtr pEvdev = pInfo->private;
+
+    xf86IDrvMsg(pInfo, X_INFO, "Forcing %s x/y axes to exist.\n",
+                (mode == Relative) ? "relative" : "absolute");
+
+    if (mode == Relative)
+    {
+        EvdevSetBit(pEvdev->rel_bitmask, REL_X);
+        EvdevSetBit(pEvdev->rel_bitmask, REL_Y);
+    } else if (mode == Absolute)
+    {
+        EvdevSetBit(pEvdev->abs_bitmask, ABS_X);
+        EvdevSetBit(pEvdev->abs_bitmask, ABS_Y);
+        pEvdev->absinfo[ABS_X].minimum = 0;
+        pEvdev->absinfo[ABS_X].maximum = 1000;
+        pEvdev->absinfo[ABS_X].value = 0;
+        pEvdev->absinfo[ABS_X].resolution = 0;
+        pEvdev->absinfo[ABS_Y].minimum = 0;
+        pEvdev->absinfo[ABS_Y].maximum = 1000;
+        pEvdev->absinfo[ABS_Y].value = 0;
+        pEvdev->absinfo[ABS_Y].resolution = 0;
+    }
+}
+
 static int
 EvdevProbe(InputInfoPtr pInfo)
 {
@@ -2051,7 +2083,8 @@ EvdevProbe(InputInfoPtr pInfo)
             if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
                 EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) {
                 xf86IDrvMsg(pInfo, X_PROBED, "Found x and y relative axes\n");
-            }
+            } else
+                EvdevForceXY(pInfo, Relative);
         } else {
             xf86IDrvMsg(pInfo, X_INFO, "Relative axes present but ignored.\n");
             has_rel_axes = FALSE;
@@ -2116,7 +2149,16 @@ EvdevProbe(InputInfoPtr pInfo)
                     pEvdev->flags |= EVDEV_TOUCHSCREEN;
                     pEvdev->flags |= EVDEV_BUTTON_EVENTS;
             }
+        } else {
+#ifdef MULTITOUCH
+            if (!EvdevBitIsSet(pEvdev->abs_bitmask, ABS_MT_POSITION_X) ||
+                !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_MT_POSITION_Y))
+#endif
+                EvdevForceXY(pInfo, Absolute);
         }
+
+
+
     }
 
     for (i = 0; i < BTN_MISC; i++) {

commit 854df75f4908bee66e1057f6f04817a1c47124bc
Author: Pete Beardmore <pete.beardmore@msn.com>
Date:   Mon Jan 9 23:47:45 2012 +0000

    missing multitouch related define tests
    
    addition of two missing define tests required when no multitouch related
    symbols are available in user-space
    
    Fixes X.Org Bug 44578 <https://bugs.freedesktop.org/show_bug.cgi?id=44578>
    
    Signed-off-by: Pete Beardmore <pete.beardmore@msn.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 82cdb00..989a255 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1143,6 +1143,7 @@ EvdevAddKeyClass(DeviceIntPtr device)
     return Success;
 }
 
+#ifdef MULTITOUCH
 /* MT axes are counted twice - once as ABS_X (which the kernel keeps for
  * backwards compatibility), once as ABS_MT_POSITION_X. So we need to keep a
  * mapping of those axes to make sure we only count them once
@@ -1160,6 +1161,7 @@ static struct mt_axis_mappings mt_axis_mappings[] = {
     {ABS_MT_PRESSURE, ABS_PRESSURE},
     {ABS_MT_DISTANCE, ABS_DISTANCE},
 };
+#endif
 
 /**
  * return TRUE if the axis is not one we should count as true axis
@@ -1280,6 +1282,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
 
         mapping = i;
 
+#ifdef MULTITOUCH
         for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
         {
             if (mt_axis_mappings[j].code == axis)
@@ -1288,7 +1291,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
                     mt_axis_mappings[j].needs_mapping)
                 mapping = mt_axis_mappings[j].mapping;
         }
-
+#endif
         pEvdev->axis_map[axis] = mapping;
         if (mapping == i)
             i++;

commit 8c55e94a6ac91fa856d37206c8a7eda1adcc6b9d
Author: Chase Douglas <chase.douglas@canonical.com>
Date:   Tue Jan 3 15:31:43 2012 -0800

    Set the default resolution to 0
    
    If we don't know the resolution, set it to 0. This is invalid, and tells
    the X client that we don't know the resolution, rather than reporting an
    incorrect value.
    
    This value was originally from commit
    6271494faa4c45f4fa10509f72e0515f2cef36c6, which is the initial commit
    from Adam Jackson adding absolute axis support.
    
    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 9f3a22a..82cdb00 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1323,7 +1323,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
 
     for (axis = ABS_X; axis < ABS_MT_SLOT; axis++) {
         int axnum = pEvdev->axis_map[axis];
-        int resolution = 10000;
+        int resolution = 0;
 
         if (axnum == -1)
             continue;
@@ -1345,7 +1345,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
 #ifdef MULTITOUCH
     for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) {
         int axnum = pEvdev->axis_map[axis];
-        int resolution = 10000;
+        int resolution = 0;
         int j;
         BOOL skip = FALSE;
 

commit 965338e9d0ee5e2a6135a930347e9dab4b8db0dd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Jan 3 08:44:27 2012 +1000

    Remove unused udev.c
    
    Added in 683a55e504f4fc2d1c847c54986439a0c61b2f20 due to a botched up
    rebase -i. The contents of udev.c and EvdevIsVirtual are identical, there is
    no need for an extra file for this one function.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/udev.c b/src/udev.c
deleted file mode 100644
index 9570d8f..0000000
--- a/src/udev.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2011 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of Red Hat
- * not be used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.  Red
- * Hat makes no representations about the suitability of this software
- * for any purpose.  It is provided "as is" without express or implied
- * warranty.
- *
- * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors:
- *	Peter Hutterer (peter.hutterer@redhat.com)
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "evdev.h"
-
-#include <libudev.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-Bool
-udev_device_is_virtual(const char* devicenode)
-{
-    struct udev *udev = NULL;
-    struct udev_device *device = NULL;
-    struct stat st;
-    int rc = FALSE;
-    const char *devpath;
-
-    udev = udev_new();
-    if (!udev)
-        goto out;
-
-    stat(devicenode, &st);
-    device = udev_device_new_from_devnum(udev, 'c', st.st_rdev);
-
-    if (!device)
-        goto out;
-
-
-    devpath = udev_device_get_devpath(device);
-    if (!devpath)
-        goto out;
-
-    if (strstr(devpath, "LNXSYSTM"))
-        rc = TRUE;
-
-out:
-    udev_device_unref(device);
-    udev_unref(udev);
-    return rc;
-}

commit 0075da20d691e451f32bdf3c8ba0f270a6c8b0e1
Author: Cyril Brulebois <kibi@debian.org>
Date:   Sat Dec 31 19:46:08 2011 +0100

    configure.ac: Fix udev/libudev dependency.
    
    In 683a55e504f4fc2d1c847c54986439a0c61b2f20, a dependency on libudev was
    added, but documented in configure.ac as a dependency on udev (which
    also happens to ship a pkg-config file).
    
    Signed-off-by: Cyril Brulebois <kibi@debian.org>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 57690c4..47f70b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ XORG_DEFAULT_OPTIONS
 
 # Obtain compiler/linker options from server and required extensions
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
-PKG_CHECK_MODULES(UDEV, udev)
+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")
 

commit 009ac94a8e6d084c13f15ed8b2e1b22f86530c9f
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat Dec 31 21:28:53 2011 -0500

    Remove redundant redeclaration of Evdev3BEmuPreInit
    
    Found-by: Tinderbox
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/evdev.h b/src/evdev.h
index acd4289..1713b89 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -278,7 +278,6 @@ void EvdevMBEmuFinalize(InputInfoPtr);
 CARD32 Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg);
 BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
 void Evdev3BEmuPreInit(InputInfoPtr pInfo);
-void Evdev3BEmuPreInit(InputInfoPtr);
 void Evdev3BEmuOn(InputInfoPtr);
 void Evdev3BEmuFinalize(InputInfoPtr);
 void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy);

commit 4b76d80e934f5503c712289ce73d4e10cc79bba6
Author: Cyril Brulebois <kibi@debian.org>
Date:   Sat Dec 31 18:38:30 2011 +0100

    evdev 2.6.99.901
    
    Signed-off-by: Cyril Brulebois <kibi@debian.org>

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

commit 6dd6f2d3c6b2fee5f78b01618643c7f3ed0819c3
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 29 10:37:38 2011 +1000

    Require xserver 1.12 RC1
    
    Remove the ABI check hack, just check for the server version directly now
    that we have one that definitely has the multitouch APIs.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 451a730..10ec8ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ XORG_DEFAULT_OPTIONS
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
 PKG_CHECK_MODULES(UDEV, udev)
 
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3], HAVE_XI22="yes", HAVE_XI22="no")
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
 
 if test "x$HAVE_XI22" = xyes; then
         # Obtain compiler/linker options for mtdev
diff --git a/src/evdev.h b/src/evdev.h
index 609365f..acd4289 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -43,17 +43,6 @@
 #include <xf86_OSproc.h>
 #include <xkbstr.h>
 
-/* FIXME: once the server version is bumped, we can remove this with a
- * proper pkg-config check. Right now we need an inputproto check for
- * the right protocol, the pkgconfig check for the mtdev pkgconfig, and an
- * ABI check to undo the first two if the proto was updated but the server
- * wasn't yet */
-#ifdef MULTITOUCH
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 16
-#undef MULTITOUCH
-#endif
-#endif
-
 #ifdef MULTITOUCH
 #include <mtdev.h>
 #endif

commit 0c7c087f77132657dd8ee342963bb1b51d659571
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 29 10:19:48 2011 +1000

    Test for mtdev before assuming multitouch
    
    If the XI2.2 headers are present but mtdev isn't, build without MULTITOUCH
    defined.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 5671193..451a730 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,13 +48,14 @@ XORG_DEFAULT_OPTIONS
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
 PKG_CHECK_MODULES(UDEV, udev)
 
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3],
-                  HAVE_XI22="yes"; AC_DEFINE(MULTITOUCH, 1, [XI2.2 available]),
-                  HAVE_XI22="no")
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3], HAVE_XI22="yes", HAVE_XI22="no")
 
 if test "x$HAVE_XI22" = xyes; then
         # Obtain compiler/linker options for mtdev
-        PKG_CHECK_MODULES(MTDEV, mtdev)
+        PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no")
+fi
+if test "x$HAVE_XI22" = xyes && test "x$HAVE_MTDEV" = xyes; then
+        AC_DEFINE(MULTITOUCH, 1, [XI2.2 available])
 fi
 
 # Define a configure option for an alternate input module directory

commit ba9377c6d9e6d0d2813e471b516bb36902dae2ce
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sat Dec 24 12:19:40 2011 +1000

    Remove need for --enable-multitouch
    
    If we spot inputproto 2.1.99.3, we assume we have a capable X server. This
    should really be a server version check, but the server version hasn't been
    bumped yet.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index cfff2d4..5671193 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,16 +48,11 @@ XORG_DEFAULT_OPTIONS
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
 PKG_CHECK_MODULES(UDEV, udev)
 
-# Whether to include support for experimental XI 2.2 multitouch
-AC_ARG_ENABLE(multitouch,
-              AC_HELP_STRING([--enable-multitouch],
-                             [Enable experimental XI 2.2 multitouch support [[default: disabled]]]),
-              [MULTITOUCH=$enableval],
-              [MULTITOUCH=no])
-
-if test "x$MULTITOUCH" = xyes; then
-        AC_DEFINE(MULTITOUCH, 1, [Enable experimental multitouch code])
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3],
+                  HAVE_XI22="yes"; AC_DEFINE(MULTITOUCH, 1, [XI2.2 available]),
+                  HAVE_XI22="no")
 
+if test "x$HAVE_XI22" = xyes; then
         # Obtain compiler/linker options for mtdev
         PKG_CHECK_MODULES(MTDEV, mtdev)
 fi
diff --git a/src/evdev.h b/src/evdev.h
index acd4289..609365f 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -43,6 +43,17 @@
 #include <xf86_OSproc.h>
 #include <xkbstr.h>
 
+/* FIXME: once the server version is bumped, we can remove this with a
+ * proper pkg-config check. Right now we need an inputproto check for
+ * the right protocol, the pkgconfig check for the mtdev pkgconfig, and an
+ * ABI check to undo the first two if the proto was updated but the server
+ * wasn't yet */
+#ifdef MULTITOUCH
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 16
+#undef MULTITOUCH
+#endif
+#endif
+
 #ifdef MULTITOUCH
 #include <mtdev.h>
 #endif

commit 7f7606fc461dca1f087a756c85e22f2cc773d008
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sat Dec 24 12:31:34 2011 +1000

    Include config.h from evdev.h
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.h b/src/evdev.h
index 7d49919..acd4289 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -28,6 +28,10 @@
  *	Oliver McFadden (oliver.mcfadden@nokia.com)
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #ifndef EVDEV_H
 #define EVDEV_H
 

commit 0ba58f483e564bd815bae36f6272029693c1fd5c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sat Dec 24 12:18:16 2011 +1000

    Always include mt_mask in the evdev struct
    
    Even if MT support isn't available, include it in the build. The checks in
    the code check whether mt_mask is non-NULL but they would all need ifdef
    escaping otherwise.
    
    Leave the mtdev part inside the ifdef however, so that we don't need the
    mtdev header if we don't build with multitouch.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.h b/src/evdev.h
index 5fd99ff..7d49919 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -153,10 +153,10 @@ typedef struct {
     ValuatorMask *vals;     /* new values coming in */
     ValuatorMask *old_vals; /* old values for calculating relative motion */
     ValuatorMask *prox;     /* last values set while not in proximity */
-#ifdef MULTITOUCH
     ValuatorMask *mt_mask;
     int cur_slot;
     enum SlotState slot_state;
+#ifdef MULTITOUCH
     struct mtdev *mtdev;
 #endif
 

commit e99ab2314f712df8dd705b16008755f8b3095707
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Dec 20 15:08:06 2011 +1000

    Don't count legacy and MT axes twice
    
    The kernel exports both ABS_X and ABS_MT_POSITION_X (and a couple others)
    for a multi-touch capable device. For such devices, only count the axis once
    since we submit ABS_MT_POSITION_X through ABS_X.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 00c9935..aef1d6e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -748,12 +748,7 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
         else
             pEvdev->slot_state = SLOTSTATE_CLOSE;
         } else {
-            if (ev->code == ABS_MT_POSITION_X)
-                map = pEvdev->axis_map[ABS_X];
-            else if (ev->code == ABS_MT_POSITION_Y)
-                map = pEvdev->axis_map[ABS_Y];
-            else
-                map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
+            map = pEvdev->axis_map[ev->code];
             valuator_mask_set(pEvdev->mt_mask, map, ev->value);


Reply to: