From 86ca1bbbd67c5d90efdfe87abfff11fdc37da762 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 8 Jan 2021 21:46:34 +1100 Subject: [PATCH] [client] fix issues with cursor not always showing --- client/src/main.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index a48e05a7..f5db9833 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -285,7 +285,7 @@ static int cursorThread(void * unused) { if (status == LGMP_ERR_QUEUE_EMPTY) { - if (g_cursor.redraw) + if (g_cursor.redraw && g_cursor.guest.valid) { g_cursor.redraw = false; g_state.lgr->on_mouse_event @@ -899,10 +899,16 @@ static void handleMouseNormal(double ex, double ey) if (inView) { + if (params.hideMouse) + SDL_ShowCursor(SDL_DISABLE); + if (g_state.focused) { /* the cursor moved in, enable grab mode */ g_cursor.inView = true; + g_cursor.draw = true; + g_cursor.redraw = true; + g_cursor.warpState = WARP_STATE_ON; XGrabPointer( @@ -968,8 +974,16 @@ static void handleMouseNormal(double ex, double ey) g_state.windowPos.x + g_state.border.x + tx, g_state.windowPos.y + g_state.border.y + ty)) { + if (params.hideMouse) + SDL_ShowCursor(SDL_ENABLE); + g_cursor.inView = false; + if(!params.alwaysShowCursor) + g_cursor.draw = false; + + g_cursor.redraw = true; + /* pre-empt the window leave flag if the warp will leave our window */ if (tx < 0 || ty < 0 || tx > g_state.windowW || ty > g_state.windowH) g_cursor.inWindow = false; @@ -1050,9 +1064,6 @@ static void handleWindowEnter() if (!params.useSpiceInput) return; - if (!g_cursor.guest.valid) - return; - g_cursor.draw = true; g_cursor.redraw = true; }