From 5761f533abda284dab92821e11b27a5fc1bd6554 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 9 Jan 2022 19:41:56 -0600 Subject: [PATCH] Grab mouse only once streaming has started --- src/sdl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sdl.c b/src/sdl.c index a49d02e..95b3a1f 100644 --- a/src/sdl.c +++ b/src/sdl.c @@ -50,7 +50,6 @@ void sdl_init(int width, int height, bool fullscreen) { exit(1); } - SDL_SetRelativeMouseMode(SDL_TRUE); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (!renderer) { printf("SDL_CreateRenderer failed: %s\n", SDL_GetError()); @@ -72,6 +71,9 @@ void sdl_init(int width, int height, bool fullscreen) { void sdl_loop() { SDL_Event event; + + SDL_SetRelativeMouseMode(SDL_TRUE); + while(!done && SDL_WaitEvent(&event)) { switch (sdlinput_handle_event(&event)) { case SDL_QUIT_APPLICATION: