From afff50dfde807e7c94f49ce45bbe77d6af3adf40 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 13 Dec 2017 22:05:47 +1100 Subject: [PATCH] [client] don't try to realign the mouse until we know where the mouse is --- client/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/main.c b/client/main.c index 6262755c..8136081d 100644 --- a/client/main.c +++ b/client/main.c @@ -50,6 +50,7 @@ struct AppState SDL_Point srcSize; LG_RendererRect dstRect; SDL_Point cursor; + bool haveCursorPos; float scaleX, scaleY; const LG_Renderer * lgr ; @@ -313,8 +314,9 @@ int renderThread(void * unused) { if (header.cursor.flags & KVMFR_CURSOR_FLAG_POS) { - state.cursor.x = header.cursor.x; - state.cursor.y = header.cursor.y; + state.cursor.x = header.cursor.x; + state.cursor.y = header.cursor.y; + state.haveCursorPos = true; } if (header.cursor.flags & KVMFR_CURSOR_FLAG_SHAPE) @@ -526,7 +528,7 @@ int eventThread(void * arg) int x = 0; int y = 0; - if (realignGuest) + if (realignGuest && state.haveCursorPos) { x = event.motion.x - state.dstRect.x; y = event.motion.y - state.dstRect.y;