From 48f002992a9e397f313f59d743dd740cd911a75c Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 15 Jan 2021 05:27:33 -0500 Subject: [PATCH] [client] wayland: fix mouse logic after refactor Now correctly set inView to only be within the guest and not the letterboxed areas. Also show the system cursor in the letterboxed area. --- client/src/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 64a1420f..397c9017 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -945,6 +945,17 @@ static void guestCurToLocal(struct DoublePoint *local) // capture mode. static void app_handleMouseWayland(void) { + const bool inView = + g_cursor.pos.x >= g_state.dstRect.x && + g_cursor.pos.x < g_state.dstRect.x + g_state.dstRect.w && + g_cursor.pos.y >= g_state.dstRect.y && + g_cursor.pos.y < g_state.dstRect.y + g_state.dstRect.h; + + if (params.hideMouse && inView != g_cursor.inView) + SDL_ShowCursor(inView ? SDL_DISABLE : SDL_ENABLE); + + g_cursor.inView = inView; + if (g_cursor.guest.dpiScale == 0) return;