xserver: Branch 'server-1.9-branch' - 7 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Nov 9 22:26:44 PST 2010


 Xi/listdev.c                |    4 ++--
 dix/eventconvert.c          |    9 +++++++++
 dix/getevents.c             |    2 +-
 dix/window.c                |    6 +++---
 hw/kdrive/linux/tslib.c     |   15 +++++++++++----
 hw/xfree86/common/xf86DGA.c |    4 ++++
 include/eventstr.h          |    2 +-
 xkb/xkb.c                   |    4 ++--
 8 files changed, 33 insertions(+), 13 deletions(-)

New commits:
commit 46314e1e7ad05d6ff6a2f722b09a76f2931db7f5
Author: Paulius Zaleckas <paulius.zaleckas at gmail.com>
Date:   Mon Oct 18 00:02:01 2010 +0300

    KDrive: Fix error handlig in tslib driver
    
    If ts_open() fails and return NULL, then next call to ts_fd()
    segfaults because of NULL dereference. There is no need to
    check output of ts_fd() as ts_open() did this internally.
    
    Signed-off-by: Paulius Zaleckas <paulius.zaleckas at gmail.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 8990b31214bcbc08090604147287455bfde91c11)

diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index 48a0842..570cbf9 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -117,15 +117,22 @@ TslibEnable (KdPointerInfo *pi)
         pi->path = strdup("/dev/input/touchscreen0");
         ErrorF("[tslib/TslibEnable] no device path given, trying %s\n", pi->path);
     }
+
     private->tsDev = ts_open(pi->path, 0);
-    private->fd = ts_fd(private->tsDev);
-    if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {
+    if (!private->tsDev) {
         ErrorF("[tslib/TslibEnable] failed to open %s\n", pi->path);
-        if (private->fd >= 0)
-            close(private->fd);
         return BadAlloc;
     }
 
+    if (ts_config(private->tsDev)) {
+        ErrorF("[tslib/TslibEnable] failed to load configuration\n");
+        ts_close(private->tsDev);
+        private->tsDev = NULL;
+        return BadValue;
+    }
+
+    private->fd = ts_fd(private->tsDev);
+
     KdRegisterFd(private->fd, TsRead, pi);
 
     return Success;
commit 97915c06d10544d47ca69bd3610fd114d70e071f
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Oct 26 20:50:13 2010 +0300

    dix: advance parent window pointer when no node is found
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit a210068c5222acbdb04db17cb8cef314735bf977)

diff --git a/dix/window.c b/dix/window.c
index 1913030..edb146e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3660,9 +3660,9 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
                     &pParentNode, &pParentPrev))
         {
             /* if there is a node in the list, the win has a dev cursor */
-            if (!pParentNode->cursor) /* inherited. loop needs to cont. */
-            {
-            } else if (pParentNode->cursor == pCursor) /* inherit */
+            if (!pParentNode->cursor) /* inherited. */
+                pParent = pParent->parent;
+            else if (pParentNode->cursor == pCursor) /* inherit */
                 return TRUE;
             else  /* different cursor */
                 return FALSE;
commit 4a2caa287d36128d4f7bf10ced7ecb0e505011b2
Author: Joe Shaw <joeshaw at litl.com>
Date:   Thu Oct 14 15:09:20 2010 -0400

    fix a sign problem with valuator data.
    
    Without this patch, any negative valuator value is wrong when returned
    from XQueryDeviceState().  This is a regression from at least xserver
    1.4.
    
    Valuator data is set in dix/getevents.c:set_valuators() by copying
    signed int values into an unsigned int field
    DeviceEvent.valuators.data.
    
    That data is converted into a double with an implicit cast by
    assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().
    
    That double is converted back to a signed int in
    queryst.c:ProcXQueryDeviceState().  If the original value in
    set_valuators() is negative, the double value will be > 2^31 and the
    conversion back to a signed int is undefined.  (Although I
    consistently see the value -2^31.)
    
    Fix this by changing the definition of DeviceEvent.valuators.data from
    uint32_t to int32_t.
    
    Signed-off-by: Joe Shaw <joeshaw at litl.com>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit e354ccac36a8ee3a23bdc845833c16a5646cc200)

diff --git a/dix/getevents.c b/dix/getevents.c
index e5134d3..b23deaa 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -210,7 +210,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, int first_valuator,
     }
 
     memcpy(&event->valuators.data[first_valuator],
-           valuators, num_valuators * sizeof(uint32_t));
+           valuators, num_valuators * sizeof(int32_t));
 
 }
 
diff --git a/include/eventstr.h b/include/eventstr.h
index 433227e..377cceb 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -99,7 +99,7 @@ struct _DeviceEvent
     struct {
         uint8_t  mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
         uint8_t  mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
-        uint32_t data[MAX_VALUATORS];         /**< Valuator data */
+        int32_t  data[MAX_VALUATORS];         /**< Valuator data */
         int32_t  data_frac[MAX_VALUATORS];    /**< Fractional part for data */
     } valuators;
     struct {
commit 0f29d3a09dd96b5c124642f7cb939d48597b228c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Oct 11 15:38:38 2010 +1000

    xkb: init mapWidth and symsPerKey arrays to 0.
    
    Helps debugging greatly, random 8 or 16 bit values can sometimes look like
    valid values, causing much excitement on the client front.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit ca21a266224b6eff4fd817c2082d2e144f1ea58c)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 4105c1c..7d95bc0 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -2343,8 +2343,8 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
     XkbDescPtr          xkb;
     int                 error;
     int                 nTypes = 0, nActions;
-    CARD8               mapWidths[XkbMaxLegalKeyCode + 1];
-    CARD16              symsPerKey[XkbMaxLegalKeyCode + 1];
+    CARD8               mapWidths[XkbMaxLegalKeyCode + 1] = {0};
+    CARD16              symsPerKey[XkbMaxLegalKeyCode + 1] = {0};
 
     xkbi= dev->key->xkbInfo;
     xkb = xkbi->desc;
commit 8ff9b495e09b378d615cfd17e17f98d269713dd6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 28 16:13:09 2010 +1000

    Xi: reshuffle conditions for labeling a device as IsXExtensionKeyboard (#29046)
    
    From the original bug reporter Ezra Reeves:
    
    "I did some more digging on this today, and I found that an HP branded
    wireless USB mouse has the same issue. With this mouse (as well as the
    logitech wireless mouse), the return from:
    
    xdev = XListInputDevices(GDK_WINDOW_XDISPLAY(rootwin), &ndevices_return);
    
    lists the USB device twice, but both have xdev[num].use == 3
    (IsXExtensionKeyboard as defined in X11/XI.h).
    
    [...]
    
    Swapping the order of the test in Xi/listdev.c that determines whether a
    device is a pointer or a keyboard properly detects my devices (OEM USB
    wireless mouse/kb combo) -- one as a keyboard and one as a pointer."
    
    X.Org Bug 29046 <http://bugs.freedesktop.org/show_bug.cgi?id=29046>
    
    Reported-by: Erik Kilfoil <ekilfoil at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit fe8d122b133a43125cc961d2c3c811fa776f29c8)

diff --git a/Xi/listdev.c b/Xi/listdev.c
index 3b2272b..b38fbd1 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -180,10 +180,10 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
 	dev->use = IsXKeyboard;
     else if (IsMaster(d) && IsPointerDevice(d))
 	dev->use = IsXPointer;
-    else if (d->key && d->kbdfeed)
-        dev->use = IsXExtensionKeyboard;
     else if (d->valuator && d->button)
         dev->use = IsXExtensionPointer;
+    else if (d->key && d->kbdfeed)
+        dev->use = IsXExtensionKeyboard;
     else
 	dev->use = IsXExtensionDevice;
 
commit b144c0f4c72977671a39fa6368cbfea142444096
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 13 10:31:51 2010 +1000

    xfree86: set mask for valuators 0/1 when emulating core events (#30267)
    
    EventToCore as of the commit below won't generate core motion events if the
    valuator mask for x/y isn't set. For DGA, we work around this check by
    forcibly setting the mask in the event we pass down.
    
    commit de8be07cc0a8163b6ef04455706fd5ca2cebe587
    Author: Peter Hutterer <peter.hutterer at who-t.net>
    Date:   Tue Aug 17 12:08:52 2010 +1000
    
        dix: don't create core motion events for non-x/y valuators.
    
    X.Org Bug 30267 <http://bugs.freedesktop.org/show_bug.cgi?id=30267>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Andrew Randrianasulu <randrik at mail.ru>
    Tested-by: Andy Furniss
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 9872e0f0115cd7d0543e55a1831facddf3aff90c)

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index c468c60..1058a46 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -1133,6 +1133,10 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
             ev.root_x           = event->dx;
             ev.root_y           = event->dy;
             ev.corestate        = event->state;
+            /* DGA is core only, so valuators.data doesn't actually matter.
+             * Mask must be set for EventToCore to create motion events. */
+            SetBit(ev.valuators.mask, 0);
+            SetBit(ev.valuators.mask, 1);
 	    DeliverGrabbedEvent ((InternalEvent*)&ev, mouse, FALSE);
 	}
     }
commit 79f2a58c323bd1ad373f1f929207b5af98031b95
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Aug 17 12:08:52 2010 +1000

    dix: don't create core motion events for non-x/y valuators.
    
    Devices that send motion events with valuators other than x/y get core
    motion events with unchanged x/y coordinates. This confuses some
    applications.
    
    If the DeviceEvent does not have the x/y valuators set, return BadMatch on
    core conversion, thus skipping the event altogether.
    
    Reported-by: Bartosz Brachaczek <b.brachaczek at gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Bartosz Brachaczek <b.brachaczek at gmail.com>
    (cherry picked from commit de8be07cc0a8163b6ef04455706fd5ca2cebe587)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 4e3de0b..0f747c1 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -102,6 +102,15 @@ EventToCore(InternalEvent *event, xEvent *core)
     switch(event->any.type)
     {
         case ET_Motion:
+            {
+                DeviceEvent *e = &event->device_event;
+                /* Don't create core motion event if neither x nor y are
+                 * present */
+                if (!BitIsOn(e->valuators.mask, 0) &&
+                    !BitIsOn(e->valuators.mask, 1))
+                    return BadMatch;
+            }
+            /* fallthrough */
         case ET_ButtonPress:
         case ET_ButtonRelease:
         case ET_KeyPress:


More information about the xorg-commit mailing list