fix(ui): B never quits (Steam sends Esc for it), Ctrl+Q does; started from Steam, the hints show the Steam Controller's buttons

This commit is contained in:
theupriser committed 2026-09-27 17:56:57 +02:00
1 parent aee51b9bf1
commit 77f724e547
7 files changed
+23 -7

No files matched your search

+5 -2
View File
@@ -215,7 +215,9 @@ Item {
boot = a === "left" ? "gamescope" : "desktop"; boot = a === "left" ? "gamescope" : "desktop";
else if (a === "apply") goReview(false); else if (a === "apply") goReview(false);
else if (a === "reapply") goReview(true); else if (a === "reapply") goReview(true);
else if (a === "back") Qt.quit(); // B/Esc/Back don't quit: Steam's desktop layout sends Esc for a
// Steam Controller's B, which should only ever go back.
else if (a === "quit") Qt.quit();
} else if (screen === "review") { } else if (screen === "review") {
if (a === "accept" || a === "apply") onApplyPressed(); if (a === "accept" || a === "apply") onApplyPressed();
else if (a === "back") { reapply = false; screen = "menu"; } else if (a === "back") { reapply = false; screen = "menu"; }
@@ -254,7 +256,7 @@ Item {
if (screen === "bios2" && Input.type !== "keyboard" && (e.key === Qt.Key_Return || e.key === Qt.Key_Enter)) { if (screen === "bios2" && Input.type !== "keyboard" && (e.key === Qt.Key_Return || e.key === Qt.Key_Enter)) {
if (!e.isAutoRepeat) act("hold"); e.accepted = true; return; if (!e.isAutoRepeat) act("hold"); e.accepted = true; return;
} }
if (!fromRemote) Input.type = "keyboard"; if (!fromRemote) Input.type = Input.fromSteam ? "steam" : "keyboard";
var k = e.key; var k = e.key;
if (k === Qt.Key_Up) act("up"); if (k === Qt.Key_Up) act("up");
else if (k === Qt.Key_Down) act("down"); else if (k === Qt.Key_Down) act("down");
@@ -268,6 +270,7 @@ Item {
else if (k === Qt.Key_Return || k === Qt.Key_Enter) act("accept"); else if (k === Qt.Key_Return || k === Qt.Key_Enter) act("accept");
else if (k === Qt.Key_Escape || k === Qt.Key_Back || k === Qt.Key_Backspace) { if (!e.isAutoRepeat) act("back"); } else if (k === Qt.Key_Escape || k === Qt.Key_Back || k === Qt.Key_Backspace) { if (!e.isAutoRepeat) act("back"); }
else if (k === Qt.Key_R) act("reapply"); else if (k === Qt.Key_R) act("reapply");
else if (k === Qt.Key_Q && (e.modifiers & Qt.ControlModifier)) act("quit");
else return; else return;
e.accepted = true; e.accepted = true;
} }
+1 -1
View File
@@ -6,7 +6,7 @@ Rectangle {
property string k property string k
property bool dark: false property bool dark: false
height: 26; width: Math.max(26, gt.implicitWidth + 14) height: 26; width: Math.max(26, gt.implicitWidth + 14)
radius: Input.type === "controller" && k.length === 1 ? 13 : 7 radius: (Input.type === "controller" || Input.type === "steam") && k.length === 1 ? 13 : 7
color: dark ? Theme.ink : Theme.key color: dark ? Theme.ink : Theme.key
Text { id: gt; anchors.centerIn: parent; text: glyph.k; color: glyph.dark ? Theme.accent : Theme.textHi Text { id: gt; anchors.centerIn: parent; text: glyph.k; color: glyph.dark ? Theme.accent : Theme.textHi
font.family: Theme.body; font.pixelSize: 12; font.weight: Font.DemiBold } font.family: Theme.body; font.pixelSize: 12; font.weight: Font.DemiBold }
+8 -3
View File
@@ -5,10 +5,15 @@ import QtQuick
QtObject { QtObject {
property string type: "keyboard" property string type: "keyboard"
// Started from Steam: keys come from a Steam Controller through Steam's
// desktop layout (A = Enter, B = Esc, Y = Space, X = Steam's keyboard),
// shown as "steam" with the controller's buttons.
property bool fromSteam: false
readonly property var glyphs: ({ readonly property var glyphs: ({
controller: { toggle: "A", choose: "◀ ▶", reapply: "Y", quit: "B", apply: "X", ok: "A", back: "B" }, controller: { toggle: "A", choose: "◀ ▶", reapply: "Y", quit: "", apply: "X", ok: "A", back: "B" },
keyboard: { toggle: "Enter", choose: "← →", reapply: "R", quit: "Esc", apply: "Ctrl+Enter", ok: "Enter", back: "Esc" }, keyboard: { toggle: "Enter", choose: "← →", reapply: "R", quit: "Ctrl+Q", apply: "Ctrl+Enter", ok: "Enter", back: "Esc" },
remote: { toggle: "OK", choose: "◀ ▶", reapply: "Red", quit: "Back", apply: "↓ Apply", ok: "OK", back: "Back" } steam: { toggle: "A", choose: "◀ ▶", reapply: "", quit: "", apply: "↓ A", ok: "A", back: "B" },
remote: { toggle: "OK", choose: "◀ ▶", reapply: "Red", quit: "", apply: "↓ Apply", ok: "OK", back: "Back" }
}) })
readonly property var g: glyphs[type] readonly property var g: glyphs[type]
} }
+2
View File
@@ -12,6 +12,8 @@ ApplicationWindow {
required property var gamepad required property var gamepad
required property bool fullscreen required property bool fullscreen
required property string iconUrl required property string iconUrl
required property bool fromSteam
Component.onCompleted: Input.fromSteam = fromSteam
width: 1280; height: 720 width: 1280; height: 720
minimumWidth: 960; minimumHeight: 540 minimumWidth: 960; minimumHeight: 540
+3
View File
@@ -59,7 +59,10 @@ Item {
Row { Row {
anchors.left: parent.left; anchors.leftMargin: 40; anchors.verticalCenter: parent.verticalCenter; spacing: 28 anchors.left: parent.left; anchors.leftMargin: 40; anchors.verticalCenter: parent.verticalCenter; spacing: 28
Repeater { Repeater {
// Quit only has a key on a keyboard (Ctrl+Q), and re-apply has
// none through Steam's layout; a controller quits through Steam.
model: [[screen.g.toggle, "Toggle"], [screen.g.choose, "Choose"], [screen.g.reapply, "Re-apply what's on"], [screen.g.quit, "Quit"]] model: [[screen.g.toggle, "Toggle"], [screen.g.choose, "Choose"], [screen.g.reapply, "Re-apply what's on"], [screen.g.quit, "Quit"]]
.filter(function (h) { return h[0] !== ""; })
Row { required property var modelData; spacing: 8 Row { required property var modelData; spacing: 8
Glyph { k: parent.modelData[0]; anchors.verticalCenter: parent.verticalCenter } Glyph { k: parent.modelData[0]; anchors.verticalCenter: parent.verticalCenter }
Text { text: parent.modelData[1]; color: Theme.label; font.family: Theme.body; font.pixelSize: 14; anchors.verticalCenter: parent.verticalCenter } } Text { text: parent.modelData[1]; color: Theme.label; font.family: Theme.body; font.pixelSize: 14; anchors.verticalCenter: parent.verticalCenter } }
+1 -1
View File
@@ -47,7 +47,7 @@ Rectangle {
Text { visible: app.wrongPassword; text: "That password didn't work. Try again."; color: Theme.bad; font.family: Theme.body; font.pixelSize: 14 } Text { visible: app.wrongPassword; text: "That password didn't work. Try again."; color: Theme.bad; font.family: Theme.body; font.pixelSize: 14 }
Rectangle { width: parent.width; height: 46; radius: 12; color: Theme.note Rectangle { width: parent.width; height: 46; radius: 12; color: Theme.note
Text { anchors.verticalCenter: parent.verticalCenter; x: 14; color: Theme.soft; font.family: Theme.body; font.pixelSize: 14 Text { anchors.verticalCenter: parent.verticalCenter; x: 14; color: Theme.soft; font.family: Theme.body; font.pixelSize: 14
text: ({ controller: "Press Steam + X for the on-screen keyboard.", keyboard: "Type your password and press Enter.", remote: "Select the field for the on-screen keyboard." })[Input.type] } } text: ({ controller: "Press Steam + X for the on-screen keyboard.", keyboard: "Type your password and press Enter.", steam: "Press X for Steam's on-screen keyboard, type your password and press A.", remote: "Select the field for the on-screen keyboard." })[Input.type] } }
Item { width: parent.width; height: 48 Item { width: parent.width; height: 48
Btn { k: Input.g.back; text: "Back"; onClicked: app.act("back") } Btn { k: Input.g.back; text: "Back"; onClicked: app.act("back") }
Btn { anchors.right: parent.right; k: Input.g.ok; text: "Apply"; primary: true; onClicked: screen.submit() } } Btn { anchors.right: parent.right; k: Input.g.ok; text: "Apply"; primary: true; onClicked: screen.submit() } }
+3
View File
@@ -373,6 +373,9 @@ def main():
engine = QQmlApplicationEngine() engine = QQmlApplicationEngine()
engine.setInitialProperties({"backend": backend, "gamepad": pad, engine.setInitialProperties({"backend": backend, "gamepad": pad,
"fullscreen": fullscreen, "fullscreen": fullscreen,
# Started from Steam: its keys are a Steam
# Controller's buttons (desktop layout).
"fromSteam": bool(os.environ.get("SteamGameId")),
"iconUrl": QUrl.fromLocalFile(os.path.realpath(icon)).toString()}) "iconUrl": QUrl.fromLocalFile(os.path.realpath(icon)).toString()})
engine.load(os.path.join(HERE, "qml", "Main.qml")) engine.load(os.path.join(HERE, "qml", "Main.qml"))
if not engine.rootObjects(): if not engine.rootObjects():