[client] moved null cursor init to the initial startup

This commit is contained in:
Geoffrey McRae 2017-10-27 06:31:05 +11:00
parent a7df6a261e
commit 54df567b84

View File

@ -390,13 +390,6 @@ int eventThread(void * arg)
spice_mouse_mode(true); spice_mouse_mode(true);
SDL_SetRelativeMouseMode(true); SDL_SetRelativeMouseMode(true);
// work around SDL_ShowCursor being non functional
SDL_Cursor *cursor;
int32_t cursorData[2] = {0, 0};
cursor = SDL_CreateCursor((uint8_t*)cursorData, (uint8_t*)cursorData, 8, 8, 4, 4);
SDL_SetCursor(cursor);
SDL_ShowCursor(SDL_DISABLE);
// ensure mouse acceleration is identical in server mode // ensure mouse acceleration is identical in server mode
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE); SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE);
@ -513,8 +506,6 @@ int eventThread(void * arg)
usleep(1000); usleep(1000);
} }
SDL_FreeCursor(cursor);
return 0; return 0;
} }
@ -536,6 +527,13 @@ int main(int argc, char * argv[])
return -1; return -1;
} }
// work around SDL_ShowCursor being non functional
SDL_Cursor *cursor = NULL;
int32_t cursorData[2] = {0, 0};
cursor = SDL_CreateCursor((uint8_t*)cursorData, (uint8_t*)cursorData, 8, 8, 4, 4);
SDL_SetCursor(cursor);
SDL_ShowCursor(SDL_DISABLE);
state.renderer = SDL_CreateRenderer(state.window, -1, state.renderer = SDL_CreateRenderer(state.window, -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
@ -627,6 +625,9 @@ int main(int argc, char * argv[])
if (state.window) if (state.window)
SDL_DestroyWindow(state.window); SDL_DestroyWindow(state.window);
if (cursor)
SDL_FreeCursor(cursor);
if (shm_fd) if (shm_fd)
close(shm_fd); close(shm_fd);