summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-10-04 10:55:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-11-14 13:34:36 +1000
commit550baf38f6096658f0bcf0ad647c4fedf93132f2 (patch)
tree0070a11b6e0555c8f2a7842c6bd8f907a86f4c33
parenta94d945065177d73f3ee8dc0b9147264ba281136 (diff)
kdrive: fix cursor jumps on CursorOffScreen behavior
This patch fixes cursor jumps when there is a grab on the Xephyr window and the pointer moves outside the window. So on two side-by-side 640x480 screens, a coordinate of 0/481 triggers KdCursorOffscreen. If the delta between two screens is 0, they share the same offset for that dimension. When searching for the new screen, the loop always rules out the current screen. So we get to the second screen, trigger the conditions where dy <= 0 and decide that this new screen is the correct one. The result is that whenever KdCursorOffScreen is called, the pointer jumps to the other screen. Change to check for dy < 0 etc. so that the cursor stays on the same screen if there is no other screen at the target location. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/kdrive/src/kinput.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index abda69314..a9a9fa583 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2030,25 +2030,25 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
if (*x < 0) {
- if (dx <= 0 && -dx < best_x) {
+ if (dx < 0 && -dx < best_x) {
best_x = -dx;
n_best_x = n;
}
}
else if (*x >= pScreen->width) {
- if (dx >= 0 && dx < best_x) {
+ if (dx > 0 && dx < best_x) {
best_x = dx;
n_best_x = n;
}
}
if (*y < 0) {
- if (dy <= 0 && -dy < best_y) {
+ if (dy < 0 && -dy < best_y) {
best_y = -dy;
n_best_y = n;
}
}
else if (*y >= pScreen->height) {
- if (dy >= 0 && dy < best_y) {
+ if (dy > 0 && dy < best_y) {
best_y = dy;
n_best_y = n;
}