xserver: Branch 'server-1.10-branch' - 4 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Apr 8 16:36:02 PDT 2011


 dix/eventconvert.c |   23 ++++++++---------------
 dix/getevents.c    |    4 ++++
 2 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 7379f7a7717a431ba4f8cf371aad9838aec7bec6
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Wed Apr 6 14:51:45 2011 -0400

    Fix unset valuator handling for XI 1.x valuator events again
    
    Set the valuator values for unset masked absolute valuators in the
    internal device event. This ensures the values will always be correct in
    getValuatorEvents even if the device has been removed.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b28a1af55cf1ad2a882cc8cd73b77341dec7ff5a)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index edcb9dd..a73c671 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -359,12 +359,12 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
     int i;
     int state = 0;
     int first_valuator, num_valuators;
-    DeviceIntPtr dev = NULL;
 
 
     num_valuators = countValuators(ev, &first_valuator);
     if (num_valuators > 0)
     {
+        DeviceIntPtr dev = NULL;
         dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
         /* State needs to be assembled BEFORE the device is updated. */
         state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
@@ -381,14 +381,10 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
         xv->deviceid = ev->deviceid;
         xv->device_state = state;
 
-        for (j = 0; j < xv->num_valuators; j++) {
-            if (BitIsOn(ev->valuators.mask, xv->first_valuator + j))
-                valuators[j] = ev->valuators.data[xv->first_valuator + j];
-            else if (dev->valuator->axes[xv->first_valuator + j].mode == Absolute)
-                valuators[j] = dev->valuator->axisVal[xv->first_valuator + j];
-            else
-                valuators[j] = 0;
-        }
+        /* Unset valuators in masked valuator events have the proper data values
+         * in the case of an absolute axis in between two set valuators. */
+        for (j = 0; j < xv->num_valuators; j++)
+            valuators[j] = ev->valuators.data[xv->first_valuator + j];
 
         if (i + 6 < num_valuators)
             xv->deviceid |= MORE_EVENTS;
diff --git a/dix/getevents.c b/dix/getevents.c
index 794df42..8355040 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -205,6 +205,8 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
 {
     int i;
 
+    /* Set the data to the previous value for unset absolute axes. The values
+     * may be used when sent as part of an XI 1.x valuator event. */
     for (i = 0; i < valuator_mask_size(mask); i++)
     {
         if (valuator_mask_isset(mask, i))
@@ -216,6 +218,8 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
             event->valuators.data_frac[i] =
                 dev->last.remainder[i] * (1 << 16) * (1 << 16);
         }
+        else if (valuator_get_mode(dev, i) == Absolute)
+            event->valuators.data[i] = dev->valuator->axisVal[i];
     }
 }
 
commit 89142b356b3119d7b7012df075fc7698ec38e769
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Thu Mar 31 11:29:01 2011 -0400

    Don't report old relative values in getValuatorEvents
    
    Relative valuator values should not be reported in any future events. If
    a relative valuator value is not set in an internal event, set the value
    to 0 for XI 1.x valuator events sent over the wire.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    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 f40103cee1d591387359f401a5a7c21f4105aeb4)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 7893880..edcb9dd 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -384,8 +384,10 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
         for (j = 0; j < xv->num_valuators; j++) {
             if (BitIsOn(ev->valuators.mask, xv->first_valuator + j))
                 valuators[j] = ev->valuators.data[xv->first_valuator + j];
-            else
+            else if (dev->valuator->axes[xv->first_valuator + j].mode == Absolute)
                 valuators[j] = dev->valuator->axisVal[xv->first_valuator + j];
+            else
+                valuators[j] = 0;
         }
 
         if (i + 6 < num_valuators)
commit f1a8f8afc7424346dbe3360eaa5fd95d458de2e0
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Mon Mar 28 16:04:48 2011 -0400

    Handle non continuous valuator data in getValuatorEvents
    
    This allows for masked valuators to be handled properly in XI 1.x
    events. Any unset valuators in the device event are set to the last
    known value when transmitted on the wire through XI 1.x valuator events.
    
    Fixes https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/736500
    
    Signed-off-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 8199eac443d2c22d313cb23e39d5e607a8cc7f99)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 3b2697f..7893880 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -359,19 +359,18 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
     int i;
     int state = 0;
     int first_valuator, num_valuators;
+    DeviceIntPtr dev = NULL;
 
 
     num_valuators = countValuators(ev, &first_valuator);
     if (num_valuators > 0)
     {
-        DeviceIntPtr dev = NULL;
         dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
         /* State needs to be assembled BEFORE the device is updated. */
         state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
         state |= (dev && dev->button) ? (dev->button->state) : 0;
     }
 
-    /* FIXME: non-continuous valuator data in internal events*/
     for (i = 0; i < num_valuators; i += 6, xv++) {
         INT32 *valuators = &xv->valuator0; // Treat all 6 vals as an array
         int j;
@@ -382,8 +381,12 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
         xv->deviceid = ev->deviceid;
         xv->device_state = state;
 
-        for (j = 0; j < xv->num_valuators; j++)
-            valuators[j] = ev->valuators.data[xv->first_valuator + j];
+        for (j = 0; j < xv->num_valuators; j++) {
+            if (BitIsOn(ev->valuators.mask, xv->first_valuator + j))
+                valuators[j] = ev->valuators.data[xv->first_valuator + j];
+            else
+                valuators[j] = dev->valuator->axisVal[xv->first_valuator + j];
+        }
 
         if (i + 6 < num_valuators)
             xv->deviceid |= MORE_EVENTS;
commit a9c90ebe3357546fbd12430ca31623d419e77212
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Mon Mar 28 16:04:47 2011 -0400

    Clean up getValuatorEvents using array loop logic
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    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 ac00ab77d5a00cfd198958aa1afaa4c3ccc6d7bc)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index dd1ca46..3b2697f 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -373,25 +373,17 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
 
     /* FIXME: non-continuous valuator data in internal events*/
     for (i = 0; i < num_valuators; i += 6, xv++) {
+        INT32 *valuators = &xv->valuator0; // Treat all 6 vals as an array
+        int j;
+
         xv->type = DeviceValuator;
         xv->first_valuator = first_valuator + i;
         xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i);
         xv->deviceid = ev->deviceid;
         xv->device_state = state;
-        switch (xv->num_valuators) {
-        case 6:
-            xv->valuator5 = ev->valuators.data[xv->first_valuator + 5];
-        case 5:
-            xv->valuator4 = ev->valuators.data[xv->first_valuator + 4];
-        case 4:
-            xv->valuator3 = ev->valuators.data[xv->first_valuator + 3];
-        case 3:
-            xv->valuator2 = ev->valuators.data[xv->first_valuator + 2];
-        case 2:
-            xv->valuator1 = ev->valuators.data[xv->first_valuator + 1];
-        case 1:
-            xv->valuator0 = ev->valuators.data[xv->first_valuator + 0];
-        }
+
+        for (j = 0; j < xv->num_valuators; j++)
+            valuators[j] = ev->valuators.data[xv->first_valuator + j];
 
         if (i + 6 < num_valuators)
             xv->deviceid |= MORE_EVENTS;


More information about the xorg-commit mailing list