diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-09 11:30:46 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-06-05 12:10:15 +1000 |
commit | 889ce06946b8c1a246130a899e2702a3d7340fd2 (patch) | |
tree | b31d28467c5acac68fac34e5e49b62d5fbccbd68 | |
parent | 4c21adab7ce4290ea038e13dd20a850f50d95f23 (diff) |
dix: undo transformation for missing valuators (#49347)
last.valuators contains the transformed valuators of the device. If the
device submits events with x/y missing, we need to get that from
last.valuators and undo the transformation to that axis.
X.Org Bug 49347 <http://bugs.freedesktop.org/show_bug.cgi?id=49347>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 749a593e49adccdf1225be28a521412ec85333f4)
-rw-r--r-- | dix/getevents.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 609379913..dc02611c3 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1151,16 +1151,33 @@ static void transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) { double x, y, ox, oy; + int has_x, has_y; + + has_x = valuator_mask_fetch_double(mask, 0, &ox); + has_y = valuator_mask_fetch_double(mask, 1, &oy); + + if (!has_x && !has_y) + return; + + if (!has_x || !has_y) { + struct pixman_f_transform invert; + + /* undo transformation from last event */ + ox = dev->last.valuators[0]; + oy = dev->last.valuators[1]; + + pixman_f_transform_invert(&invert, &dev->transform); + transform(&invert, &ox, &oy); + + x = ox; + y = oy; + } if (valuator_mask_isset(mask, 0)) ox = x = valuator_mask_get_double(mask, 0); - else - ox = x = dev->last.valuators[0]; if (valuator_mask_isset(mask, 1)) oy = y = valuator_mask_get_double(mask, 1); - else - oy = y = dev->last.valuators[1]; transform(&dev->transform, &x, &y); |