From e70f585cfcf5dc7fa202f6aa76bb37460fe390d3 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 6 Jan 2021 08:34:14 +1100 Subject: [PATCH] [client] spice: fix rounding issue causing entry->exit in the same event This fixes an issue where the warp to center could break as the user moves their cursor slowly over one of the bottom or right edges of the screen while it's letterboxed. --- client/src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 8367ffed..c2f93852 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -889,8 +889,10 @@ static void handleMouseMoveEvent(int ex, int ey) g_cursor.warpState = WARP_STATE_ON; /* convert guest to local and calculate the delta */ - const int lx = ((g_cursor.guest.x + g_cursor.guest.hx) / g_cursor.scaleX) + g_state.dstRect.x; - const int ly = ((g_cursor.guest.y + g_cursor.guest.hy) / g_cursor.scaleY) + g_state.dstRect.y; + const int lx = (int)round(((g_cursor.guest.x + g_cursor.guest.hx) / + g_cursor.scaleX)) + g_state.dstRect.x; + const int ly = (int)round(((g_cursor.guest.y + g_cursor.guest.hy) / + g_cursor.scaleY)) + g_state.dstRect.y; delta.x = ex - lx; delta.y = ey - ly; }