mirror of
https://github.com/SourMesen/Mesen2.git
synced 2026-01-09 05:40:53 +08:00
Linux: SDL2 - Try to use X11 video driver first, the default on some systems (e.g Wayland on Fedora 42) causes the application to crash
This commit is contained in:
parent
a17bb92dbb
commit
0cd2f38943
@ -40,6 +40,8 @@ void SdlRenderer::SetExclusiveFullscreenMode(bool fullscreen, void* windowHandle
|
||||
|
||||
bool SdlRenderer::Init()
|
||||
{
|
||||
const char* originalHint = SDL_GetHint("SDL_VIDEODRIVER");
|
||||
SDL_SetHint("SDL_VIDEODRIVER", "x11");
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
|
||||
LogSdlError("[SDL] Failed to initialize video subsystem.");
|
||||
return false;
|
||||
@ -47,10 +49,10 @@ bool SdlRenderer::Init()
|
||||
|
||||
_sdlWindow = SDL_CreateWindowFrom(_windowHandle);
|
||||
if(!_sdlWindow) {
|
||||
MessageManager::Log("[SDL] Failed to create window from handle, retry with SDL_VIDEODRIVER=x11...");
|
||||
MessageManager::Log("[SDL] Failed to create window from handle with SDL_VIDEODRIVER=x11, retry with default...");
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_SetHint("SDL_VIDEODRIVER", "x11");
|
||||
SDL_SetHint("SDL_VIDEODRIVER", originalHint);
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
|
||||
LogSdlError("[SDL] Failed to initialize video subsystem.");
|
||||
return false;
|
||||
@ -61,7 +63,7 @@ bool SdlRenderer::Init()
|
||||
LogSdlError("[SDL] Failed to create window from handle.");
|
||||
return false;
|
||||
} else {
|
||||
MessageManager::Log("[SDL] Window creation succeeded with SDL_VIDEODRIVER=x11");
|
||||
MessageManager::Log("[SDL] Window creation succeeded with default driver.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user