From 6779abad37d0d63794da374ef7773f478c5fe908 Mon Sep 17 00:00:00 2001 From: Collecting Date: Sun, 4 Jan 2026 02:17:36 +0000 Subject: [PATCH] fix(overhaul): UI and resolution bugs for Steam Deck (Gamescope) Signed-off-by: Collecting --- .../configuration/configure_per_game.cpp | 63 +++++++++++++------ 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/src/citron/configuration/configure_per_game.cpp b/src/citron/configuration/configure_per_game.cpp index a8ce0311d..fcbc4b75a 100644 --- a/src/citron/configuration/configure_per_game.cpp +++ b/src/citron/configuration/configure_per_game.cpp @@ -126,8 +126,18 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st linux_tab = std::make_unique(system_, tab_group, *builder, this); system_tab = std::make_unique(system_, tab_group, *builder, this); - if (!UISettings::values.per_game_configure_geometry.isEmpty()) { - restoreGeometry(UISettings::values.per_game_configure_geometry); + const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope"; + + if (is_gamescope) { + setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint); + setWindowModality(Qt::NonModal); + resize(1100, 700); + } else { + setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); + setWindowModality(Qt::WindowModal); + if (!UISettings::values.per_game_configure_geometry.isEmpty()) { + restoreGeometry(UISettings::values.per_game_configure_geometry); + } } UpdateTheme(); @@ -322,26 +332,25 @@ void ConfigurePerGame::UpdateTheme() { if (ui->tabButtonsScrollArea) { ui->tabButtonsScrollArea->setStyleSheet(QStringLiteral( "QScrollBar:horizontal { height: 14px; background: transparent; border-radius: 7px; }" - "QScrollBar::handle:horizontal { background-color: %1; border-radius: 6px; min-width: 30px; margin: 1px; }" + "QScrollBar::handle:horizontal { background-color: %1; border-radius: 64px; min-width: 30px; margin: 1px; }" "QScrollBar::add-line, QScrollBar::sub-line { background: none; width: 0px; }" ).arg(hue_hex)); } - // 3. Action Buttons (OK/Cancel) and Trim button - if (ui->buttonBox && !ui->buttonBox->underMouse()) { - ui->buttonBox->setStyleSheet(QStringLiteral( - "QPushButton { background-color: %1; color: #ffffff; border-radius: 4px; font-weight: bold; padding: 5px 15px; }" - "QPushButton:hover { background-color: %2; }" - "QPushButton:pressed { background-color: %3; }" - ).arg(hue_hex).arg(hue_light).arg(hue_dark)); - } + // 3. Action Buttons + const QString button_css = QStringLiteral( + "QPushButton { background-color: %1; color: #ffffff; border-radius: 4px; font-weight: bold; padding: 5px 15px; }" + "QPushButton:hover { background-color: %2; }" + "QPushButton:pressed { background-color: %3; }" + ).arg(hue_hex).arg(hue_light).arg(hue_dark); - if (ui->trim_xci_button && !ui->trim_xci_button->underMouse()) { - ui->trim_xci_button->setStyleSheet(QStringLiteral( - "QPushButton { background-color: %1; color: #ffffff; border: none; border-radius: 4px; padding: 10px; }" - "QPushButton:hover { background-color: %2; }" - "QPushButton:pressed { background-color: %3; }" - ).arg(hue_hex).arg(hue_light).arg(hue_dark)); + if (ui->buttonBox) { + for (auto* button : ui->buttonBox->findChildren()) { + if (!button->isDown()) button->setStyleSheet(button_css); + } + } + if (ui->trim_xci_button && !ui->trim_xci_button->isDown()) { + ui->trim_xci_button->setStyleSheet(button_css); } // 4. Tab Content Area @@ -374,7 +383,25 @@ void ConfigurePerGame::UpdateTheme() { }); } rainbow_timer->start(33); - } else if (rainbow_timer) { + } + + // Fix for Gamescope: Style buttons once outside the timer loop + if (ui->buttonBox) { + ui->buttonBox->setStyleSheet(QStringLiteral( + "QPushButton { background-color: %1; color: #ffffff; border-radius: 4px; font-weight: bold; padding: 5px 15px; }" + "QPushButton:hover { background-color: %2; }" + "QPushButton:pressed { background-color: %3; }" + ).arg(accent).arg(Theme::GetAccentColorHover()).arg(Theme::GetAccentColorPressed())); + } + if (ui->trim_xci_button) { + ui->trim_xci_button->setStyleSheet(QStringLiteral( + "QPushButton { background-color: %1; color: #ffffff; border: none; border-radius: 4px; padding: 10px; }" + "QPushButton:hover { background-color: %2; }" + "QPushButton:pressed { background-color: %3; }" + ).arg(accent).arg(Theme::GetAccentColorHover()).arg(Theme::GetAccentColorPressed())); + } + + if (UISettings::values.enable_rainbow_mode.GetValue() == false && rainbow_timer) { rainbow_timer->stop(); if (ui->tabButtonsContainer) ui->tabButtonsContainer->setStyleSheet({}); if (ui->tabButtonsScrollArea) ui->tabButtonsScrollArea->setStyleSheet({});