From 50ea5976ceb27c7b02f51d99926ccc4394b91ebb Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Sun, 19 Apr 2026 14:10:51 +0200 Subject: [PATCH] Fix HUD crash, clarify exit dialog, hide hint tile LayerShell windows with non-spanning anchors (AnchorTop|AnchorRight) crash the compositor when made invisible because Qt briefly resizes the surface to 0 before unmapping it. Wrap GamingHUD in a Loader so the window is destroyed rather than hidden. Replace the generic 'Yes / Cancel' exit dialog with 'Keep Playing / Leave' in both the Game Center header and the QS tile, matching the mental model of a couch user. The 'Launch Hint' QS tile is now hidden (available: false) when gaming mode is off so it does not clutter the regular action drawer. --- .../folio/qml/gaming/GameCenterOverlay.qml | 19 ++++++++++++++----- containments/homescreens/folio/qml/main.qml | 11 ++++++++--- quicksettings/gaming/contents/ui/main.qml | 19 ++++++++++++++----- quicksettings/gaminghint/contents/ui/main.qml | 3 ++- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/containments/homescreens/folio/qml/gaming/GameCenterOverlay.qml b/containments/homescreens/folio/qml/gaming/GameCenterOverlay.qml index 478466a0..ebe6a6c4 100644 --- a/containments/homescreens/folio/qml/gaming/GameCenterOverlay.qml +++ b/containments/homescreens/folio/qml/gaming/GameCenterOverlay.qml @@ -172,11 +172,20 @@ Window { anchors.fill: parent sourceComponent: Kirigami.PromptDialog { - title: i18n("Exit Gaming Mode") - subtitle: i18n("Keep gaming mode enabled, or switch back to the normal shell layout?") - standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel - - onAccepted: ShellSettings.Settings.gamingModeEnabled = false + id: theExitDialog + title: i18n("Leave gaming mode?") + subtitle: i18n("Your games will keep running in the background.") + standardButtons: Kirigami.Dialog.NoButton + customFooterActions: [ + Kirigami.Action { + text: i18n("Keep Playing") + onTriggered: theExitDialog.close() + }, + Kirigami.Action { + text: i18n("Leave") + onTriggered: ShellSettings.Settings.gamingModeEnabled = false + } + ] onClosed: exitGamingDialog.active = false } } diff --git a/containments/homescreens/folio/qml/main.qml b/containments/homescreens/folio/qml/main.qml index 088e6792..e645c4d9 100644 --- a/containments/homescreens/folio/qml/main.qml +++ b/containments/homescreens/folio/qml/main.qml @@ -698,9 +698,14 @@ ContainmentItem { // Small persistent button at the top-right corner of the screen that lets // the user return to the Game Center after launching a game. - GamingHUD { - visible: ShellSettings.Settings.gamingModeEnabled && !root.gameCenterOpen - onOpenRequested: root.gameCenterOpen = true + // Wrapped in a Loader so the LayerShell Window is destroyed (not merely + // hidden) when not needed — hiding a LayerShell window with AnchorTop|Right + // but no fixed height causes a Wayland protocol error (height=0). + Loader { + active: ShellSettings.Settings.gamingModeEnabled && !root.gameCenterOpen + sourceComponent: GamingHUD { + onOpenRequested: root.gameCenterOpen = true + } } Rectangle { diff --git a/quicksettings/gaming/contents/ui/main.qml b/quicksettings/gaming/contents/ui/main.qml index a390c193..6d022f1c 100644 --- a/quicksettings/gaming/contents/ui/main.qml +++ b/quicksettings/gaming/contents/ui/main.qml @@ -35,11 +35,20 @@ QS.QuickSetting { active: false sourceComponent: Kirigami.PromptDialog { - title: i18n("Exit Gaming Mode") - subtitle: i18n("Switch back to the normal shell layout?") - standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel - - onAccepted: ShellSettings.Settings.gamingModeEnabled = false + id: theConfirmDialog + title: i18n("Leave gaming mode?") + subtitle: i18n("Your games will keep running in the background.") + standardButtons: Kirigami.Dialog.NoButton + customFooterActions: [ + Kirigami.Action { + text: i18n("Keep Playing") + onTriggered: theConfirmDialog.close() + }, + Kirigami.Action { + text: i18n("Leave") + onTriggered: ShellSettings.Settings.gamingModeEnabled = false + } + ] onClosed: confirmDisableDialog.active = false } } diff --git a/quicksettings/gaminghint/contents/ui/main.qml b/quicksettings/gaminghint/contents/ui/main.qml index f6623072..fbf548b1 100644 --- a/quicksettings/gaminghint/contents/ui/main.qml +++ b/quicksettings/gaminghint/contents/ui/main.qml @@ -7,10 +7,11 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS QS.QuickSetting { - text: i18n("Game Center Hint") + text: i18n("Launch Hint") icon: "dialog-information" status: "" enabled: ShellSettings.Settings.gamingDismissHintEnabled + available: ShellSettings.Settings.gamingModeEnabled function toggle() { ShellSettings.Settings.gamingDismissHintEnabled = !ShellSettings.Settings.gamingDismissHintEnabled;