mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-30 08:14:45 +00:00
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:
parent
6ac9c58d93
commit
50ea5976ce
4 changed files with 38 additions and 14 deletions
|
|
@ -172,11 +172,20 @@ Window {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
sourceComponent: Kirigami.PromptDialog {
|
sourceComponent: Kirigami.PromptDialog {
|
||||||
title: i18n("Exit Gaming Mode")
|
id: theExitDialog
|
||||||
subtitle: i18n("Keep gaming mode enabled, or switch back to the normal shell layout?")
|
title: i18n("Leave gaming mode?")
|
||||||
standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel
|
subtitle: i18n("Your games will keep running in the background.")
|
||||||
|
standardButtons: Kirigami.Dialog.NoButton
|
||||||
onAccepted: ShellSettings.Settings.gamingModeEnabled = false
|
customFooterActions: [
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Keep Playing")
|
||||||
|
onTriggered: theExitDialog.close()
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Leave")
|
||||||
|
onTriggered: ShellSettings.Settings.gamingModeEnabled = false
|
||||||
|
}
|
||||||
|
]
|
||||||
onClosed: exitGamingDialog.active = false
|
onClosed: exitGamingDialog.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -698,10 +698,15 @@ ContainmentItem {
|
||||||
|
|
||||||
// Small persistent button at the top-right corner of the screen that lets
|
// Small persistent button at the top-right corner of the screen that lets
|
||||||
// the user return to the Game Center after launching a game.
|
// the user return to the Game Center after launching a game.
|
||||||
GamingHUD {
|
// Wrapped in a Loader so the LayerShell Window is destroyed (not merely
|
||||||
visible: ShellSettings.Settings.gamingModeEnabled && !root.gameCenterOpen
|
// 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
|
onOpenRequested: root.gameCenterOpen = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: gameCenterHint
|
id: gameCenterHint
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,20 @@ QS.QuickSetting {
|
||||||
active: false
|
active: false
|
||||||
|
|
||||||
sourceComponent: Kirigami.PromptDialog {
|
sourceComponent: Kirigami.PromptDialog {
|
||||||
title: i18n("Exit Gaming Mode")
|
id: theConfirmDialog
|
||||||
subtitle: i18n("Switch back to the normal shell layout?")
|
title: i18n("Leave gaming mode?")
|
||||||
standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel
|
subtitle: i18n("Your games will keep running in the background.")
|
||||||
|
standardButtons: Kirigami.Dialog.NoButton
|
||||||
onAccepted: ShellSettings.Settings.gamingModeEnabled = false
|
customFooterActions: [
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Keep Playing")
|
||||||
|
onTriggered: theConfirmDialog.close()
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Leave")
|
||||||
|
onTriggered: ShellSettings.Settings.gamingModeEnabled = false
|
||||||
|
}
|
||||||
|
]
|
||||||
onClosed: confirmDisableDialog.active = false
|
onClosed: confirmDisableDialog.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
QS.QuickSetting {
|
QS.QuickSetting {
|
||||||
text: i18n("Game Center Hint")
|
text: i18n("Launch Hint")
|
||||||
icon: "dialog-information"
|
icon: "dialog-information"
|
||||||
status: ""
|
status: ""
|
||||||
enabled: ShellSettings.Settings.gamingDismissHintEnabled
|
enabled: ShellSettings.Settings.gamingDismissHintEnabled
|
||||||
|
available: ShellSettings.Settings.gamingModeEnabled
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
ShellSettings.Settings.gamingDismissHintEnabled = !ShellSettings.Settings.gamingDismissHintEnabled;
|
ShellSettings.Settings.gamingDismissHintEnabled = !ShellSettings.Settings.gamingDismissHintEnabled;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue