From 2bdd8c2d5a5df0deeebf6235b7e6721a9565abef Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 31 Mar 2025 01:19:34 +0300 Subject: [PATCH] apply suggestion Signed-off-by: Trial97 --- launcher/Application.cpp | 2 +- launcher/DesktopServices.cpp | 4 ++-- launcher/DesktopServices.h | 2 +- launcher/ui/InstanceWindow.cpp | 2 +- launcher/ui/MainWindow.cpp | 2 +- launcher/ui/dialogs/AboutDialog.cpp | 2 +- launcher/ui/dialogs/ExportInstanceDialog.cpp | 2 +- launcher/ui/dialogs/ExportPackDialog.cpp | 2 +- launcher/ui/dialogs/ExportToModListDialog.cpp | 2 +- launcher/ui/dialogs/InstallLoaderDialog.cpp | 2 +- launcher/ui/dialogs/NewInstanceDialog.cpp | 2 +- launcher/ui/dialogs/NewsDialog.cpp | 2 +- launcher/ui/dialogs/ResourceDownloadDialog.cpp | 8 ++++---- launcher/ui/dialogs/VersionSelectDialog.cpp | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index cbb21e38c..edfdb0f03 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1673,7 +1673,7 @@ void Application::ShowGlobalSettings(class QWidget* parent, QString open_page) SettingsObject::Lock lock(APPLICATION->settings()); PageDialog dlg(m_globalSettingsProvider.get(), open_page, parent); connect(&dlg, &PageDialog::applied, this, &Application::globalSettingsApplied); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { dlg.showFullScreen(); dlg.setFixedSize(dlg.width(), dlg.height()); } diff --git a/launcher/DesktopServices.cpp b/launcher/DesktopServices.cpp index 2194d9379..81d97c2ef 100644 --- a/launcher/DesktopServices.cpp +++ b/launcher/DesktopServices.cpp @@ -84,9 +84,9 @@ bool isSnap() #endif } -bool isGameScope() +bool isSteamDeckGameScope() { - return qgetenv("XDG_CURRENT_DESKTOP") == "gamescope"; + return qgetenv("XDG_CURRENT_DESKTOP") == "gamescope" && qgetenv("STEAM_DECK") == "1"; } } // namespace DesktopServices diff --git a/launcher/DesktopServices.h b/launcher/DesktopServices.h index c788264aa..e82eeacdb 100644 --- a/launcher/DesktopServices.h +++ b/launcher/DesktopServices.h @@ -45,5 +45,5 @@ bool isSnap(); /** * Determine whether the launcher is running in a gamescope environment */ -bool isGameScope(); +bool isSteamDeckGameScope(); } // namespace DesktopServices diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp index 2c49cb26c..b22e4203c 100644 --- a/launcher/ui/InstanceWindow.cpp +++ b/launcher/ui/InstanceWindow.cpp @@ -119,7 +119,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget* parent) : QMainWin { auto base64State = APPLICATION->settings()->get("ConsoleWindowState").toString().toUtf8(); restoreState(QByteArray::fromBase64(base64State)); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } else { diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index a67ecdd0e..fc5ef12e5 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -232,7 +232,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi // add a close button at the end of the main toolbar when running on gamescope / steam deck // this is only needed on gamescope because it defaults to an X11/XWayland session and // does not implement decorations - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { ui->mainToolBar->addAction(ui->actionCloseWindow); showFullScreen(); setFixedSize(this->width(), this->height()); diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp index f1d6132dd..3eb17d470 100644 --- a/launcher/ui/dialogs/AboutDialog.cpp +++ b/launcher/ui/dialogs/AboutDialog.cpp @@ -181,7 +181,7 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDia connect(ui->closeButton, &QPushButton::clicked, this, &AboutDialog::close); connect(ui->aboutQt, &QPushButton::clicked, &QApplication::aboutQt); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index 481c4ac91..f07eba0c6 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -91,7 +91,7 @@ ExportInstanceDialog::ExportInstanceDialog(InstancePtr instance, QWidget* parent m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/ExportPackDialog.cpp b/launcher/ui/dialogs/ExportPackDialog.cpp index a87120234..0d4a6aa7a 100644 --- a/launcher/ui/dialogs/ExportPackDialog.cpp +++ b/launcher/ui/dialogs/ExportPackDialog.cpp @@ -124,7 +124,7 @@ ExportPackDialog::ExportPackDialog(MinecraftInstancePtr instance, QWidget* paren m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/ExportToModListDialog.cpp b/launcher/ui/dialogs/ExportToModListDialog.cpp index 9db72b397..8ce9b6e65 100644 --- a/launcher/ui/dialogs/ExportToModListDialog.cpp +++ b/launcher/ui/dialogs/ExportToModListDialog.cpp @@ -69,7 +69,7 @@ ExportToModListDialog::ExportToModListDialog(QString name, QList mods, QWi ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Save")); triggerImp(); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index 9608eac21..8e10c12d7 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -128,7 +128,7 @@ InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr profile, c connect(container, &PageContainer::selectedPageChanged, this, [this](BasePage* previous, BasePage* current) { validate(current); }); pageCast(container->selectedPage())->selectSearch(); validate(container->selectedPage()); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/NewInstanceDialog.cpp b/launcher/ui/dialogs/NewInstanceDialog.cpp index d1b589cfe..8db9209a0 100644 --- a/launcher/ui/dialogs/NewInstanceDialog.cpp +++ b/launcher/ui/dialogs/NewInstanceDialog.cpp @@ -136,7 +136,7 @@ NewInstanceDialog::NewInstanceDialog(const QString& initialGroup, connect(m_container, &PageContainer::selectedPageChanged, this, &NewInstanceDialog::selectedPageChanged); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } else { diff --git a/launcher/ui/dialogs/NewsDialog.cpp b/launcher/ui/dialogs/NewsDialog.cpp index d38a53cb7..cc1bc9936 100644 --- a/launcher/ui/dialogs/NewsDialog.cpp +++ b/launcher/ui/dialogs/NewsDialog.cpp @@ -24,7 +24,7 @@ NewsDialog::NewsDialog(QList entries, QWidget* parent) : QDialog(p ui->currentArticleContentBrowser->setText(article_entry->content); ui->currentArticleContentBrowser->flush(); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp index c9de2ff21..44d9164cb 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp +++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp @@ -275,7 +275,7 @@ ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptrwidth(), this->height()); } else if (!geometrySaveKey().isEmpty()) @@ -321,7 +321,7 @@ ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent, initializeContainer(); connectButtons(); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } else if (!geometrySaveKey().isEmpty()) @@ -349,7 +349,7 @@ TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent, initializeContainer(); connectButtons(); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } else if (!geometrySaveKey().isEmpty()) @@ -377,7 +377,7 @@ ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent, initializeContainer(); connectButtons(); - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { showFullScreen(); setFixedSize(this->width(), this->height()); } else if (!geometrySaveKey().isEmpty()) diff --git a/launcher/ui/dialogs/VersionSelectDialog.cpp b/launcher/ui/dialogs/VersionSelectDialog.cpp index 38c9496eb..4bc938702 100644 --- a/launcher/ui/dialogs/VersionSelectDialog.cpp +++ b/launcher/ui/dialogs/VersionSelectDialog.cpp @@ -91,7 +91,7 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList* vlist, QString title, if (!cancelable) { m_buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); } - if (DesktopServices::isGameScope()) { + if (DesktopServices::isSteamDeckGameScope()) { this->showFullScreen(); this->setFixedSize(this->width(), this->height()); }