From b3d97da35f74382c8808644b03ac8567b8373d44 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 7 May 2025 22:44:57 -0400 Subject: [PATCH] Add developer option to enable the Wine Wayland backend The current situation is still (unfortunately...) rough, but it could be useful to enable in some cases. Once it improves enough we can make it the default. --- launcher/config.kcfg | 3 +++ launcher/src/gamerunner.cpp | 7 +++++++ launcher/ui/Settings/DeveloperSettings.qml | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/launcher/config.kcfg b/launcher/config.kcfg index dec7a86..27bc083 100644 --- a/launcher/config.kcfg +++ b/launcher/config.kcfg @@ -54,5 +54,8 @@ SPDX-License-Identifier: CC0-1.0 api.github.com + + false + diff --git a/launcher/src/gamerunner.cpp b/launcher/src/gamerunner.cpp index 8cd5213..8786fa4 100644 --- a/launcher/src/gamerunner.cpp +++ b/launcher/src/gamerunner.cpp @@ -13,6 +13,7 @@ #include "utility.h" #include +#include using namespace Qt::StringLiterals; @@ -340,6 +341,12 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con const QString logDir = dataDir.absoluteFilePath(QStringLiteral("log")); env.insert(QStringLiteral("DXVK_LOG_PATH"), logDir); + + // Enable the Wayland backend if we detect we're running on Wayland, otherwise fallback to X11. + if (QGuiApplication::platformName() == QStringLiteral("wayland") && m_launcher.config()->enableWayland()) { + // We have to unset the DISPLAY variable for Wine to pick it up. + env.remove(QStringLiteral("DISPLAY")); + } #endif #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) diff --git a/launcher/ui/Settings/DeveloperSettings.qml b/launcher/ui/Settings/DeveloperSettings.qml index 095fd8f..86a3cbb 100644 --- a/launcher/ui/Settings/DeveloperSettings.qml +++ b/launcher/ui/Settings/DeveloperSettings.qml @@ -85,6 +85,23 @@ FormCard.FormCardPage { LauncherCore.config.save(); } } + + FormCard.FormDelegateSeparator { + above: renderDocCaptureDelegate + below: enableWaylandDelegate + } + + FormCard.FormCheckDelegate { + id: enableWaylandDelegate + + text: i18n("Run Game on Wayland") + description: i18n("Use the native Wine Wayland driver instead of going through XWayland.") + checked: LauncherCore.config.enableWayland + onCheckedChanged: { + LauncherCore.config.enableWayland = checked; + LauncherCore.config.save(); + } + } } FormCard.FormHeader {