summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-03-28 16:04:47 -0400
committerPeter Hutterer <peter.hutterer@who-t.net>2011-03-29 11:36:34 +1000
commitac00ab77d5a00cfd198958aa1afaa4c3ccc6d7bc (patch)
treeb098bbb119f51d10bb74d44289d14379a3ff33b8 /dix
parent633b81e8ba09cc6a1ea8b43f323874fda2cf0bde (diff)
Clean up getValuatorEvents using array loop logic
Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/eventconvert.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index c9d199436..07d53e0f0 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -397,25 +397,17 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
/* 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++)
+ valuators[j] = ev->valuators.data[xv->first_valuator + j];
if (i + 6 < num_valuators)
xv->deviceid |= MORE_EVENTS;