[client] realign mouse on window changes

This commit is contained in:
Geoffrey McRae 2017-10-29 15:11:37 +11:00
parent 828cc1d4b7
commit 3907ded0c7

View file

@ -40,6 +40,8 @@ struct KVMGFXState
{
bool running;
bool started;
bool windowChanged;
SDL_Window * window;
SDL_Renderer * renderer;
struct KVMGFXHeader * shm;
@ -316,6 +318,7 @@ int renderThread(void * unused)
SDL_LockTexture(texture, NULL, (void**)&texPixels, &unused);
memcpy(&format, state.shm, sizeof(format));
state.windowChanged = true;
}
glDisable(GL_COLOR_LOGIC_OP);
@ -406,6 +409,14 @@ int eventThread(void * arg)
init = true;
}
if (state.windowChanged)
{
mouseX = state.shm->mouseX;
mouseY = state.shm->mouseY;
SDL_WarpMouseInWindow(state.window, mouseX, mouseY);
state.windowChanged = false;
}
switch(event.type)
{
case SDL_KEYDOWN: