[client] spice: don't display mouse before realignment finishes

This avoids showing the mouse briefly at the old position when reentering
the window.
This commit is contained in:
Quantum 2021-08-19 16:12:11 -04:00 committed by Geoffrey McRae
parent c246b4a719
commit 11a661ce3a

View File

@ -385,17 +385,14 @@ void core_handleMouseNormal(double ex, double ey)
} }
bool testExit = true; bool testExit = true;
const bool inView = isInView();
if (!g_cursor.inView) if (!g_cursor.inView)
{ {
const bool inView = isInView();
core_setCursorInView(inView);
if (inView) if (inView)
g_cursor.realign = true; g_cursor.realign = true;
} else /* nothing to do if we are outside the viewport */
/* nothing to do if we are outside the viewport */
if (!g_cursor.inView)
return; return;
}
/* /*
* do not pass mouse events to the guest if we do not have focus, this must be * do not pass mouse events to the guest if we do not have focus, this must be
@ -403,7 +400,10 @@ void core_handleMouseNormal(double ex, double ey)
* we know if we should be drawing the cursor. * we know if we should be drawing the cursor.
*/ */
if (!g_state.focused) if (!g_state.focused)
{
core_setCursorInView(inView);
return; return;
}
/* if we have been instructed to realign */ /* if we have been instructed to realign */
if (g_cursor.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.x = msg.x;
g_cursor.guest.y = msg.y; g_cursor.guest.y = msg.y;
g_cursor.realign = false; g_cursor.realign = false;
core_setCursorInView(true);
return; return;
} }
} }
@ -448,6 +449,7 @@ void core_handleMouseNormal(double ex, double ey)
/* add the difference to the offset */ /* add the difference to the offset */
ex += guest.x - (g_cursor.guest.x + g_cursor.guest.hx); ex += guest.x - (g_cursor.guest.x + g_cursor.guest.hx);
ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy); ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy);
core_setCursorInView(true);
} }
g_cursor.realign = false; g_cursor.realign = false;