summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-05-22 23:27:15 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-05-22 23:27:15 +0930
commit7f85acdf70c67c567de688439e25081be5a7d5df (patch)
tree9029f3f09c6a8cb23bb51058c1ba023980aeef0b
parent1a3f351c50cba66f71a73239318174b09fd9b63b (diff)
dix: fill valuators with the correct values depending on the device mode (GPE)
valuators[] is passed from the DDX. Depending on the device mode, update it with either absolute values or relative values. The deviceValuator event sent to the client will then contain the respective values.
-rw-r--r--dix/getevents.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 15e7f3b3c..fafb632b8 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -827,19 +827,23 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
master->lasty = pDev->lasty;
}
- /* update the contents of the valuators based on the mode of the InputDevice */
- if(1) { /*TODO Absolute mode */
- /* Update the valuators with the true value sent to the client
- * (only absolute mode on the InputDevice) */
+ /* update the valuators based on the mode of the InputDevice */
+ if(pDev->valuator->mode == Absolute) {
+ /* Update the valuators with the true value sent to the client*/
if (first_valuator == 0 && num_valuators >= 1)
- pDev->valuator->axisVal[0] = x;
+ valuators[0] = x;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
- pDev->valuator->axisVal[1] = y;
+ valuators[1] = y;
} else {/* Relative mode */
/* If driver reported in absolute, calculate the relative valuator
* values as a delta from the old absolute values of the valuator
* values. If relative report, keep it as-is.*/
- /*TODO*/
+ if (flags & POINTER_ABSOLUTE) {
+ int i;
+ for (i = first_valuator; i < num_valuators; i++)
+ valuators[i] = valuators[i] - pDev->valuator->axisVal[i];
+
+ }
}
/* Save the last calculated device axis value in the device
* valuator for next event */