[client] don't try to realign the mouse until we know where the mouse is

This commit is contained in:
Geoffrey McRae 2017-12-13 22:05:47 +11:00
parent 233b7755ae
commit afff50dfde

View File

@ -50,6 +50,7 @@ struct AppState
SDL_Point srcSize; SDL_Point srcSize;
LG_RendererRect dstRect; LG_RendererRect dstRect;
SDL_Point cursor; SDL_Point cursor;
bool haveCursorPos;
float scaleX, scaleY; float scaleX, scaleY;
const LG_Renderer * lgr ; const LG_Renderer * lgr ;
@ -313,8 +314,9 @@ int renderThread(void * unused)
{ {
if (header.cursor.flags & KVMFR_CURSOR_FLAG_POS) if (header.cursor.flags & KVMFR_CURSOR_FLAG_POS)
{ {
state.cursor.x = header.cursor.x; state.cursor.x = header.cursor.x;
state.cursor.y = header.cursor.y; state.cursor.y = header.cursor.y;
state.haveCursorPos = true;
} }
if (header.cursor.flags & KVMFR_CURSOR_FLAG_SHAPE) if (header.cursor.flags & KVMFR_CURSOR_FLAG_SHAPE)
@ -526,7 +528,7 @@ int eventThread(void * arg)
int x = 0; int x = 0;
int y = 0; int y = 0;
if (realignGuest) if (realignGuest && state.haveCursorPos)
{ {
x = event.motion.x - state.dstRect.x; x = event.motion.x - state.dstRect.x;
y = event.motion.y - state.dstRect.y; y = event.motion.y - state.dstRect.y;