Merge pull request #8653 from DynamoFox/force-sdl2-video-driver-selection-on-linux

Fix game launch on Wayland-only systems with SDL2.30+
This commit is contained in:
Dennis Felsing 2024-08-29 16:06:03 +00:00 committed by GitHub
commit 41cd82c2d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1019,6 +1019,13 @@ int CGraphicsBackend_SDL_GL::Init(const char *pName, int *pScreen, int *pWidth,
SDL_GetVersion(&Linked); SDL_GetVersion(&Linked);
dbg_msg("sdl", "SDL version %d.%d.%d (compiled = %d.%d.%d)", Linked.major, Linked.minor, Linked.patch, dbg_msg("sdl", "SDL version %d.%d.%d (compiled = %d.%d.%d)", Linked.major, Linked.minor, Linked.patch,
Compiled.major, Compiled.minor, Compiled.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)) if(!SDL_WasInit(SDL_INIT_VIDEO))