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.
This commit is contained in:
Peter Hutterer 2008-05-22 23:27:15 +09:30
parent 1a3f351c50
commit 7f85acdf70

View File

@ -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 */