From c2953f2c1f6eb8728dcfab96aea07f5371d5a3d0 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Wed, 23 Sep 2026 16:06:26 -0400 Subject: [PATCH] Session settings open with the first control focused Opened from the cog, the Steam/Desktop session page had nothing focused: the cog that was focused is gone and a controller had to find its way back in. The page now puts focus on its first control (Resolution) as it opens, so the d-pad works at once; coming back from a driver page still returns focus to the driver box that opened it. ChoiceRow gains a modifier for its box. --- .../com/steamdeck/launcher/ui/ModeSettingsDialog.kt | 11 ++++++++--- .../java/com/steamdeck/launcher/ui/SettingsWidgets.kt | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt index 00b6b64bc6..c2f2bccbb9 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt @@ -119,12 +119,16 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { val pageScroll = androidx.compose.foundation.rememberScrollState() val runtimeChip = remember { androidx.compose.ui.focus.FocusRequester() } val displayChip = remember { androidx.compose.ui.focus.FocusRequester() } + val firstChip = remember { androidx.compose.ui.focus.FocusRequester() } fun openDriverPage(key: String) { returnTo = key; driverPage = key } androidx.compose.runtime.LaunchedEffect(driverPage) { - if (driverPage == null) returnTo?.let { key -> - // One frame first: the box has to be laid out again before it can take focus. + if (driverPage == null) { + // One frame first: the box has to be laid out before it can take focus. Opened from the + // cog, focus starts on the first control (Resolution) so the d-pad works at once; back + // from a driver page, it returns to the driver box that opened it. androidx.compose.runtime.withFrameNanos { } - runCatching { (if (key == "rt") runtimeChip else displayChip).requestFocus() } + val target = when (returnTo) { "rt" -> runtimeChip; "panel" -> displayChip; else -> firstChip } + runCatching { target.requestFocus() } } } when (driverPage) { @@ -169,6 +173,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { .map { (cap, label) -> cap to (if (cap == default) "$label - the default" else label) } + (CUSTOM to (custom?.let { "Custom · ${it.first}×${it.second}" } ?: "Custom…")), if (custom != null) CUSTOM else s.resolutionCap, note = "720p can improve menu responsiveness.", + chipModifier = androidx.compose.ui.Modifier.focusRequester(firstChip), onPick = { v -> if (v == CUSTOM) editCustom = true else { a.onCustomResolution(null); a.onResolution(v) } }, ) ChoiceRow( diff --git a/app/src/main/java/com/steamdeck/launcher/ui/SettingsWidgets.kt b/app/src/main/java/com/steamdeck/launcher/ui/SettingsWidgets.kt index 1820b70af6..d0fa0c6a8f 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/SettingsWidgets.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/SettingsWidgets.kt @@ -226,12 +226,14 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, cont fun ChoiceRow( host: MenuHost, key: String, label: String, hint: String?, options: List>, selected: T, enabled: Boolean = true, note: String? = null, + /** For the box itself - a page's FocusRequester for its first control. */ + chipModifier: Modifier = Modifier, onPick: (T) -> Unit, ) { val open = host.open == key SettingsRow(label, hint, highlighted = open) { Box { - ValueChip(options.firstOrNull { it.first == selected }?.second ?: "-", open, enabled) { host.open = if (open) null else key } + ValueChip(options.firstOrNull { it.first == selected }?.second ?: "-", open, enabled, modifier = chipModifier) { host.open = if (open) null else key } AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label, note = note) { for ((value, text) in options) MenuItem(text, checked = value == selected) { onPick(value); host.open = null } }