[PATCH 4/4] kdrive: fix cursor jumps on CursorOffScreen behavior
Keith Packard
keithp at keithp.com
Wed Nov 13 18:38:51 PST 2013
Peter Hutterer <peter.hutterer at who-t.net> writes:
> 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.
Reviewed-by: Keith Packard <keithp at keithp.com>
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> hw/kdrive/src/kinput.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
> index 226c2e6..40aca60 100644
> --- a/hw/kdrive/src/kinput.c
> +++ b/hw/kdrive/src/kinput.c
> @@ -2029,25 +2029,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;
> }
> --
> 1.8.3.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131114/ab65d4c1/attachment-0001.pgp>
More information about the xorg-devel
mailing list