summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-03-28 16:04:47 -0400
committerChase Douglas <chase.douglas@canonical.com>2011-04-08 09:55:18 -0400
commita9c90ebe3357546fbd12430ca31623d419e77212 (patch)
tree16488fcbc36ed268a7081e9b508569dd56efe537 /dix
parent1f51fe4f748b2997e466863d8387bd6791b32931 (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> (cherry picked from commit ac00ab77d5a00cfd198958aa1afaa4c3ccc6d7bc)
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 dd1ca460b..3b2697f0a 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -373,25 +373,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;