fix(overhaul): UI and resolution bugs for Steam Deck (Gamescope)

Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
Collecting
2026-01-04 18:40:01 +00:00
parent 127de63934
commit 6b61abad42

View File

@@ -1354,20 +1354,21 @@ void GMainWindow::InitializeWidgets() {
const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
if (is_gamescope) {
statusBar()->setSizeGripEnabled(true);
this->menuBar()->setNativeMenuBar(false);
QString gamescope_style = qApp->styleSheet();
gamescope_style.append(QStringLiteral("QMenu { background-color: #2b2b2b; border: 1px solid #3d3d3d; padding: 2px; } "
"QMenu::item { padding: 5px 25px 5px 20px; } "
"QMenu::item:selected { background-color: #3d3d3d; }"));
qApp->setStyleSheet(gamescope_style);
multiplayer_room_overlay->resize(360, 240);
this->setContentsMargins(0, 0, 0, 0);
this->layout()->setContentsMargins(0, 0, 0, 0);
this->layout()->setSpacing(0);
ui->horizontalLayout->setContentsMargins(0, 0, 0, 0);
ui->horizontalLayout->setSpacing(0);
statusBar()->setStyleSheet(QStringLiteral(
"QStatusBar::item { border: none; }"
"QSizeGrip { width: 20px; height: 20px; margin: 2px; }"
));
}
}
@@ -2968,6 +2969,12 @@ void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) {
};
QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this);
const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
if (is_gamescope) {
progress.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint);
}
progress.setWindowModality(Qt::WindowModal);
progress.setMinimumDuration(100);
progress.setAutoClose(false);
@@ -4482,6 +4489,12 @@ bool GMainWindow::question(QWidget* parent, const QString& title, const QString&
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
QMessageBox* box_dialog = new QMessageBox(parent);
const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
if (is_gamescope) {
box_dialog->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);
}
box_dialog->setWindowTitle(title);
box_dialog->setText(text);
box_dialog->setStandardButtons(buttons);
@@ -5067,7 +5080,10 @@ void GMainWindow::OnToggleControllerOverlay() {
controller_overlay = new ControllerOverlay(this);
}
if (controller_overlay) {
controller_overlay->setVisible(visible);
controller_overlay->SetVisible(visible);
this->update();
QCoreApplication::processEvents();
}
}
@@ -5088,7 +5104,6 @@ void GMainWindow::OnTogglePerformanceOverlay() {
if (performance_overlay) {
const bool is_checked = ui->action_Show_Performance_Overlay->isChecked();
performance_overlay->SetVisible(is_checked);
UISettings::values.show_performance_overlay = is_checked;
}
}
@@ -5107,7 +5122,6 @@ void GMainWindow::OnToggleVramOverlay() {
if (vram_overlay) {
const bool is_checked = ui->action_Show_Vram_Overlay->isChecked();
vram_overlay->SetVisible(is_checked);
UISettings::values.show_vram_overlay = is_checked;
}
}
@@ -6201,13 +6215,16 @@ int main(int argc, char* argv[]) {
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
const bool is_gamescope = qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
if (is_gamescope) {
qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");
qputenv("QT_SCALE_FACTOR", "1");
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "0");
qputenv("QT_FONT_DPI", "96");
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell");
}
QApplication app(argc, argv);