diff options
Diffstat (limited to 'xorg-server/dix/eventconvert.c')
-rw-r--r-- | xorg-server/dix/eventconvert.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c index d5ac54796..6af142860 100644 --- a/xorg-server/dix/eventconvert.c +++ b/xorg-server/dix/eventconvert.c @@ -383,38 +383,35 @@ 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;
+
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++) {
+ 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;
}
if (i + 6 < num_valuators)
|