From 95205ca9670e7c5b270703a538a13f50ecf76f00 Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 12 Jan 2021 16:22:03 -0500 Subject: [PATCH] [client] spice/wayland: use correct coordinate space This will now correctly respect the cursor hotspot. --- client/src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index c860c631..6a5f5ca2 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -920,8 +920,12 @@ static void guestCurToLocal(struct DoublePoint *local) // capture mode. static void handleMouseWayland() { - double ex = (g_cursor.pos.x - g_cursor.guest.x) / g_cursor.dpiScale; - double ey = (g_cursor.pos.y - g_cursor.guest.y) / g_cursor.dpiScale; + /* translate the guests position to our coordinate space */ + struct DoublePoint local; + guestCurToLocal(&local); + + double ex = (g_cursor.pos.x - local.x) / g_cursor.dpiScale; + double ey = (g_cursor.pos.y - local.y) / g_cursor.dpiScale; int x, y; cursorToInt(ex, ey, &x, &y);