sdl2: avoid spamming warnings when setting relative mouse mode fails

This commit is contained in:
John Törnblom 2024-11-16 15:37:43 +01:00
parent 0ea0dbf4ac
commit c0eda78e43

View file

@ -720,13 +720,15 @@ GLimp_ShutdownGraphics(void)
void void
GLimp_GrabInput(qboolean grab) GLimp_GrabInput(qboolean grab)
{ {
static qboolean seen_error = false;
if(window != NULL) if(window != NULL)
{ {
SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE); SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE);
} }
if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0) if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0 && !seen_error)
{ {
seen_error = true;
Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError()); Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
Com_Printf(" You should probably update to SDL 2.0.3 or newer!\n"); Com_Printf(" You should probably update to SDL 2.0.3 or newer!\n");
} }