1
From 8a67ba29b82e2a627172b7ee181091df59e4cace Mon Sep 17 00:00:00 2001
2
From: Chase Douglas <chase.douglas@canonical.com>
3
Date: Mon, 28 Mar 2011 12:08:46 -0400
4
Subject: [PATCH 2/2] Handle non continuous valuator data in getValuatorEvents
6
This allows for masked valuators to be handled properly in XI 1.x
7
events. Any unset valuators in the device event are set to the last
8
known value when transmitted on the wire through XI 1.x valuator events.
10
Fixes https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/736500
12
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
14
dix/eventconvert.c | 11 +++++++----
15
1 files changed, 7 insertions(+), 4 deletions(-)
17
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
18
index 9192080..3285133 100644
19
--- a/dix/eventconvert.c
20
+++ b/dix/eventconvert.c
21
@@ -364,19 +364,18 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
24
int first_valuator, num_valuators;
25
+ DeviceIntPtr dev = NULL;
28
num_valuators = countValuators(ev, &first_valuator);
29
if (num_valuators > 0)
31
- DeviceIntPtr dev = NULL;
32
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
33
/* State needs to be assembled BEFORE the device is updated. */
34
state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
35
state |= (dev && dev->button) ? (dev->button->state) : 0;
38
- /* FIXME: non-continuous valuator data in internal events*/
39
for (i = 0; i < num_valuators; i += 6, xv++) {
40
INT32 *valuators = &xv->valuator0; // Treat all 6 vals as an array
42
@@ -387,8 +386,12 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
43
xv->deviceid = ev->deviceid;
44
xv->device_state = state;
46
- for (j = 0; j < xv->num_valuators; j++)
47
- valuators[j] = ev->valuators.data[xv->first_valuator + j];
48
+ for (j = 0; j < xv->num_valuators; j++) {
49
+ if (BitIsOn(ev->valuators.mask, xv->first_valuator + j))
50
+ valuators[j] = ev->valuators.data[xv->first_valuator + j];
52
+ valuators[j] = dev->valuator->axisVal[xv->first_valuator + j];
55
if (i + 6 < num_valuators)
56
xv->deviceid |= MORE_EVENTS;