diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2011-03-28 16:04:48 -0400 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2011-04-08 09:55:19 -0400 |
commit | f1a8f8afc7424346dbe3360eaa5fd95d458de2e0 (patch) | |
tree | a40f1bee7a795b61307001c1950d5adf98170146 /dix | |
parent | a9c90ebe3357546fbd12430ca31623d419e77212 (diff) |
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@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8199eac443d2c22d313cb23e39d5e607a8cc7f99)
Diffstat (limited to 'dix')
-rw-r--r-- | dix/eventconvert.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 3b2697f0a..78938800e 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; |