From 5064a4ecddd9f512202bbcfe7c698b62bb122bef Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 3 Jan 2021 15:52:47 +1100 Subject: [PATCH] [client] spice: take the cursor hotspot into account --- client/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index d1658b48..15b14a04 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -869,8 +869,8 @@ static void handleMouseMoveEvent(int ex, int ey) state.warpState = WARP_STATE_ON; /* convert guest to local and calculate the delta */ - const int lx = (state.cursor.x / state.scaleX) + state.dstRect.x; - const int ly = (state.cursor.y / state.scaleY) + state.dstRect.y; + const int lx = ((state.cursor.x + state.cursor.hx) / state.scaleX) + state.dstRect.x; + const int ly = ((state.cursor.y + state.cursor.hy) / state.scaleY) + state.dstRect.y; delta.x = ex - lx; delta.y = ey - ly; } @@ -913,8 +913,8 @@ static void handleMouseMoveEvent(int ex, int ey) if (!state.grabMouse && state.warpState == WARP_STATE_ON) { const SDL_Point newPos = { - .x = (float)(state.cursor.x + delta.x) / state.scaleX, - .y = (float)(state.cursor.y + delta.y) / state.scaleY + .x = (float)(state.cursor.x + state.cursor.hx + delta.x) / state.scaleX, + .y = (float)(state.cursor.y + state.cursor.hy + delta.y) / state.scaleY }; /* check if the movement would exit the window */