summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-12-06 12:58:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-12-17 15:03:18 +1000
commitc50db6faba4ee1c27b735c6e9c98a4276ba3c7ff (patch)
treea14b394769fb7f365f25f18d93c99bd5cb71846d /mi
parent21a15f9a04ec0a6c8f654eef943561e98db2475d (diff)
Xi: fill in barrier root x/y after clamping to RandR outputs
x/y for barrier events should contain the actual pointer position. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/mipointer.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mi/mipointer.c b/mi/mipointer.c
index f4fbd2912..7bc09830a 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -573,6 +573,8 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
ScreenPtr newScreen;
int x, y;
Bool switch_screen = FALSE;
+ Bool should_constrain_barriers = FALSE;
+ int i;
miPointerPtr pPointer;
@@ -589,7 +591,9 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
x -= pScreen->x;
y -= pScreen->y;
- if (mode == Relative) {
+ should_constrain_barriers = (mode == Relative);
+
+ if (should_constrain_barriers) {
/* coordinates after clamped to a barrier */
int constrained_x, constrained_y;
int current_x, current_y; /* current position in per-screen coord */
@@ -637,6 +641,18 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
miPointerMoveNoEvent(pDev, pScreen, x, y);
+ /* check if we generated any barrier events and if so, update root x/y
+ * to the fully constrained coords */
+ if (should_constrain_barriers) {
+ for (i = 0; i < *nevents; i++) {
+ if (events[i].any.type == ET_BarrierHit ||
+ events[i].any.type == ET_BarrierLeave) {
+ events[i].barrier_event.root_x = x;
+ events[i].barrier_event.root_y = y;
+ }
+ }
+ }
+
/* Convert to desktop coordinates again */
x += pScreen->x;
y += pScreen->y;