Add option to FORCE_X11 Graphics Backend
All checks were successful
eden-license / license-header (pull_request) Successful in 19s
All checks were successful
eden-license / license-header (pull_request) Successful in 19s
Signed-off-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
This commit is contained in:
parent
6510818fca
commit
466472e89f
4 changed files with 60 additions and 0 deletions
|
@ -643,6 +643,8 @@ struct Values {
|
|||
|
||||
// Linux
|
||||
SwitchableSetting<bool> enable_gamemode{linkage, true, "enable_gamemode", Category::Linux};
|
||||
SwitchableSetting<bool> force_x11{linkage, false, "force_x11", Category::Linux};
|
||||
Setting<bool> hide_backend_warning_popup{linkage, false, "hide_backend_warning_popup", Category::Linux};
|
||||
|
||||
// Controls
|
||||
InputSetting<std::array<PlayerInput, 10>> players;
|
||||
|
|
|
@ -451,6 +451,8 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent)
|
|||
|
||||
// Linux
|
||||
INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString());
|
||||
INSERT(Settings, force_x11, tr("Force X11 as Graphics Backend"), QString());
|
||||
INSERT(Settings, hide_backend_warning_popup, QString(), QString());
|
||||
|
||||
// Ui Debugging
|
||||
|
||||
|
|
|
@ -545,6 +545,10 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|||
// Gen keys if necessary
|
||||
OnCheckFirmwareDecryption();
|
||||
|
||||
#ifdef __unix__
|
||||
OnCheckBackend();
|
||||
#endif
|
||||
|
||||
game_list->LoadCompatibilityList();
|
||||
// force reload on first load to ensure add-ons get updated
|
||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||
|
@ -4454,6 +4458,49 @@ void GMainWindow::OnCheckFirmwareDecryption() {
|
|||
UpdateMenuState();
|
||||
}
|
||||
|
||||
#ifdef __unix__
|
||||
void GMainWindow::OnCheckBackend() {
|
||||
QByteArray qtPlatform = qgetenv("QT_QPA_PLATFORM");
|
||||
bool isWayland = qtPlatform.isEmpty() || qtPlatform == "wayland" || qtPlatform == "wayland-egl";
|
||||
|
||||
if (!isWayland)
|
||||
return;
|
||||
|
||||
const bool currently_hidden = Settings::values.hide_backend_warning_popup.GetValue();
|
||||
if (currently_hidden)
|
||||
return;
|
||||
|
||||
QMessageBox msgbox(this);
|
||||
msgbox.setWindowTitle(tr("Wayland Detected"));
|
||||
msgbox.setText(tr("You are running Eden under Wayland.\n"
|
||||
"Some features may not work correctly.\n"
|
||||
"It is recommended to use X11 for the best compatibility."));
|
||||
msgbox.setIcon(QMessageBox::Warning);
|
||||
|
||||
QPushButton* okButton = msgbox.addButton(tr("Use X11"), QMessageBox::AcceptRole);
|
||||
QPushButton* cancelButton = msgbox.addButton(tr("Continue with Wayland"), QMessageBox::RejectRole);
|
||||
msgbox.setDefaultButton(okButton);
|
||||
|
||||
QCheckBox* cb = new QCheckBox(tr("Don't show again"), &msgbox);
|
||||
cb->setChecked(currently_hidden);
|
||||
msgbox.setCheckBox(cb);
|
||||
|
||||
msgbox.exec();
|
||||
|
||||
const bool hide = cb->isChecked();
|
||||
if (hide != currently_hidden) {
|
||||
Settings::values.hide_backend_warning_popup.SetValue(hide);
|
||||
}
|
||||
|
||||
if (msgbox.clickedButton() == okButton) {
|
||||
Settings::values.force_x11.SetValue(true);
|
||||
QMessageBox::information(this,
|
||||
tr("Restart Required"),
|
||||
tr("Restart Eden to apply the X11 backend."));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GMainWindow::CheckFirmwarePresence() {
|
||||
return FirmwareManager::CheckFirmwarePresence(*QtCommon::system.get());
|
||||
}
|
||||
|
@ -4944,6 +4991,12 @@ int main(int argc, char* argv[]) {
|
|||
qputenv("DISPLAY", ":0");
|
||||
}
|
||||
|
||||
// TODO: (DraVee) Un-alive the guy who wrote this
|
||||
const auto config_path = Common::FS::PathToUTF8String(Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir) / "qt-config.ini");
|
||||
const bool forceX11 = QSettings(QString::fromStdString(config_path), QSettings::IniFormat).value("Linux/force_x11", false).toBool();
|
||||
if (forceX11)
|
||||
qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
|
||||
// Fix the Wayland appId. This needs to match the name of the .desktop file without the .desktop
|
||||
// suffix.
|
||||
QGuiApplication::setDesktopFileName(QStringLiteral("dev.eden_emu.eden"));
|
||||
|
|
|
@ -411,6 +411,9 @@ private slots:
|
|||
void OnCreateHomeMenuApplicationMenuShortcut();
|
||||
void OnCaptureScreenshot();
|
||||
void OnCheckFirmwareDecryption();
|
||||
#ifdef __unix__
|
||||
void OnCheckBackend();
|
||||
#endif
|
||||
void OnLanguageChanged(const QString& locale);
|
||||
void OnMouseActivity();
|
||||
bool OnShutdownBegin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue