xserver: Branch 'server-1.12-branch' - 5 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Jun 4 20:14:00 PDT 2012


 Xi/stubs.c                     |    1 
 dix/getevents.c                |   27 +++++++++--
 hw/xfree86/common/xf86Xinput.c |   94 ++++++++++++++++++++++++++++++++++-------
 xkb/XKBMAlloc.c                |    6 +-
 4 files changed, 105 insertions(+), 23 deletions(-)

New commits:
commit aaf48906279bcf74bcfd0a1de24de099184be022
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri May 11 21:31:49 2012 +0200

    Xi: make stub DeleteInputDeviceRequest call RemoveDevice
    
    DeleteInputDeviceRequest is called from CloseDownDevices on reset, so
    call RemoveDevice to avoid leaking devices in Xvfb/Xnest/Xwin.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit e4153c1d9138ed40de1c615525066a0f5bb599dc)

diff --git a/Xi/stubs.c b/Xi/stubs.c
index 8baa5a0..39bee7c 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -141,4 +141,5 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
 void
 DeleteInputDeviceRequest(DeviceIntPtr dev)
 {
+    RemoveDevice(dev, TRUE);
 }
commit f4a1ecb9280570c473631760885cc2afb5d174b9
Author: Marcin Slusarz <marcin.slusarz at gmail.com>
Date:   Mon May 21 21:39:43 2012 +0200

    xfree86: fix mouse wheel support for DGA clients
    
    xf86-input-evdev (since "smooth scrolling" support was added) can send mouse
    motion and wheel events in one batch, so we need to handle it properly.
    Otherwise mouse wheel events which come with motion events are lost
    and separate mouse wheel events are handled through non-DGA path.
    
    Signed-off-by: Marcin Slusarz <marcin.slusarz 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 2d4fda4b09e67e47d3e6fc4743fc6e81bfe40f28)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 77b8000..bee407b 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1059,26 +1059,24 @@ xf86PostMotionEventP(DeviceIntPtr device,
     xf86PostMotionEventM(device, is_absolute, &mask);
 }
 
-void
-xf86PostMotionEventM(DeviceIntPtr device,
-                     int is_absolute, const ValuatorMask *mask)
+static int
+xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute,
+                         const ValuatorMask *mask)
 {
-    int flags = 0;
-
-    if (valuator_mask_num_valuators(mask) > 0) {
-        if (is_absolute)
-            flags = POINTER_ABSOLUTE;
-        else
-            flags = POINTER_RELATIVE | POINTER_ACCELERATE;
-    }
+    int stolen = 0;
 
 #if XFreeXDGA
+    ScreenPtr scr = NULL;
+    int idx, i;
+
     /* The evdev driver may not always send all axes across. */
-    if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1))
-        if (miPointerGetScreen(device)) {
-            int index = miPointerGetScreen(device)->myNum;
+    if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) {
+        scr = miPointerGetScreen(device);
+        if (scr) {
             int dx = 0, dy = 0;
 
+            idx = scr->myNum;
+
             if (valuator_mask_isset(mask, 0)) {
                 dx = valuator_mask_get(mask, 0);
                 if (is_absolute)
@@ -1091,11 +1089,75 @@ xf86PostMotionEventM(DeviceIntPtr device,
                     dy -= device->last.valuators[1];
             }
 
-            if (DGAStealMotionEvent(device, index, dx, dy))
-                return;
+            if (DGAStealMotionEvent(device, idx, dx, dy))
+                stolen = 1;
+        }
+    }
+
+    for (i = 2; i < valuator_mask_size(mask); i++) {
+        AxisInfoPtr ax;
+        double incr;
+        int val, button;
+
+        if (i >= device->valuator->numAxes)
+            break;
+
+        if (!valuator_mask_isset(mask, i))
+            continue;
+
+        ax = &device->valuator->axes[i];
+
+        if (ax->scroll.type == SCROLL_TYPE_NONE)
+            continue;
+
+        if (!scr) {
+            scr = miPointerGetScreen(device);
+            if (!scr)
+                break;
+            idx = scr->myNum;
+        }
+
+        incr = ax->scroll.increment;
+        val = valuator_mask_get(mask, i);
+
+        if (ax->scroll.type == SCROLL_TYPE_VERTICAL) {
+            if (incr * val < 0)
+                button = 4; /* up */
+            else
+                button = 5; /* down */
+        } else { /* SCROLL_TYPE_HORIZONTAL */
+            if (incr * val < 0)
+                button = 6; /* left */
+            else
+                button = 7; /* right */
         }
+
+        if (DGAStealButtonEvent(device, idx, button, 1) &&
+                DGAStealButtonEvent(device, idx, button, 0))
+            stolen = 1;
+    }
+
 #endif
 
+    return stolen;
+}
+
+void
+xf86PostMotionEventM(DeviceIntPtr device,
+                     int is_absolute, const ValuatorMask *mask)
+{
+    int flags = 0;
+
+    if (xf86CheckMotionEvent4DGA(device, is_absolute, mask))
+        return;
+
+    if (valuator_mask_num_valuators(mask) > 0) {
+        if (is_absolute)
+            flags = POINTER_ABSOLUTE;
+        else
+            flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+    }
+
     QueuePointerEvents(device, MotionNotify, 0, flags, mask);
 }
 
commit 889ce06946b8c1a246130a899e2702a3d7340fd2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed May 9 11:30:46 2012 +1000

    dix: undo transformation for missing valuators (#49347)
    
    last.valuators contains the transformed valuators of the device. If the
    device submits events with x/y missing, we need to get that from
    last.valuators and undo the transformation to that axis.
    
    X.Org Bug 49347 <http://bugs.freedesktop.org/show_bug.cgi?id=49347>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit 749a593e49adccdf1225be28a521412ec85333f4)

diff --git a/dix/getevents.c b/dix/getevents.c
index 6093799..dc02611 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1151,16 +1151,33 @@ static void
 transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
 {
     double x, y, ox, oy;
+    int has_x, has_y;
+
+    has_x = valuator_mask_fetch_double(mask, 0, &ox);
+    has_y = valuator_mask_fetch_double(mask, 1, &oy);
+
+    if (!has_x && !has_y)
+        return;
+
+    if (!has_x || !has_y) {
+        struct pixman_f_transform invert;
+
+        /* undo transformation from last event */
+        ox = dev->last.valuators[0];
+        oy = dev->last.valuators[1];
+
+        pixman_f_transform_invert(&invert, &dev->transform);
+        transform(&invert, &ox, &oy);
+
+        x = ox;
+        y = oy;
+    }
 
     if (valuator_mask_isset(mask, 0))
         ox = x = valuator_mask_get_double(mask, 0);
-    else
-        ox = x = dev->last.valuators[0];
 
     if (valuator_mask_isset(mask, 1))
         oy = y = valuator_mask_get_double(mask, 1);
-    else
-        oy = y = dev->last.valuators[1];
 
     transform(&dev->transform, &x, &y);
 
commit 4c21adab7ce4290ea038e13dd20a850f50d95f23
Author: Siddhesh Poyarekar <siddhesh.poyarekar at gmail.com>
Date:   Tue May 29 10:17:50 2012 +0530

    xkb: Allocate size_syms correctly when width of a type increases
    
    The current code seems to skip syms with width less than
    type->num_levels when calculating the total size for the new
    size_syms. This leads to less space being allocated than necessary
    during the next phase, which is to copy over the syms to the new
    location. This results in an overflow leading to a crash.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar at gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 42ae2e8199fe875319978249963de7499607988b)

diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 645e905..3ffd5da 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -375,8 +375,10 @@ XkbResizeKeyType(XkbDescPtr xkb,
         nResize = 0;
         for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
             width = XkbKeyGroupsWidth(xkb, i);
-            if (width < type->num_levels)
+            if (width < type->num_levels || width >= new_num_lvls) {
+                nTotal += XkbKeyNumSyms(xkb,i);
                 continue;
+            }
             for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1;
                  (g >= 0) && (!match); g--) {
                 if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) {
@@ -384,7 +386,7 @@ XkbResizeKeyType(XkbDescPtr xkb,
                     match = 1;
                 }
             }
-            if ((!match) || (width >= new_num_lvls))
+            if (!match)
                 nTotal += XkbKeyNumSyms(xkb, i);
             else {
                 nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls;
commit 472c2d1af75d8e321728589e377f73116adb29fa
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Wed May 23 11:22:05 2012 +0200

    Fix crash for motion events from devices without valuators
    
    A WarpPointer request may trigger a motion event on a device without
    valuators. That request is ignored by GetPointerEvents but during smooth
    scroll emulation we dereference dev->valuators to get the number of axes.
    
    Break out early if the device doesn't have valuators.
    
    Signed-off-by: Michal Suchanek <hramrach 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 88c767edb01ed7efb19ffe3a453e16107b27130b)

diff --git a/dix/getevents.c b/dix/getevents.c
index 9dc9617..6093799 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1574,7 +1574,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
     /* Now turn the smooth-scrolling axes back into emulated button presses
      * for legacy clients, based on the integer delta between before and now */
     for (i = 0; i < valuator_mask_size(&mask); i++) {
-        if (i >= pDev->valuator->numAxes)
+        if ( !pDev->valuator || (i >= pDev->valuator->numAxes))
             break;
 
         if (!valuator_mask_isset(&mask, i))


More information about the xorg-commit mailing list