evdev: Use temporary x and y coordinates when applying calibration

Don't overwrite device->abs.x halfway through the matrix multiplication.
dev
Kristian Høgsberg 12 years ago
parent cee407e0c0
commit 58014bbba8
  1. 17
      src/evdev.c

@ -230,16 +230,21 @@ is_motion_event(struct input_event *e)
static void
transform_absolute(struct evdev_device *device)
{
int32_t x, y;
if (!device->abs.apply_calibration)
return;
device->abs.x = device->abs.x * device->abs.calibration[0] +
device->abs.y * device->abs.calibration[1] +
device->abs.calibration[2];
x = device->abs.x * device->abs.calibration[0] +
device->abs.y * device->abs.calibration[1] +
device->abs.calibration[2];
y = device->abs.x * device->abs.calibration[3] +
device->abs.y * device->abs.calibration[4] +
device->abs.calibration[5];
device->abs.y = device->abs.x * device->abs.calibration[3] +
device->abs.y * device->abs.calibration[4] +
device->abs.calibration[5];
device->abs.x = x;
device->abs.y = y;
}
static void

Loading…
Cancel
Save