Linux: Force SDL2 video driver selection to X11

This commit is contained in:
Nadia Holmquist Pedersen 2024-05-19 13:14:42 +02:00
parent 0b609752ce
commit 4db8bf072b
1 changed files with 5 additions and 0 deletions

View File

@ -51,6 +51,11 @@ ultramodern::gfx_callbacks_t::gfx_data_t create_gfx() {
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
#if defined(__linux__) && defined(SDL_VIDEO_DRIVER_WAYLAND)
SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11");
#endif
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) > 0) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) > 0) {
exit_error("Failed to initialize SDL2: %s\n", SDL_GetError()); exit_error("Failed to initialize SDL2: %s\n", SDL_GetError());
} }