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.
This commit is contained in:
Marco Allegretti 2026-04-19 14:10:51 +02:00
parent 6ac9c58d93
commit 50ea5976ce
4 changed files with 38 additions and 14 deletions

View file

@ -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
}
}

View file

@ -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 {

View file

@ -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
}
}

View file

@ -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;