[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.
This commit is contained in:
Geoffrey McRae 2021-01-06 08:34:14 +11:00
parent c2ad9666bb
commit e70f585cfc

View File

@ -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;
}