summaryrefslogtreecommitdiff
path: root/dix/eventconvert.c
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-04-06 14:51:45 -0400
committerPeter Hutterer <peter.hutterer@who-t.net>2011-04-07 12:45:55 +1000
commitb28a1af55cf1ad2a882cc8cd73b77341dec7ff5a (patch)
treead44513c7d3d251a65125090eace043e5c3011a3 /dix/eventconvert.c
parent3085b178626c957854385c7a88a05ec3c7eb74f3 (diff)
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@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r--dix/eventconvert.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index a5fe0a9cc..14731f4f6 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -383,12 +383,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;
@@ -405,14 +405,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;