From a013372be425319acc260b4aa8c2562673d06801 Mon Sep 17 00:00:00 2001 From: DynamoFox Date: Fri, 26 Jul 2024 18:14:55 +0200 Subject: [PATCH] Fix game launch on Wayland-only systems with SDL2.30+ --- src/engine/client/backend_sdl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 41020b61d..0adfd82d2 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -1019,6 +1019,13 @@ int CGraphicsBackend_SDL_GL::Init(const char *pName, int *pScreen, int *pWidth, SDL_GetVersion(&Linked); dbg_msg("sdl", "SDL version %d.%d.%d (compiled = %d.%d.%d)", Linked.major, Linked.minor, Linked.patch, Compiled.major, Compiled.minor, Compiled.patch); + +#if CONF_PLATFORM_LINUX && SDL_VERSION_ATLEAST(2, 0, 22) + // needed to workaround SDL from forcing exclusively X11 if linking against the GLX flavour of GLEW instead of the EGL one + // w/o this on Wayland systems (no XWayland support) SDL's Video subsystem will fail to load (starting from SDL2.30+) + if(Linked.major == 2 && Linked.minor >= 30) + SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11,wayland"); +#endif } if(!SDL_WasInit(SDL_INIT_VIDEO))