[PULL 1.10 v2] Masked valuator fixes for XI 1.x valuator events
Chase Douglas
chase.douglas at canonical.com
Fri Apr 8 07:00:06 PDT 2011
The following changes since commit 1f51fe4f748b2997e466863d8387bd6791b32931:
Xi: fix querydevice request swapping (2011-04-07 08:36:59 +1000)
are available in the git repository at:
git://people.freedesktop.org/~cndougla/xserver.git server-1.10-masked-valuator-fixes
Chase Douglas (4):
Clean up getValuatorEvents using array loop logic
Handle non continuous valuator data in getValuatorEvents
Don't report old relative values in getValuatorEvents
Fix unset valuator handling for XI 1.x valuator events again
dix/eventconvert.c | 23 ++++++++---------------
dix/getevents.c | 4 ++++
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index dd1ca46..a73c671 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -371,27 +371,20 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
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];
- }
+
+ /* 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];
}
}
More information about the xorg-devel
mailing list