summaryrefslogtreecommitdiff
path: root/dix/getevents.c
diff options
context:
space:
mode:
authorYufeng Shen <miletus@chromium.org>2012-09-24 14:03:31 -0400
committerKeith Packard <keithp@keithp.com>2012-09-24 11:12:04 -0700
commit0b02150c27e98f996e10d7489f9f67a30e4e3497 (patch)
tree1dd96721bc85977cb8270514e1bd9fef8f4cbdc3 /dix/getevents.c
parent7722bcbab2507d263c7685b15cccbfdd52fc3a24 (diff)
dix: fix scale_to_desktop for edge ABS events
Scale_to_desktop() converts ABS events from device coordinates to screen coordinates: [dev_X_min, dev_X_max] -> [screen_X_min, screen_X_max] [dev_Y_min, dev_Y_max] -> [screen_Y_min, screen_Y_max] An edge ABS event with X = dev_X_max (e.g., generated from the edge of a touchscreen) will be converted to have screen X value = screen_X_max, which, however, will be filterd out when xserver tries to find proper Window to receive the event, because the range check for a Window to receive events is window_X_min <= event_screen_X < window_X_max Events with event_screen_X = screen_X_max will fail the test get and rejected by the Window. To fix this, we change the device to screen coordinates mapping to [dev_X_min, dev_X_max] -> [screen_X_min, screen_X_max-1] [dev_Y_min, dev_Y_max] -> [screen_Y_min, screen_Y_max-1] Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Signed-off-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix/getevents.c')
-rw-r--r--dix/getevents.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 4e62507aa..71d83c4ba 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -896,9 +896,9 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
/* scale x&y to desktop coordinates */
*screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
- screenInfo.x, screenInfo.width);
+ screenInfo.x, screenInfo.width - 1);
*screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
- screenInfo.y, screenInfo.height);
+ screenInfo.y, screenInfo.height - 1);
*devx = x;
*devy = y;