From c0eda78e436634a079582536737634315ededd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Sat, 16 Nov 2024 15:37:43 +0100 Subject: [PATCH] sdl2: avoid spamming warnings when setting relative mouse mode fails --- src/client/vid/glimp_sdl2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/vid/glimp_sdl2.c b/src/client/vid/glimp_sdl2.c index d2a72591..6a133392 100644 --- a/src/client/vid/glimp_sdl2.c +++ b/src/client/vid/glimp_sdl2.c @@ -720,13 +720,15 @@ GLimp_ShutdownGraphics(void) void GLimp_GrabInput(qboolean grab) { + static qboolean seen_error = false; if(window != NULL) { 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(" You should probably update to SDL 2.0.3 or newer!\n"); }