summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-11-24 19:39:47 -0500
committerPeter Hutterer <peter.hutterer@who-t.net>2012-12-17 15:01:33 +1000
commit7e16dd3628334a5991b6713d778a46c1ce3b8b78 (patch)
treee5d741145e229336727c3d59d9ece1592d7e4768 /mi
parent2868a93945f043e1efd897d56543fe673e341faf (diff)
barriers: Switch to an explicit hook for barrier constrainment
Rather than riding on the ConstrainCursorHarder hook, which has several issues, move to an explicit hook, which will help us with some RANDR interaction issues. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/mipointer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mi/mipointer.c b/mi/mipointer.c
index f34506326..d1708249f 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -588,6 +588,22 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
x -= pScreen->x;
y -= pScreen->y;
+ if (mode == Relative) {
+ /* coordinates after clamped to a barrier */
+ int constrained_x, constrained_y;
+ int current_x, current_y; /* current position in per-screen coord */
+
+ current_x = MIPOINTER(pDev)->x - pScreen->y;
+ current_y = MIPOINTER(pDev)->y - pScreen->x;
+
+ input_constrain_cursor(pDev, pScreen,
+ current_x, current_y, x, y,
+ &constrained_x, &constrained_y);
+
+ x = constrained_x;
+ y = constrained_y;
+ }
+
if (switch_screen) {
pScreenPriv = GetScreenPrivate(pScreen);
if (!pPointer->confined) {