From 11a661ce3ad492be131c507fede4123d1b14695e Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 19 Aug 2021 16:12:11 -0400 Subject: [PATCH] [client] spice: don't display mouse before realignment finishes This avoids showing the mouse briefly at the old position when reentering the window. --- client/src/core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/src/core.c b/client/src/core.c index ab51a6ad..3a778ebb 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -385,25 +385,25 @@ void core_handleMouseNormal(double ex, double ey) } bool testExit = true; + const bool inView = isInView(); if (!g_cursor.inView) { - const bool inView = isInView(); - core_setCursorInView(inView); if (inView) g_cursor.realign = true; + else /* nothing to do if we are outside the viewport */ + return; } - /* nothing to do if we are outside the viewport */ - if (!g_cursor.inView) - return; - /* * do not pass mouse events to the guest if we do not have focus, this must be * done after the inView test has been performed so that when focus is gained * we know if we should be drawing the cursor. */ if (!g_state.focused) + { + core_setCursorInView(inView); return; + } /* if we have been instructed to realign */ if (g_cursor.realign) @@ -440,6 +440,7 @@ void core_handleMouseNormal(double ex, double ey) g_cursor.guest.x = msg.x; g_cursor.guest.y = msg.y; g_cursor.realign = false; + core_setCursorInView(true); return; } } @@ -448,6 +449,7 @@ void core_handleMouseNormal(double ex, double ey) /* add the difference to the offset */ ex += guest.x - (g_cursor.guest.x + g_cursor.guest.hx); ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy); + core_setCursorInView(true); } g_cursor.realign = false;