From 9f495863cd5a3eb47f1340684e8593813028c7af Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 3 Jan 2021 17:42:58 +1100 Subject: [PATCH] [client] spice: take into account the render rect for the new x/y pos --- client/src/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 46f35d18..367e4193 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -837,8 +837,8 @@ static void handleMouseMoveEvent(int ex, int ey) { state.cursorInView = true; spice_mouse_motion(delta.x, delta.y); - if (ex < 100 || ex > state.windowW - 100 || - ey < 100 || ey > state.windowH - 100) + if (ex < 50 || ex > state.windowW - 50 || + ey < 50 || ey > state.windowH - 50) warpMouse(state.windowW / 2, state.windowH / 2); } @@ -885,8 +885,8 @@ static void handleMouseMoveEvent(int ex, int ey) } else if (inView) { - if (ex < 100 || ex > state.windowW - 100 || - ey < 100 || ey > state.windowH - 100) + if (ex < state.dstRect.x + 50 || ex > state.dstRect.w - 50 || + ey < state.dstRect.y + 50 || ey > state.dstRect.h - 50) warpMouse(state.windowW / 2, state.windowH / 2); } @@ -927,8 +927,11 @@ static void handleMouseMoveEvent(int ex, int ey) if (newPos.x < 0 || newPos.x >= state.dstRect.w || newPos.y < 0 || newPos.y >= state.dstRect.h) { - const int nx = state.windowPos.x + state.border.x + newPos.x; - const int ny = state.windowPos.y + state.border.y + newPos.y; + const int nx = state.windowPos.x + state.border.x + + state.dstRect.x + newPos.x; + const int ny = state.windowPos.y + state.border.y + + state.dstRect.y + newPos.y; + if (isValidCursorLocation(nx, ny)) { /* put the mouse where it should be and disable warp */