mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-02-16 02:30:52 +00:00
Fix forcing X11 SDL video driver on XWayland when not built with Wayland
This commit is contained in:
19
app/main.cpp
19
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") {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user