From 402ac59390a6329aeaf62a2774a8bee4a974691e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 27 Jan 2026 21:10:52 -0600 Subject: [PATCH] Fix forcing X11 SDL video driver on XWayland when not built with Wayland --- app/main.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index 0beaa422..79587431 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -693,14 +693,6 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); -#ifndef STEAM_LINK - // Force use of the KMSDRM backend for SDL when using Qt platform plugins - // that directly draw to the display without a windowing system. - if (QGuiApplication::platformName() == "eglfs" || QGuiApplication::platformName() == "linuxfb") { - qputenv("SDL_VIDEODRIVER", "kmsdrm"); - } -#endif - #ifdef Q_OS_UNIX // Register signal handlers to arbitrate between SDL and Qt. // NB: This has to be done after the QGuiApplication is constructed to @@ -774,15 +766,24 @@ int main(int argc, char *argv[]) // After the QGuiApplication is created, the platform stuff will be initialized // and we can set the SDL video driver to match Qt. - if (WMUtils::isRunningWayland() && QGuiApplication::platformName() == "xcb") { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11."); + if (QGuiApplication::platformName() == "xcb") { + if (WMUtils::isRunningWayland()) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11."); + } qputenv("SDL_VIDEODRIVER", "x11"); } else if (QGuiApplication::platformName().startsWith("wayland")) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Detected Wayland"); qputenv("SDL_VIDEODRIVER", "wayland"); } +#ifndef STEAM_LINK + // Force use of the KMSDRM backend for SDL when using Qt platform plugins + // that directly draw to the display without a windowing system. + else if (QGuiApplication::platformName() == "eglfs" || QGuiApplication::platformName() == "linuxfb") { + qputenv("SDL_VIDEODRIVER", "kmsdrm"); + } +#endif #ifdef STEAM_LINK // Qt 5.9 from the Steam Link SDK is not able to load any fonts