From 6b109046cd1f9c3071c54093b5cb05ae6b481aa1 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 06:26:12 -0400 Subject: [PATCH 01/20] Steam cog: stretch games to fill the screen, as a switch 0.1.6 forced every game window to the screen's size (--force-windows-fullscreen), which keeps FlatOut filling the screen but leaves Quake 3 drawing small in the bottom-left: it sets its own resolution and never looks at its window again, and OpenGL draws from that corner. The switch sits in the Steam page's Games group, on by default as before, and reaches the session as BL_GAMESCOPE_FORCE_FULLSCREEN, which the session script already reads. Listed in the device report. --- .../main/java/com/droiddeck/launcher/MainActivity.kt | 4 ++++ .../java/com/droiddeck/launcher/core/DeviceReport.kt | 1 + .../com/droiddeck/launcher/session/SessionPrefs.kt | 12 ++++++++++++ .../com/droiddeck/launcher/session/SessionService.kt | 1 + .../com/droiddeck/launcher/ui/ModeSettingsDialog.kt | 8 ++++++++ 5 files changed, 26 insertions(+) diff --git a/app/src/main/java/com/droiddeck/launcher/MainActivity.kt b/app/src/main/java/com/droiddeck/launcher/MainActivity.kt index e587aac8c1..a55657c03b 100644 --- a/app/src/main/java/com/droiddeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/MainActivity.kt @@ -105,6 +105,7 @@ class MainActivity : ComponentActivity() { private var phantomWarning by mutableStateOf(null) private var directAudio by mutableStateOf(false) private var clientDirectAudio by mutableStateOf(false) + private var forceFullscreen by mutableStateOf(true) private var mic by mutableStateOf(false) private var linuxRows by mutableStateOf>(emptyList()) /** The latest Banners-Turnip release as each driver menu offers it (see [refreshReleaseRows]). */ @@ -518,6 +519,7 @@ class MainActivity : ComponentActivity() { oscMode = if (mode == SessionService.MODE_STEAM) oscMode else null, directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null, clientDirectAudio = clientDirectAudio, + forceFullscreen = if (mode == SessionService.MODE_STEAM) forceFullscreen else null, mic = if (mode == SessionService.MODE_STEAM) mic else null, renderer = if (mode == SessionService.MODE_DESKTOP) renderer else null, gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null, @@ -549,6 +551,7 @@ class MainActivity : ComponentActivity() { onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o }, onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on }, onClientDirectAudio = { on -> SessionPrefs.setClientDirectAudio(this, on); clientDirectAudio = on }, + onForceFullscreen = { on -> SessionPrefs.setForceFullscreen(this, on); forceFullscreen = on }, onMic = { on -> SessionPrefs.setMicEnabled(this, on) mic = on @@ -644,6 +647,7 @@ class MainActivity : ComponentActivity() { oscMode = SessionPrefs.oscMode(this) directAudio = SessionPrefs.directAudio(this) clientDirectAudio = SessionPrefs.clientDirectAudio(this) + forceFullscreen = SessionPrefs.forceFullscreen(this) mic = SessionPrefs.micEnabled(this) renderer = SessionPrefs.desktopRenderer(this) gameStorage = SessionPrefs.gameStorage(this) diff --git a/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt b/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt index 060efb5b93..498eb1fd24 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt @@ -149,6 +149,7 @@ object DeviceReport { k("Skip xalia", SessionPrefs.noXalia(context)) k("proot without seccomp", SessionPrefs.prootNoSeccomp(context)) k("DirectAudio for games", SessionPrefs.directAudio(context)) + k("Stretch games to fill", SessionPrefs.forceFullscreen(context)) k("Client audio", if (SessionPrefs.clientDirectAudio(context)) "DirectAudio" else "classic") k("Microphone", SessionPrefs.micEnabled(context)) k("On-screen controls", SessionPrefs.oscMode(context)) diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index a2c1dbe772..bf2ac5d04a 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -87,6 +87,18 @@ object SessionPrefs { prefs(context).edit().putBoolean("clientDirectAudio", on).apply() } + /** + * Steam only: gamescope makes every game window the size of the screen. A game that resizes + * its own window when it loses focus (FlatOut) otherwise comes back smaller, drawn in a + * corner; a game that sets its own resolution and never looks at its window again (Quake 3) + * instead draws small in the bottom-left of the stretched one. On unless turned off. + */ + fun forceFullscreen(context: Context): Boolean = prefs(context).getBoolean("forceFullscreen", true) + + fun setForceFullscreen(context: Context, on: Boolean) { + prefs(context).edit().putBoolean("forceFullscreen", on).apply() + } + /** * DirectAudio for games: their Wine audio driver talks to the relay helper on this side. On * unless the user turned it off. diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 830cbe71be..c49c5586d4 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -304,6 +304,7 @@ class SessionService : Service() { if (SessionPrefs.noGlError(this)) guest.add("MESA_NO_ERROR=1") if (SessionState.mode == MODE_STEAM) guest.add("BL_STEAMDECK=" + (if (SessionPrefs.steamDeckMode(this)) "1" else "0")) if (SessionState.mode == MODE_STEAM) guest.add("BL_STEAM_CHANNEL=" + SessionPrefs.steamChannel(this)) + if (SessionState.mode == MODE_STEAM) guest.add("BL_GAMESCOPE_FORCE_FULLSCREEN=" + (if (SessionPrefs.forceFullscreen(this)) "1" else "0")) // Proton's own gate for its xalia helper (its `proton` script reads this, and sets // XALIA_SUPPORTED_ONLY itself otherwise). Off by default: xalia is Valve's, and on a device // whose seccomp answers its syscalls normally there is no reason to take it away. diff --git a/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt b/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt index 7460914bcc..e7d26a4e99 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt @@ -53,6 +53,8 @@ class ModeSettings( val gameStorage: String? = null, val storageOptions: List> = emptyList(), val fexPreset: String? = null, + /** Steam only: games are stretched to fill the screen (null = not a Steam page). */ + val forceFullscreen: Boolean? = null, /** Steam only: the client branch forced on the command line. */ val steamChannel: String? = null, /** Steam only: the user's own games folder and what was found in it. */ @@ -98,6 +100,7 @@ class ModeSettingsActions( val onGameStorage: (path: String, label: String) -> Unit = { _, _ -> }, val onPickGameStorageFolder: () -> Unit = {}, val onFexPreset: (String) -> Unit = {}, + val onForceFullscreen: (Boolean) -> Unit = {}, val onSteamChannel: (String) -> Unit = {}, val onPickAddedGamesDir: () -> Unit = {}, val onForgetAddedGamesDir: (path: String) -> Unit = {}, @@ -280,6 +283,11 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { FexPreset.all.map { it.id to it.label }, s.fexPreset, note = FexPreset.byId(s.fexPreset).detail, onPick = a.onFexPreset, ) + if (s.forceFullscreen != null) ToggleRow( + host, "fill", "Stretch games to fill the screen", + "Keeps games that resize their own window (FlatOut) full screen. Turn it off if a game shows up small in a corner (Quake 3). Applies next session.", + s.forceFullscreen, onChange = a.onForceFullscreen, + ) } if (steam && s.directAudio != null && s.mic != null) SettingsGroup("Audio") { ToggleRow(host, "da", "DirectAudio for games", "Bypasses PulseAudio for lower latency in games.", s.directAudio, onChange = a.onDirectAudio) From ee941da5b4f296d52143dca0a9073f11c6adad11 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 06:29:33 -0400 Subject: [PATCH 02/20] Session drawer: stretch games to fill the screen, live The same choice as the Steam cog's, in the drawer's Now group, changed while the client runs: the app writes it to ~/.droiddeck-fill (and again at every session start, so a file an earlier session left never disagrees), and a watcher in the Steam session hands each change to gamescope as GAMESCOPE_FORCE_WINDOWS_FULLSCREEN on the root window, which gamescope reads whenever it changes. The session log says so when it does. --- .../com/droiddeck/launcher/SessionActivity.kt | 4 ++++ .../droiddeck/launcher/session/SessionPrefs.kt | 14 ++++++++++++++ .../droiddeck/launcher/session/SessionService.kt | 5 ++++- .../com/droiddeck/launcher/ui/SessionOverlay.kt | 7 +++++++ .../overlay/usr/local/bin/bannerlator-session | 16 ++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index a2d31962e2..862286a8c0 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -91,6 +91,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { /** The on-screen PC keyboard (ui/PcKeyboard): real key presses, Esc and F1 included. */ private var pcKeyboardOpen by mutableStateOf(false) private var hudOn by mutableStateOf(true) + private var fillScreen by mutableStateOf(true) private var frameGenLabel by mutableStateOf("Off") private var frameGenEngine by mutableStateOf(FrameGen.ENGINE_OFF) private var frameGenMultiplier by mutableStateOf(2) @@ -197,6 +198,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { isHomeApp = isHomeApp, androidApps = androidApps, hudOn = hudOn, + fillScreen = if (SessionState.mode == SessionService.MODE_STEAM) fillScreen else null, frameGenEngine = frameGenEngine, frameGenMultiplier = frameGenMultiplier, lsfgReady = LsfgNative.isInstalled(this@SessionActivity), oscMode = oscMode, touchMode = touchMode, @@ -206,6 +208,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { secondScreenDisplays = secondScreenDisplays, selectedSecondScreenDisplay = selectedSecondScreenDisplay, onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() }, + onFillScreen = { on -> SessionPrefs.setForceFullscreen(this@SessionActivity, on); fillScreen = on }, onFrameGenPick = { engine, multiplier -> FrameGen.set(this@SessionActivity, engine, multiplier) readPrefs() @@ -288,6 +291,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private fun readPrefs() { hudOn = SessionPrefs.hudEnabled(this) + fillScreen = SessionPrefs.forceFullscreen(this) touchMode = SessionPrefs.touchMode(this) frameGenLabel = FrameGen.label(this) frameGenEngine = FrameGen.engine(this) diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index bf2ac5d04a..c7afe842d3 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -97,6 +97,20 @@ object SessionPrefs { fun setForceFullscreen(context: Context, on: Boolean) { prefs(context).edit().putBoolean("forceFullscreen", on).apply() + writeForceFullscreenFlag(context) + } + + /** + * The same choice as a file the running session watches, so the drawer can change it live: + * the session hands every change to gamescope, which reads GAMESCOPE_FORCE_WINDOWS_FULLSCREEN + * off its root window whenever it changes. Written again at every session start so a file left + * by an earlier session never disagrees with the setting. + */ + fun writeForceFullscreenFlag(context: Context) { + runCatching { + java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.droiddeck-fill") + .writeText(if (forceFullscreen(context)) "1\n" else "0\n") + } } /** diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index c49c5586d4..ec15c5c2c6 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -304,7 +304,10 @@ class SessionService : Service() { if (SessionPrefs.noGlError(this)) guest.add("MESA_NO_ERROR=1") if (SessionState.mode == MODE_STEAM) guest.add("BL_STEAMDECK=" + (if (SessionPrefs.steamDeckMode(this)) "1" else "0")) if (SessionState.mode == MODE_STEAM) guest.add("BL_STEAM_CHANNEL=" + SessionPrefs.steamChannel(this)) - if (SessionState.mode == MODE_STEAM) guest.add("BL_GAMESCOPE_FORCE_FULLSCREEN=" + (if (SessionPrefs.forceFullscreen(this)) "1" else "0")) + if (SessionState.mode == MODE_STEAM) { + guest.add("BL_GAMESCOPE_FORCE_FULLSCREEN=" + (if (SessionPrefs.forceFullscreen(this)) "1" else "0")) + SessionPrefs.writeForceFullscreenFlag(this) + } // Proton's own gate for its xalia helper (its `proton` script reads this, and sets // XALIA_SUPPORTED_ONLY itself otherwise). Off by default: xalia is Valve's, and on a device // whose seccomp answers its syscalls normally there is no reason to take it away. diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index 400caaeb82..1566a7d38f 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -155,6 +155,8 @@ class DrawerActions( val touchAuto: String, val shapeMode: String, val fexPreset: String, + /** Steam only: games stretched to the screen's size, changed live (null = not Steam). */ + val fillScreen: Boolean? = null, val secondScreenMode: SecondScreenMode, val secondScreenDisplays: List, val selectedSecondScreenDisplay: Int, @@ -170,6 +172,7 @@ class DrawerActions( val onTouch: (String) -> Unit, val onShape: (String) -> Unit, val onFexPreset: (String) -> Unit, + val onFillScreen: (Boolean) -> Unit = {}, val onSecondScreenMode: (SecondScreenMode) -> Unit, val onSecondScreenDisplay: (Int) -> Unit, val onLaunchAndroidApp: (HomeApp.LaunchableApp) -> Unit, @@ -298,6 +301,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { host, "hud", "Performance HUD", null, a.hudOn, chipModifier = if (steamButtons) Modifier else Modifier.focusRequester(firstFocus), onChange = a.onHud, ) + if (a.fillScreen != null) ToggleRow( + host, "fill", "Stretch games to fill the screen", + "Off for a game that shows up small in a corner (Quake 3).", a.fillScreen, onChange = a.onFillScreen, + ) val fgOpen = host.open == "fg" val fgLabel = when (a.frameGenEngine) { FrameGen.ENGINE_WINFG -> "Win-FG ${a.frameGenMultiplier}×" diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-session b/tools/linuxfs/overlay/usr/local/bin/bannerlator-session index 0bc8477cd4..bdcc653c9e 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-session +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-session @@ -347,6 +347,22 @@ case $mode in # moments later, so the seeder has only that gap to mark the redistributables as already run. # It stamps each prefix it has covered and skips it thereafter, so the extra passes cost # almost nothing. + # The drawer's "Stretch games to fill the screen" works live: the app writes its choice to + # ~/.droiddeck-fill, and each change goes to gamescope as GAMESCOPE_FORCE_WINDOWS_FULLSCREEN on + # the root window, which it watches. What gamescope was started with is where this begins. + ( + last=${BL_GAMESCOPE_FORCE_FULLSCREEN:-1} + while :; do + sleep 1 + want=$(cat "$HOME/.droiddeck-fill" 2>/dev/null) || continue + case $want in 0|1) ;; *) continue ;; esac + [ "$want" = "$last" ] && continue + if xprop -root -f GAMESCOPE_FORCE_WINDOWS_FULLSCREEN 32c -set GAMESCOPE_FORCE_WINDOWS_FULLSCREEN "$want" 2>/dev/null; then + echo "== stretch games to fill the screen: $want (live)" + last=$want + fi + done + ) & ( beat=0 for _ in $(seq 1 720); do From c951c71f82511489455a9c5fbc85a0c3a941852f Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 21:38:46 -0400 Subject: [PATCH 03/20] Show build identity on launcher --- .github/workflows/build.yml | 19 ++++++++ app/build.gradle | 41 +++++++++++++++++ .../com/droiddeck/launcher/MainActivity.kt | 4 ++ .../droiddeck/launcher/ui/FrontEndScreen.kt | 44 +++++++++++++++++++ 4 files changed, 108 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5965ffe22..8511575544 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,5 @@ name: Build APK +run-name: ${{ github.event_name == 'pull_request_target' && format('building pr {0} on {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('building {0} on {1}', github.ref_name, github.sha) }} # One job: the two glibc preload libraries the session needs, then the app around them. # Nothing is built on a developer machine - this workflow is the only thing that produces an apk. @@ -140,6 +141,22 @@ jobs: echo "NDK $VERSION at $NDK" echo "NDK_VERSION=$VERSION" >> "$GITHUB_ENV" + - name: Set the APK build label + id: build-label + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + BUILD_REF: ${{ github.ref_name }} + BUILD_SHA: ${{ github.sha }} + run: | + if [[ -n "$PR_NUMBER" ]]; then + label="pr${PR_NUMBER} at ${PR_HEAD_SHA:0:7}" + else + label="${BUILD_REF} at ${BUILD_SHA:0:7}" + fi + echo "label=$label" >> "$GITHUB_OUTPUT" + echo "Build: \`$label\`" >> "$GITHUB_STEP_SUMMARY" + # ── The session's preloads ─────────────────────────────────────────────────────────── # Both are glibc aarch64 libraries that live inside the rootfs, so they are cross-compiled # here rather than by the NDK. They ship in assets (not in the runtime tarball) so a fix in @@ -306,6 +323,8 @@ jobs: # The whole log is kept so a failed build's errors can be quoted back on a pull request. - name: Build id: build + env: + DROIDDECK_BUILD_LABEL: ${{ steps.build-label.outputs.label }} run: | set -o pipefail ./gradlew assembleRelease --console=plain -PndkVersion="$NDK_VERSION" 2>&1 | tee /tmp/build.log diff --git a/app/build.gradle b/app/build.gradle index 413b4e2238..821f2afb2e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,6 +4,45 @@ plugins { apply plugin: 'kotlin-android' apply plugin: 'org.jetbrains.kotlin.plugin.compose' +def gitValue = { List arguments -> + try { + def output = providers.exec { + commandLine(['git'] + arguments) + workingDir rootProject.projectDir + ignoreExitValue = true + } + output.result.get().exitValue == 0 ? output.standardOutput.asText.get().trim() : '' + } catch (Exception ignored) { + '' + } +} + +def buildLabel = providers.environmentVariable('DROIDDECK_BUILD_LABEL').getOrNull() +if (buildLabel == null || buildLabel.trim().isEmpty()) { + def eventName = providers.environmentVariable('GITHUB_EVENT_NAME').getOrNull() + def eventPath = providers.environmentVariable('GITHUB_EVENT_PATH').getOrNull() + if (eventName == 'pull_request_target' && eventPath) { + try { + def eventFile = layout.file(providers.provider { new File(eventPath) }) + def eventText = providers.fileContents(eventFile).asText.get() + def pullRequest = new groovy.json.JsonSlurper().parseText(eventText).pull_request + if (pullRequest?.number && pullRequest?.head?.sha) { + buildLabel = "pr${pullRequest.number} at ${pullRequest.head.sha.take(7)}" + } + } catch (Exception ignored) { + // Local builds and unusual CI events can omit the pull-request payload. + } + } + if (buildLabel == null || buildLabel.trim().isEmpty()) { + def branch = providers.environmentVariable('GITHUB_REF_NAME').getOrNull() + ?: gitValue(['branch', '--show-current']) ?: 'local' + def commit = providers.environmentVariable('GITHUB_SHA').getOrNull() + ?.take(7) ?: gitValue(['rev-parse', '--short=7', 'HEAD']) ?: 'unknown' + buildLabel = "${branch} at ${commit}" + } +} +def escapedBuildLabel = buildLabel.replace('\\', '\\\\').replace('"', '\\"') + android { namespace 'com.droiddeck.launcher' compileSdk 34 @@ -20,6 +59,7 @@ android { targetSdkVersion 28 versionCode 7 versionName "0.1.6" + buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\"" ndk { abiFilters 'arm64-v8a' @@ -87,6 +127,7 @@ android { buildFeatures { compose true + buildConfig true } compileOptions { diff --git a/app/src/main/java/com/droiddeck/launcher/MainActivity.kt b/app/src/main/java/com/droiddeck/launcher/MainActivity.kt index ca68e8e057..7e78b691ad 100644 --- a/app/src/main/java/com/droiddeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/MainActivity.kt @@ -244,6 +244,7 @@ class MainActivity : ComponentActivity() { packagePercent = pkgPercent, sessionRunning = SessionState.running, backActionsInverted = backActionsInverted, + buildLabel = BuildConfig.BUILD_LABEL, ), FrontEndActions( onPlay = { startSession(Intent(this, SessionActivity::class.java)) }, @@ -308,6 +309,9 @@ class MainActivity : ComponentActivity() { SessionPrefs.setBackActionsInverted(this, inverted) backActionsInverted = inverted }, + onCheckLatestBuild = { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/The412Banner/DroidDeck/actions/workflows/build.yml"))) + }, ), page = page, ) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 92774857a6..93bc551852 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -59,11 +59,13 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Refresh import androidx.compose.material.icons.filled.Settings import androidx.compose.material3.Icon import androidx.compose.material3.LinearProgressIndicator @@ -98,6 +100,7 @@ import androidx.compose.ui.layout.positionInRoot import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.painterResource +import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.IntOffset @@ -143,6 +146,7 @@ class FrontEndState( val packagePercent: Int = -1, val sessionRunning: Boolean = false, val backActionsInverted: Boolean = false, + val buildLabel: String = "local", ) class FrontEndActions( @@ -172,6 +176,7 @@ class FrontEndActions( val onHomeApp: () -> Unit = {}, val onAndroidApp: (com.droiddeck.launcher.HomeApp.LaunchableApp) -> Unit = {}, val onBackActionsInverted: (Boolean) -> Unit = {}, + val onCheckLatestBuild: () -> Unit = {}, ) @@ -466,6 +471,45 @@ private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: ( }, label = "pane", ) { key -> if (page != null && key == s.pageKey) page() else Content(s, key, a, Modifier.fillMaxSize(), onSelect) } + if (page == null && s.pageKey == null && selected == "steam") { + BuildStatus( + label = s.buildLabel, + onCheckLatest = a.onCheckLatestBuild, + modifier = Modifier.align(Alignment.TopEnd).padding(12.dp), + ) + } + } +} + +@Composable +private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modifier = Modifier) { + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val interaction = remember { MutableInteractionSource() } + val hot = rememberHot(interaction) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(9.dp), + modifier = modifier + .widthIn(max = 360.dp) + .clip(Shape12) + .background(colors.surface.copy(alpha = 0.96f)) + .border(1.5.dp, if (hot) pal.signal else pal.line2, Shape12) + .hoverable(interaction) + .clickable( + interactionSource = interaction, + indication = LocalIndication.current, + role = Role.Button, + onClick = onCheckLatest, + ) + .padding(horizontal = 11.dp, vertical = 7.dp), + ) { + Column(modifier = Modifier.weight(1f)) { + Text("BUILD", fontSize = 9.sp, letterSpacing = 1.sp, color = colors.onSurfaceVariant) + Text(label, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) + } + Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(15.dp)) + Text("Check latest", fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = if (hot) pal.signal else colors.onBackground, maxLines = 1) } } From 8e3083507a5c45410bfef4e150cd5cc86eda40c4 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 23:07:59 -0400 Subject: [PATCH 04/20] Remove build badge caption --- .../main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 93bc551852..35732091e3 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -504,10 +504,7 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi ) .padding(horizontal = 11.dp, vertical = 7.dp), ) { - Column(modifier = Modifier.weight(1f)) { - Text("BUILD", fontSize = 9.sp, letterSpacing = 1.sp, color = colors.onSurfaceVariant) - Text(label, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) - } + Text(label, modifier = Modifier.weight(1f), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(15.dp)) Text("Check latest", fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = if (hot) pal.signal else colors.onBackground, maxLines = 1) } From 39141d5c23c35c89ff0e0ad875b3b3be2f53f649 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 23:21:09 -0400 Subject: [PATCH 05/20] Make session menu controller driven --- app/build.gradle | 1 - .../com/droiddeck/launcher/SessionActivity.kt | 15 +++++++-- .../droiddeck/launcher/ui/FrontEndScreen.kt | 1 + .../droiddeck/launcher/ui/SessionOverlay.kt | 31 +++++++++++++++++-- .../droiddeck/launcher/ui/SettingsWidgets.kt | 25 +++++++++++++++ 5 files changed, 67 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 821f2afb2e..bf8efebbe9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,7 +30,6 @@ if (buildLabel == null || buildLabel.trim().isEmpty()) { buildLabel = "pr${pullRequest.number} at ${pullRequest.head.sha.take(7)}" } } catch (Exception ignored) { - // Local builds and unusual CI events can omit the pull-request payload. } } if (buildLabel == null || buildLabel.trim().isEmpty()) { diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index f2a088b7a1..8889ad34c1 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -94,6 +94,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var drawerDirectionDownTime = 0L private var drawerDirectionLastRepeat = 0L private var drawerDirectionDeviceId = -1 + private val resumeKeysDown = mutableSetOf>() // Compose reads these; the activity writes them. private var drawerOpen by mutableStateOf(false) @@ -675,8 +676,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE -> return super.dispatchKeyEvent(event) } - // Keep keys in the Android/Compose focus tree while the drawer is open. Its Back key and - // controller B always dismiss the drawer; directional and confirm keys stay with the UI. + val fromController = PadBridge.isFromController(event.device) + val resumeKey = event.keyCode == KeyEvent.KEYCODE_BUTTON_A || event.keyCode == KeyEvent.KEYCODE_BUTTON_START + val resumeKeyId = event.deviceId to event.keyCode + if (fromController && resumeKey && (SessionState.suspended || resumeKeyId in resumeKeysDown)) { + if (event.action == KeyEvent.ACTION_DOWN) { + resumeKeysDown.add(resumeKeyId) + if (event.repeatCount == 0 && SessionState.suspended) SessionService.resume(this) + } else if (event.action == KeyEvent.ACTION_UP) { + resumeKeysDown.remove(resumeKeyId) + } + return true + } if (drawerOpen) { if (event.keyCode == KeyEvent.KEYCODE_BACK || event.keyCode == KeyEvent.KEYCODE_BUTTON_B) { if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) drawerOpen = false diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 35732091e3..6ed54f34b3 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -883,6 +883,7 @@ internal fun SecondaryButton(text: String, enabled: Boolean = true, onClick: () modifier = Modifier.graphicsLayer { scaleX = scale; scaleY = scale }.clip(Shape12).background(fill).border(1.dp, edge, Shape12) .alpha(if (enabled) 1f else 0.5f) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick) + .controllerConfirm(enabled = enabled, onClick = onClick) .padding(horizontal = 16.dp, vertical = 11.dp), ) { Text(text, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 0.5.sp, color = colors.onBackground, maxLines = 1) } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index c0bbd47b50..febe2825bb 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import androidx.activity.compose.BackHandler import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -54,6 +55,7 @@ import androidx.compose.animation.slideOutHorizontally import androidx.compose.foundation.LocalIndication import androidx.compose.foundation.border import androidx.compose.foundation.hoverable +import androidx.compose.foundation.focusGroup import androidx.compose.foundation.interaction.collectIsFocusedAsState import androidx.compose.foundation.interaction.collectIsHoveredAsState import androidx.compose.foundation.layout.Arrangement @@ -65,6 +67,8 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.draw.clip +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.InputMode @@ -126,6 +130,11 @@ fun LoadingOverlay(step: String, percent: Int, elapsed: String, hint: String, en @Composable fun SessionPausedOverlay(onResume: () -> Unit) { val interactionSource = remember { MutableInteractionSource() } + val resumeFocus = remember { FocusRequester() } + LaunchedEffect(Unit) { + androidx.compose.runtime.withFrameNanos { } + runCatching { resumeFocus.requestFocus() } + } Box( modifier = Modifier .fillMaxSize() @@ -137,7 +146,10 @@ fun SessionPausedOverlay(onResume: () -> Unit) { horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(32.dp), ) { - OutlinedButton(onClick = onResume) { + OutlinedButton( + onClick = onResume, + modifier = Modifier.focusRequester(resumeFocus).controllerConfirm(onClick = onResume), + ) { Text("Resume session") } } @@ -199,6 +211,9 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { var firstControlFocused by remember { mutableStateOf(false) } val inputModeManager = LocalInputModeManager.current val steamButtons = a.onSteamMenu != null && a.onQam != null + BackHandler(enabled = open) { + if (host.open != null) host.open = null else a.onClose() + } LaunchedEffect(open) { if (open) { inputModeManager.requestInputMode(InputMode.Keyboard) @@ -228,6 +243,9 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { .background(pal.background.copy(alpha = 0.97f)) .clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {} .focusGroup() + .controllerBack { + if (host.open != null) host.open = null else a.onClose() + } .verticalScroll(rememberScrollState()) .padding(horizontal = 14.dp, vertical = 16.dp), ) { @@ -259,7 +277,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { onClick = { host.open = null; a.onSteamMenu.invoke() }, interactionSource = steamSrc, modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus) - .onFocusChanged { firstControlFocused = it.isFocused }, + .onFocusChanged { firstControlFocused = it.isFocused }.controllerConfirm { + host.open = null + a.onSteamMenu.invoke() + }, shape = RoundedCornerShape(12.dp), border = BorderStroke(if (steamHot) 2.dp else 1.dp, if (steamHot) pal.signal else colors.outline), colors = ButtonDefaults.outlinedButtonColors(containerColor = if (steamHot) pal.signal.copy(alpha = 0.16f) else Color.Transparent), @@ -273,7 +294,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { qamStartedOnPress = false }, interactionSource = qamInteraction, - modifier = Modifier.weight(1f).height(48.dp).semantics { contentDescription = "Open Quick Access Menu" }, + modifier = Modifier.weight(1f).height(48.dp).semantics { contentDescription = "Open Quick Access Menu" }.controllerConfirm { + host.open = null + a.onQam.invoke() + }, shape = RoundedCornerShape(12.dp), border = BorderStroke(if (qamHot) 2.dp else 1.dp, if (qamHot) pal.signal else colors.outline), colors = ButtonDefaults.outlinedButtonColors(containerColor = if (qamHot) pal.signal.copy(alpha = 0.16f) else Color.Transparent), @@ -410,6 +434,7 @@ private fun DangerButton(text: String, onClick: () -> Unit) { Box( modifier = Modifier.clip(RoundedCornerShape(12.dp)).background(fill).border(1.dp, colors.error.copy(alpha = if (hot) 0.9f else 0.5f), RoundedCornerShape(12.dp)) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, onClick = onClick) + .controllerConfirm(onClick = onClick) .padding(horizontal = 16.dp, vertical = 11.dp), ) { Text(text, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 0.5.sp, color = colors.error, maxLines = 1) } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt index da7fd678db..7577264693 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import android.view.KeyEvent import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.animateColorAsState @@ -52,6 +53,7 @@ import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -69,6 +71,26 @@ import androidx.compose.ui.window.PopupProperties private val RowShape = RoundedCornerShape(12.dp) private val GroupShape = RoundedCornerShape(14.dp) +internal fun Modifier.controllerConfirm(enabled: Boolean = true, onClick: () -> Unit): Modifier = onPreviewKeyEvent { event -> + val keyEvent = event.nativeKeyEvent + if (keyEvent.keyCode != KeyEvent.KEYCODE_BUTTON_A) { + false + } else { + if (enabled && keyEvent.action == KeyEvent.ACTION_DOWN && keyEvent.repeatCount == 0) onClick() + true + } +} + +internal fun Modifier.controllerBack(onBack: () -> Unit): Modifier = onPreviewKeyEvent { event -> + val keyEvent = event.nativeKeyEvent + if (keyEvent.keyCode != KeyEvent.KEYCODE_BUTTON_B && keyEvent.keyCode != KeyEvent.KEYCODE_BACK) { + false + } else { + if (keyEvent.action == KeyEvent.ACTION_DOWN && keyEvent.repeatCount == 0) onBack() + true + } +} + class MenuHost { var open by mutableStateOf(null) } @@ -114,6 +136,7 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no .clip(RowShape) .background(pal.surfaceVariant.copy(alpha = 0.95f)) .border(1.dp, pal.signal.copy(alpha = 0.22f), RowShape) + .controllerBack(onDismiss) .padding(6.dp), ) { if (title != null) Text( @@ -149,6 +172,7 @@ fun MenuItem( .background(if (hot && enabled) Color.White.copy(alpha = 0.07f) else Color.Transparent) .alpha(if (enabled) 1f else 0.4f) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick) + .controllerConfirm(enabled = enabled, onClick = onClick) .padding(horizontal = 10.dp, vertical = 9.dp), ) { Text("✓", fontSize = 12.sp, color = pal.signal, modifier = Modifier.width(18.dp).alpha(if (checked) 1f else 0f)) @@ -181,6 +205,7 @@ fun ValueChip(text: String, open: Boolean, enabled: Boolean = true, modifier: Mo .border(1.dp, edge, RoundedCornerShape(10.dp)) .alpha(if (enabled) 1f else 0.5f) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick) + .controllerConfirm(enabled = enabled, onClick = onClick) .padding(horizontal = 12.dp, vertical = 8.dp), ) { AnimatedContent( From 7c1a603ddbb18112822609e82c7abfed882ea272 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 23:26:29 -0400 Subject: [PATCH 06/20] Add second-screen controls close button --- .../java/com/droiddeck/launcher/SessionActivity.kt | 1 + .../launcher/ui/SecondScreenPresentation.kt | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 8889ad34c1..62a672054c 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -905,6 +905,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { onQam = { if (SessionState.mode == SessionService.MODE_STEAM) padBridge?.triggerQam() }, + onClose = { selectSecondScreenMode(SecondScreenMode.NONE) }, ) secondScreenPresentation = presentation } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt b/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt index 818d72624d..3a4bdb2ef6 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt @@ -44,6 +44,7 @@ class SecondScreenPresentation( private val sendWheel: (steps: Int) -> Unit, private val onSteamMenu: () -> Unit, private val onQam: () -> Unit, + private val onClose: () -> Unit, ) : Presentation(sessionActivity, display) { private val root = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL @@ -124,6 +125,12 @@ class SecondScreenPresentation( setPadding(dp(12), dp(8), dp(12), dp(8)) setBackgroundColor(0xE6191E24.toInt()) } + controls.addView(Button(context).apply { + text = "×" + contentDescription = "Close second-screen controls" + minWidth = dp(48) + setOnClickListener { onClose() } + }) controls.addView(TextView(context).apply { text = "Trackpad" textSize = 14f @@ -169,6 +176,12 @@ class SecondScreenPresentation( setPadding(dp(8), dp(4), dp(8), dp(4)) setBackgroundColor(Color.rgb(27, 32, 38)) } + bar.addView(Button(context).apply { + text = "×" + contentDescription = "Close second-screen controls" + minWidth = dp(48) + setOnClickListener { onClose() } + }) bar.addView(TextView(context).apply { text = "Linux terminal" textSize = 14f From e1ae162c79d2ef6e8e75b25f41c5706195bac56b Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 23:38:53 -0400 Subject: [PATCH 07/20] Add direct touchscreen input for Steam sessions --- app/src/main/cpp/waylandcomp/src/compositor.c | 217 +++++++++++++++++- .../cpp/waylandcomp/src/waylandcomp_jni.c | 7 + .../com/droiddeck/launcher/SessionActivity.kt | 24 +- .../launcher/wayland/WaylandCompositor.java | 2 + 4 files changed, 232 insertions(+), 18 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/compositor.c b/app/src/main/cpp/waylandcomp/src/compositor.c index 55fb521586..5b7642bb7d 100644 --- a/app/src/main/cpp/waylandcomp/src/compositor.c +++ b/app/src/main/cpp/waylandcomp/src/compositor.c @@ -465,17 +465,23 @@ static void release_buffer(struct surface *s, struct wl_resource *buffer, int64_ /* Each Wine process is a separate client with its own wl_pointer / wl_keyboard. */ struct seat_pointer { struct wl_resource *ptr; struct wl_resource *focus; }; struct seat_keyboard { struct wl_resource *kb; struct wl_resource *focus; }; +struct seat_touch { struct wl_resource *touch; struct wl_resource *focus; }; #define MAX_PTRS 32 +#define MAX_TOUCH_POINTS 32 static struct seat_pointer g_ptrs[MAX_PTRS]; static int g_nptrs; static struct seat_keyboard g_kbs[MAX_PTRS]; static int g_nkbs; +static struct seat_touch g_touches[MAX_PTRS]; +static int g_ntouches; +struct active_touch { struct surface *surface; int pointer_fallback; }; +static struct active_touch g_touch_points[MAX_TOUCH_POINTS]; +static void touch_cancel_surface(struct surface *surface); static struct surface *g_grab; /* no-desktop fallback: surface holding the button */ static struct surface *g_key_target; /* no-desktop fallback: last clicked surface */ static struct surface *g_ime_click; /* last clicked program window: where text input goes */ static int g_input_pipe[2] = {-1, -1}; -/* type 0 = pointer (p1=action 0down/1move/2up, p2=x, p3=y); type 1 = key (p1=evdev, p2=state 1down/0up) */ -struct input_msg { int type; int p1; int p2; int p3; }; +struct input_msg { int type; int p1; int p2; int p3; int p4; }; /* Pointer constraints (zwp_pointer_constraints_v1) and relative pointers * (zwp_relative_pointer_manager_v1); see the "pointer constraints" section. */ @@ -1002,6 +1008,7 @@ static void surface_resource_destroy(struct wl_resource *r) { if (!s) return; for (int i = 0; i < g_nptrs; i++) if (g_ptrs[i].focus == r) g_ptrs[i].focus = NULL; for (int i = 0; i < g_nkbs; i++) if (g_kbs[i].focus == r) g_kbs[i].focus = NULL; + touch_cancel_surface(s); if (g_grab == s) g_grab = NULL; if (g_key_target == s) g_key_target = NULL; if (g_ime_click == s) g_ime_click = NULL; @@ -2401,6 +2408,10 @@ static void keyboard_res_destroy(struct wl_resource *r) { } static void touch_release(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); } static const struct wl_touch_interface touch_impl = { .release = touch_release }; +static void touch_res_destroy(struct wl_resource *r) { + for (int i = 0; i < g_ntouches; i++) + if (g_touches[i].touch == r) { g_touches[i] = g_touches[--g_ntouches]; break; } +} static void seat_get_pointer(struct wl_client *c, struct wl_resource *r, uint32_t id) { struct wl_resource *p = wl_resource_create(c, &wl_pointer_interface, wl_resource_get_version(r), id); @@ -2432,7 +2443,13 @@ static void seat_get_keyboard(struct wl_client *c, struct wl_resource *r, uint32 } static void seat_get_touch(struct wl_client *c, struct wl_resource *r, uint32_t id) { struct wl_resource *t = wl_resource_create(c, &wl_touch_interface, wl_resource_get_version(r), id); - if (t) wl_resource_set_implementation(t, &touch_impl, NULL, NULL); + if (!t) { wl_client_post_no_memory(c); return; } + wl_resource_set_implementation(t, &touch_impl, NULL, touch_res_destroy); + if (g_ntouches < MAX_PTRS) { + g_touches[g_ntouches].touch = t; + g_touches[g_ntouches].focus = NULL; + g_ntouches++; + } } static void seat_release(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); } static const struct wl_seat_interface seat_impl = { @@ -2442,7 +2459,7 @@ static const struct wl_seat_interface seat_impl = { static void bind_seat(struct wl_client *c, void *data, uint32_t ver, uint32_t id) { struct wl_resource *r = wl_resource_create(c, &wl_seat_interface, ver, id); wl_resource_set_implementation(r, &seat_impl, NULL, NULL); - wl_seat_send_capabilities(r, WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD); + wl_seat_send_capabilities(r, WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD | WL_SEAT_CAPABILITY_TOUCH); if (ver >= 2) wl_seat_send_name(r, "bannerlator-seat"); } @@ -2466,6 +2483,9 @@ static struct seat_keyboard *keyboard_for(struct wl_client *client) { #define for_each_keyboard_of(client, sk) \ for (int _i = 0; _i < g_nkbs; _i++) \ if (((sk) = &g_kbs[_i]), wl_resource_get_client((sk)->kb) == (client)) +#define for_each_touch_of(client, st) \ + for (int _i = 0; _i < g_ntouches; _i++) \ + if (((st) = &g_touches[_i]), wl_resource_get_client((st)->touch) == (client)) /* Topmost window whose scene rectangle contains the point (no-desktop fallback). */ static struct surface *toplevel_at(double x, double y) { @@ -3000,6 +3020,179 @@ static void deliver_pointer(const struct input_msg *m) { pointer_event(x, y, m->p1 == 1 ? 0 : BTN_LEFT, m->p1 == 0); } +static void input_output_to_scene(int px, int py, double *x, double *y) { + int w, h, ow, oh; + scene_size(&w, &h); + vkp_output_size(&ow, &oh); + if (ow <= 0 || oh <= 0 || + !vkp_output_to_scene((double)px * ow / INPUT_SPACE_W, (double)py * oh / INPUT_SPACE_H, x, y)) { + *x = (double)px * w / INPUT_SPACE_W; + *y = (double)py * h / INPUT_SPACE_H; + } + if (*x < 0) *x = 0; + if (*y < 0) *y = 0; + if (*x > w - 1) *x = w - 1; + if (*y > h - 1) *y = h - 1; +} + +static int touch_points_for_client(struct wl_client *client) { + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + struct surface *surface = g_touch_points[i].surface; + if (surface && wl_resource_get_client(surface->resource) == client) return 1; + } + return 0; +} + +static void touch_frame(struct wl_client *client) { + struct seat_touch *st; + for_each_touch_of(client, st) + if (wl_resource_get_version(st->touch) >= WL_TOUCH_FRAME_SINCE_VERSION) + wl_touch_send_frame(st->touch); +} + +static void touch_cancel_client(struct wl_client *client) { + struct seat_touch *st; + int release_pointer = 0; + for_each_touch_of(client, st) { + if (st->focus) wl_touch_send_cancel(st->touch); + st->focus = NULL; + } + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + struct surface *surface = g_touch_points[i].surface; + if (surface && wl_resource_get_client(surface->resource) == client) { + release_pointer |= g_touch_points[i].pointer_fallback; + memset(&g_touch_points[i], 0, sizeof(g_touch_points[i])); + } + } + if (release_pointer) pointer_button(BTN_LEFT, 0); + wl_display_flush_clients(g_display); +} + +static void touch_cancel_all(void) { + int release_pointer = 0; + for (int i = 0; i < g_ntouches; i++) { + if (g_touches[i].focus) wl_touch_send_cancel(g_touches[i].touch); + g_touches[i].focus = NULL; + } + for (int i = 0; i < MAX_TOUCH_POINTS; i++) + release_pointer |= g_touch_points[i].pointer_fallback; + memset(g_touch_points, 0, sizeof(g_touch_points)); + if (release_pointer) pointer_button(BTN_LEFT, 0); + wl_display_flush_clients(g_display); +} + +static void touch_cancel_surface(struct surface *surface) { + struct wl_client *client = wl_resource_get_client(surface->resource); + for (int i = 0; i < MAX_TOUCH_POINTS; i++) + if (g_touch_points[i].surface == surface) { + touch_cancel_client(client); + return; + } +} + +static struct surface *touch_target_at(double x, double y) { + struct surface *target = toplevel_at(x, y); + if (target) return target; + if (g_desktop) return g_desktop; + return g_grab ? g_grab : g_key_target; +} + +static void touch_down(int id, double x, double y) { + if (id < 0 || id >= MAX_TOUCH_POINTS) return; + struct surface *target = touch_target_at(x, y); + if (!target) return; + struct wl_client *client = wl_resource_get_client(target->resource); + int any_active = 0; + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + struct surface *active = g_touch_points[i].surface; + if (!active) continue; + any_active = 1; + if (active != target) { + touch_cancel_all(); + any_active = 0; + break; + } + } + if (g_touch_points[id].surface) touch_cancel_client(client); + struct seat_touch *st; + int has_touch = 0; + for_each_touch_of(client, st) has_touch = 1; + if (!has_touch) { + if (any_active) return; + g_touch_points[id].surface = target; + g_touch_points[id].pointer_fallback = 1; + pointer_event(x, y, BTN_LEFT, 1); + wl_display_flush_clients(g_display); + return; + } + int tx = 0, ty = 0; + if (target != g_desktop && target->placed) { tx = target->x; ty = target->y; } + wl_fixed_t fx = wl_fixed_from_double(x - tx), fy = wl_fixed_from_double(y - ty); + int sent = 0; + for_each_touch_of(client, st) { + st->focus = target->resource; + wl_touch_send_down(st->touch, wl_display_next_serial(g_display), now_ms(), + target->resource, id, fx, fy); + sent = 1; + } + if (!sent) return; + g_touch_points[id].surface = target; + touch_frame(client); + wl_display_flush_clients(g_display); +} + +static void touch_motion(int id, double x, double y) { + if (id < 0 || id >= MAX_TOUCH_POINTS) return; + struct surface *target = g_touch_points[id].surface; + if (!target) return; + if (g_touch_points[id].pointer_fallback) { + pointer_event(x, y, 0, 0); + wl_display_flush_clients(g_display); + return; + } + struct wl_client *client = wl_resource_get_client(target->resource); + int tx = 0, ty = 0; + if (target != g_desktop && target->placed) { tx = target->x; ty = target->y; } + wl_fixed_t fx = wl_fixed_from_double(x - tx), fy = wl_fixed_from_double(y - ty); + struct seat_touch *st; + for_each_touch_of(client, st) + if (st->focus == target->resource) + wl_touch_send_motion(st->touch, now_ms(), id, fx, fy); + touch_frame(client); + wl_display_flush_clients(g_display); +} + +static void touch_up(int id, double x, double y) { + if (id < 0 || id >= MAX_TOUCH_POINTS) return; + struct surface *target = g_touch_points[id].surface; + if (!target) return; + if (g_touch_points[id].pointer_fallback) { + memset(&g_touch_points[id], 0, sizeof(g_touch_points[id])); + pointer_event(x, y, BTN_LEFT, 0); + wl_display_flush_clients(g_display); + return; + } + struct wl_client *client = wl_resource_get_client(target->resource); + struct seat_touch *st; + for_each_touch_of(client, st) + if (st->focus == target->resource) + wl_touch_send_up(st->touch, wl_display_next_serial(g_display), now_ms(), id); + memset(&g_touch_points[id], 0, sizeof(g_touch_points[id])); + touch_frame(client); + if (!touch_points_for_client(client)) + for_each_touch_of(client, st) st->focus = NULL; + wl_display_flush_clients(g_display); +} + +static void deliver_touch(const struct input_msg *m) { + double x, y; + input_output_to_scene(m->p3, m->p4, &x, &y); + if (m->p1 == 0) touch_down(m->p2, x, y); + else if (m->p1 == 1) touch_motion(m->p2, x, y); + else if (m->p1 == 2) touch_up(m->p2, x, y); + else if (m->p1 == 3) touch_cancel_all(); +} + static void key_event(uint32_t evdev, int pressed); struct wl_resource *banner_ime_target(void); static void deliver_key(const struct input_msg *m) { @@ -3068,6 +3261,7 @@ static int on_input_readable(int fd, uint32_t mask, void *data) { case 4: scroll_event(m.p1); break; case 5: on_vsync(((int64_t)m.p1 << 32) | (uint32_t)m.p2); break; case 6: pointer_delta(m.p1 / 256.0, m.p2 / 256.0); break; /* relative motion, 1/256 px */ + case 7: deliver_touch(&m); break; default: deliver_pointer(&m); break; } } @@ -3078,7 +3272,14 @@ static int on_input_readable(int fd, uint32_t mask, void *data) { * dispatches it. x/y are in INPUT_SPACE (0..1919, 0..1079) over the whole output. */ void banner_wayland_send_pointer(int action, int x, int y) { if (g_input_pipe[1] < 0) return; - struct input_msg m = { 0, action, x, y }; + struct input_msg m = { 0, action, x, y, 0 }; + ssize_t n = write(g_input_pipe[1], &m, sizeof(m)); + (void)n; +} + +void banner_wayland_send_touch(int action, int pointer_id, int x, int y) { + if (g_input_pipe[1] < 0) return; + struct input_msg m = { 7, action, pointer_id, x, y }; ssize_t n = write(g_input_pipe[1], &m, sizeof(m)); (void)n; } @@ -3086,7 +3287,7 @@ void banner_wayland_send_pointer(int action, int x, int y) { /* Called from JNI. Queues a key event. evdev = Linux input keycode (e.g. KEY_A=30); state 1=down 0=up. */ void banner_wayland_send_key(int evdev, int state) { if (g_input_pipe[1] < 0) return; - struct input_msg m = { 1, evdev, state, 0 }; + struct input_msg m = { 1, evdev, state, 0, 0 }; ssize_t n = write(g_input_pipe[1], &m, sizeof(m)); (void)n; } @@ -3094,7 +3295,7 @@ void banner_wayland_send_key(int evdev, int state) { /* Called from JNI on every screen refresh (Choreographer). */ void banner_wayland_vsync(int64_t frame_time_ns) { if (g_input_pipe[1] < 0) return; - struct input_msg m = { 5, (int)(frame_time_ns >> 32), (int)(uint32_t)frame_time_ns, 0 }; + struct input_msg m = { 5, (int)(frame_time_ns >> 32), (int)(uint32_t)frame_time_ns, 0, 0 }; ssize_t n = write(g_input_pipe[1], &m, sizeof(m)); (void)n; } @@ -3104,7 +3305,7 @@ void banner_wayland_vsync(int64_t frame_time_ns) { * 6 = relative motion by a,b in 1/256 pixel (the app's Relative Mouse / captured-mouse path). */ void banner_wayland_send_scene_input(int type, int a, int b) { if (g_input_pipe[1] < 0) return; - struct input_msg m = { type, a, b, 0 }; + struct input_msg m = { type, a, b, 0, 0 }; ssize_t n = write(g_input_pipe[1], &m, sizeof(m)); (void)n; } diff --git a/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c b/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c index 9698e1cfd2..2125a5c088 100644 --- a/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c +++ b/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c @@ -23,6 +23,7 @@ extern int banner_wayland_run(void); extern void banner_wayland_send_pointer(int action, int x, int y); +extern void banner_wayland_send_touch(int action, int pointer_id, int x, int y); extern void banner_wayland_send_key(int evdev, int state); extern void banner_wayland_send_scene_input(int type, int a, int b); extern void banner_wayland_vsync(int64_t frame_time_ns); @@ -271,6 +272,12 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSendPointer( banner_wayland_send_pointer(action, x, y); } +JNIEXPORT void JNICALL +Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSendTouch( + JNIEnv *env, jclass clazz, jint action, jint pointer_id, jint x, jint y) { + banner_wayland_send_touch(action, pointer_id, x, y); +} + /* Inject a key event. evdev = Linux input keycode (KEY_A=30…); state 1=down 0=up. */ JNIEXPORT void JNICALL Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSendKey( diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 62a672054c..f936f26b7d 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -82,7 +82,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var onScreenControls: OnScreenControls? = null private var keyboard: KeyboardHost? = null private var watching = true - private lateinit var gestures: PointerGestures private lateinit var touchpad: TouchpadGestures private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO) private var cursorPos by mutableStateOf(androidx.compose.ui.geometry.Offset(-100f, -100f)) @@ -158,7 +157,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { padBridge = bridge onScreenControls = OnScreenControls(this, bridge).also { root.addView(it) } keyboard = KeyboardHost(this).also { root.addView(it) } - gestures = PointerGestures(PointerGestures.slop(this), pointerListener) touchpad = TouchpadGestures(PointerGestures.slop(this), pointerListener) // One arrow, ours: Android draws a system pointer for a mouse over any window, and the // session already draws the pointer it is sent. @@ -749,7 +747,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { return super.dispatchGenericMotionEvent(event) } - /** Convert a held left-stick or d-pad-hat direction into focus navigation. */ private fun dispatchDrawerDirection(event: MotionEvent) { val hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X) val hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y) @@ -792,12 +789,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { super.dispatchKeyEvent(event) } - /** - * The pointer. Touch goes through [PointerGestures] (tap, hold, drag, two-finger scroll); a - * mouse arrives with real buttons and a wheel and is forwarded as it is. Every position is - * mapped through the letterboxed rectangle into the compositor's fixed 1920x1080 pointer - * space, and the arrow is drawn where the app last sent the pointer. - */ private val pointerListener = object : PointerGestures.Listener { override fun onMove(x: Float, y: Float) = movePointer(x, y) override fun onButton(button: Int, pressed: Boolean, x: Float, y: Float) { @@ -966,7 +957,20 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } return touchpad.onTouch(event) } - return gestures.onTouch(event) + val rect = drawnRect() ?: return false + fun sendTouch(action: Int, index: Int) { + val x = ((event.getX(index) - rect.left) / rect.width()).coerceIn(0f, 1f) + val y = ((event.getY(index) - rect.top) / rect.height()).coerceIn(0f, 1f) + WaylandCompositor.nativeSendTouch(action, event.getPointerId(index), (x * 1919f).toInt(), (y * 1079f).toInt()) + } + when (event.actionMasked) { + MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> sendTouch(0, event.actionIndex) + MotionEvent.ACTION_MOVE -> for (index in 0 until event.pointerCount) sendTouch(1, index) + MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP -> sendTouch(2, event.actionIndex) + MotionEvent.ACTION_CANCEL -> WaylandCompositor.nativeSendTouch(3, -1, 0, 0) + else -> return false + } + return true } /** A mouse: hover moves, buttons press, the wheel scrolls. Android sends buttons as touch diff --git a/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java b/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java index 52afd790f0..b9b2eb5d15 100644 --- a/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java +++ b/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java @@ -169,6 +169,8 @@ public final class WaylandCompositor { * action: 0=down, 1=move, 2=up. x/y in compositor output space (0..1919, 0..1079). */ public static native void nativeSendPointer(int action, int x, int y); + public static native void nativeSendTouch(int action, int pointerId, int x, int y); + /** Inject a key event. evdev = Linux input keycode (KEY_A=30…); state: 1=down, 0=up. */ public static native void nativeSendKey(int evdev, int state); From b7270186e00baabe7271073de463a177f1264583 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 00:09:37 -0400 Subject: [PATCH 08/20] Fix controller focus in session drawer --- .../com/droiddeck/launcher/SessionActivity.kt | 8 +++++ .../droiddeck/launcher/ui/FrontEndScreen.kt | 13 +++++--- .../launcher/ui/ModeSettingsDialog.kt | 10 +++--- .../droiddeck/launcher/ui/SessionOverlay.kt | 4 +-- .../droiddeck/launcher/ui/SettingsWidgets.kt | 33 ++++++++++++++----- 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index f936f26b7d..5330ee9cdd 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -674,6 +674,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE -> return super.dispatchKeyEvent(event) } + if (drawerOpen) { + val handled = super.dispatchKeyEvent(event) + if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B || event.keyCode == KeyEvent.KEYCODE_BACK) { + if (!handled && event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) drawerOpen = false + releaseDrawerDirection() + } + return true + } val fromController = PadBridge.isFromController(event.device) val resumeKey = event.keyCode == KeyEvent.KEYCODE_BUTTON_A || event.keyCode == KeyEvent.KEYCODE_BUTTON_START val resumeKeyId = event.deviceId to event.keyCode diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 6ed54f34b3..a1e7a2a197 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -765,9 +765,9 @@ private fun SetupPanel(s: FrontEndState, a: FrontEndActions) { SettingsRow("Frame generation", "Select the frame generation mode") { Box { ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" } - AnchoredMenu(host.open == "fg", onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") { + AnchoredMenu(host.open == "fg", onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") { firstItemFocus -> val need = if (s.lsfgReady) null else "Install Lossless Scaling in Steam" - MenuItem("Off", checked = s.frameGenEngine == FrameGen.ENGINE_OFF) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); host.open = null } + MenuItem("Off", checked = s.frameGenEngine == FrameGen.ENGINE_OFF, focusRequester = firstItemFocus) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); host.open = null } for (m in 2..4) MenuItem("Win-FG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_WINFG && s.frameGenMultiplier == m) { a.onFrameGenPick(FrameGen.ENGINE_WINFG, m); host.open = null } for (m in 2..4) MenuItem("LSFG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_LSFG && s.frameGenMultiplier == m, enabled = s.lsfgReady, detail = need) { a.onFrameGenPick(FrameGen.ENGINE_LSFG, m); host.open = null } } @@ -788,8 +788,13 @@ private fun SetupPanel(s: FrontEndState, a: FrontEndActions) { SettingsRow("Theme", "Choose the launcher appearance") { Box { ValueChip(Themes.byId(s.theme).label, host.open == "theme") { host.open = if (host.open == "theme") null else "theme" } - AnchoredMenu(host.open == "theme", onDismiss = { if (host.open == "theme") host.open = null }, title = "Theme") { - for (t in Themes.all) MenuItem(t.label, checked = s.theme == t.id) { a.onTheme(t.id); host.open = null } + AnchoredMenu(host.open == "theme", onDismiss = { if (host.open == "theme") host.open = null }, title = "Theme") { firstItemFocus -> + Themes.all.forEachIndexed { index, theme -> + MenuItem(theme.label, checked = s.theme == theme.id, focusRequester = if (index == 0) firstItemFocus else null) { + a.onTheme(theme.id) + host.open = null + } + } } } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt b/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt index f18bd20d65..099b360548 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/ModeSettingsDialog.kt @@ -319,10 +319,12 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { AnchoredMenu( open, onDismiss = { if (host.open == "storage") host.open = null }, title = "Second library", note = "Games that stream assets from SD or shared storage may stutter. Keep them internal.", - ) { - for ((path, label) in options) MenuItem(label, checked = path == s.gameStorage) { - a.onGameStorage(path, if (path.isEmpty() || path == "off") "" else label.substringBefore(" ·")) - host.open = null + ) { firstItemFocus -> + options.forEachIndexed { index, (path, label) -> + MenuItem(label, checked = path == s.gameStorage, focusRequester = if (index == 0) firstItemFocus else null) { + a.onGameStorage(path, if (path.isEmpty() || path == "off") "" else label.substringBefore(" ·")) + host.open = null + } } MenuItem("Choose a folder…", checked = false) { host.open = null; a.onPickGameStorageFolder() } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index febe2825bb..0f443fbdce 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -350,9 +350,9 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { SettingsRow("Frame generation", null, highlighted = fgOpen) { Box { ValueChip(fgLabel, fgOpen) { host.open = if (fgOpen) null else "fg" } - AnchoredMenu(fgOpen, onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") { + AnchoredMenu(fgOpen, onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") { firstItemFocus -> val need = if (a.lsfgReady) null else "install Lossless Scaling in Steam" - MenuItem("Off", checked = a.frameGenEngine == FrameGen.ENGINE_OFF) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); host.open = null } + MenuItem("Off", checked = a.frameGenEngine == FrameGen.ENGINE_OFF, focusRequester = firstItemFocus) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); host.open = null } for (m in 2..4) MenuItem("Win-FG ${m}×", checked = a.frameGenEngine == FrameGen.ENGINE_WINFG && a.frameGenMultiplier == m) { a.onFrameGenPick(FrameGen.ENGINE_WINFG, m); host.open = null } for (m in 2..4) MenuItem("LSFG ${m}×", checked = a.frameGenEngine == FrameGen.ENGINE_LSFG && a.frameGenMultiplier == m, enabled = a.lsfgReady, detail = need) { a.onFrameGenPick(FrameGen.ENGINE_LSFG, m); host.open = null } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt index 7577264693..5139689b8e 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt @@ -40,6 +40,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -50,6 +51,8 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate import androidx.compose.ui.draw.shadow +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.graphics.graphicsLayer @@ -110,10 +113,17 @@ private class BelowEndProvider(private val gap: Int) : PopupPositionProvider { } @Composable -fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, note: String? = null, content: @Composable ColumnScope.() -> Unit) { +fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, note: String? = null, content: @Composable ColumnScope.(FocusRequester) -> Unit) { val state = remember { MutableTransitionState(false) } state.targetState = open if (!state.currentState && !state.targetState && state.isIdle) return + val firstItemFocus = remember { FocusRequester() } + LaunchedEffect(open) { + if (open) { + repeat(2) { androidx.compose.runtime.withFrameNanos { } } + runCatching { firstItemFocus.requestFocus() } + } + } val gap = with(LocalDensity.current) { 6.dp.roundToPx() } val provider = remember(gap) { BelowEndProvider(gap) } val colors = MaterialTheme.colorScheme @@ -143,7 +153,7 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no title.uppercase(), fontSize = 10.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 10.dp, top = 6.dp, bottom = 6.dp), ) - Column(Modifier.weight(1f, fill = false).verticalScroll(rememberScrollState())) { content() } + Column(Modifier.weight(1f, fill = false).verticalScroll(rememberScrollState())) { content(firstItemFocus) } if (note != null) { Spacer(Modifier.height(4.dp)) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line)) @@ -157,7 +167,8 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no @Composable fun MenuItem( label: String, checked: Boolean, enabled: Boolean = true, detail: String? = null, - trailing: (@Composable () -> Unit)? = null, leading: (@Composable () -> Unit)? = null, onClick: () -> Unit, + trailing: (@Composable () -> Unit)? = null, leading: (@Composable () -> Unit)? = null, + focusRequester: FocusRequester? = null, onClick: () -> Unit, ) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current @@ -168,6 +179,7 @@ fun MenuItem( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth() .graphicsLayer { translationX = shift.dp.toPx() } + .then(focusRequester?.let { Modifier.focusRequester(it) } ?: Modifier) .clip(RoundedCornerShape(8.dp)) .background(if (hot && enabled) Color.White.copy(alpha = 0.07f) else Color.Transparent) .alpha(if (enabled) 1f else 0.4f) @@ -259,8 +271,13 @@ fun ChoiceRow( SettingsRow(label, hint, highlighted = open) { Box { 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 } + AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label, note = note) { firstItemFocus -> + options.forEachIndexed { index, (value, text) -> + MenuItem(text, checked = value == selected, focusRequester = if (index == 0) firstItemFocus else null) { + onPick(value) + host.open = null + } + } } } } @@ -285,10 +302,10 @@ fun MultiRow( SettingsRow(label, hint, highlighted = open) { Box { ValueChip(summary, open, enabled) { 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 items) { + AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label, note = note) { firstItemFocus -> + items.forEachIndexed { index, (value, text) -> val on = value in selected - MenuItem(text, checked = on) { onToggle(value, !on) } + MenuItem(text, checked = on, focusRequester = if (index == 0) firstItemFocus else null) { onToggle(value, !on) } } } } From 2853962c1067ce16191f4b409576ab59795888ef Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 07:45:55 -0400 Subject: [PATCH 09/20] Move build status to launcher rail footer --- .../droiddeck/launcher/ui/FrontEndScreen.kt | 173 +++++++++--------- 1 file changed, 87 insertions(+), 86 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index a1e7a2a197..07c70f0b48 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -54,12 +54,12 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape @@ -101,6 +101,9 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.Role +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.IntOffset @@ -291,82 +294,89 @@ private fun Rail( ) { val colors = MaterialTheme.colorScheme Column( - modifier = modifier.background(colors.surface).verticalScroll(rememberScrollState()).padding(horizontal = 10.dp, vertical = 12.dp), - verticalArrangement = Arrangement.spacedBy(2.dp), + modifier = modifier.background(colors.surface).padding(horizontal = 10.dp, vertical = 12.dp), ) { - Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 8.dp, bottom = 10.dp)) { - Image(painterResource(R.drawable.logo), null, modifier = Modifier.size(30.dp)) - Spacer(Modifier.width(10.dp)) - Column { - Text("DroidDeck", fontSize = 18.sp, fontWeight = FontWeight.Bold, color = colors.onBackground) - val status = when { - s.busy -> if (s.percent >= 0) "${s.stage} ${s.percent}%" else s.stage - !s.ready -> "runtime not installed" - s.available != null && s.available != s.installed -> "runtime update available" - else -> null + Column( + modifier = Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState()), + verticalArrangement = Arrangement.spacedBy(2.dp), + ) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 8.dp, bottom = 10.dp)) { + Image(painterResource(R.drawable.logo), null, modifier = Modifier.size(30.dp)) + Spacer(Modifier.width(10.dp)) + Column { + Text("DroidDeck", fontSize = 18.sp, fontWeight = FontWeight.Bold, color = colors.onBackground) + val status = when { + s.busy -> if (s.percent >= 0) "${s.stage} ${s.percent}%" else s.stage + !s.ready -> "runtime not installed" + s.available != null && s.available != s.installed -> "runtime update available" + else -> null + } + if (status != null) Text(status, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis) } - if (status != null) Text(status, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis) } - } - AnimatedVisibility(s.busy, enter = expandVertically() + fadeIn(), exit = shrinkVertically() + fadeOut()) { - LinearProgressIndicator(modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp)) - } + AnimatedVisibility(s.busy, enter = expandVertically() + fadeIn(), exit = shrinkVertically() + fadeOut()) { + LinearProgressIndicator(modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp)) + } - var lastRunning by remember { mutableStateOf("") } - if (s.running != null) lastRunning = s.running - AnimatedVisibility( - s.running != null, - enter = expandVertically(Motion.sp(0.75f)) + fadeIn(Motion.tw(300)) + slideInVertically(Motion.sp(0.6f)) { -it / 2 }, - exit = shrinkVertically(Motion.tw(220)) + fadeOut(Motion.tw(180)), - ) { RunningTile(lastRunning, a.onResume) } + var lastRunning by remember { mutableStateOf("") } + if (s.running != null) lastRunning = s.running + AnimatedVisibility( + s.running != null, + enter = expandVertically(Motion.sp(0.75f)) + fadeIn(Motion.tw(300)) + slideInVertically(Motion.sp(0.6f)) { -it / 2 }, + exit = shrinkVertically(Motion.tw(220)) + fadeOut(Motion.tw(180)), + ) { RunningTile(lastRunning, a.onResume) } - val pal = LocalPalette.current - var navOrigin by remember { mutableStateOf(Offset.Zero) } - val positions = remember { mutableStateMapOf() } - Box(modifier = Modifier.fillMaxWidth().onGloballyPositioned { val o = it.positionInRoot(); if (o != navOrigin) navOrigin = o }) { - val target = positions[selected]?.translate(-navOrigin) - val y by animateFloatAsState(target?.top ?: 0f, Motion.sp(0.72f, Spring.StiffnessLow), label = "indY") - val x by animateFloatAsState(target?.left ?: 0f, Motion.sp(0.9f), label = "indX") - val h by animateFloatAsState(target?.height ?: 0f, Motion.sp(1f, Spring.StiffnessMediumLow), label = "indH") - val w by animateFloatAsState(target?.width ?: 0f, Motion.sp(1f, Spring.StiffnessMediumLow), label = "indW") - val alpha by animateFloatAsState(if (target != null) 1f else 0f, Motion.tw(250), label = "indA") - val density = LocalDensity.current - Box( - modifier = Modifier - .offset { IntOffset(x.roundToInt(), y.roundToInt()) } - .width(with(density) { w.toDp() }).height(with(density) { h.toDp() }) - .alpha(alpha) - .graphicsLayer { shadowElevation = 6.dp.toPx(); shape = Shape10; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal } - .clip(Shape10) - .background(Brush.linearGradient(listOf(colors.primary, pal.primary2))), + val pal = LocalPalette.current + var navOrigin by remember { mutableStateOf(Offset.Zero) } + val positions = remember { mutableStateMapOf() } + Box(modifier = Modifier.fillMaxWidth().onGloballyPositioned { val o = it.positionInRoot(); if (o != navOrigin) navOrigin = o }) { + val target = positions[selected]?.translate(-navOrigin) + val y by animateFloatAsState(target?.top ?: 0f, Motion.sp(0.72f, Spring.StiffnessLow), label = "indY") + val x by animateFloatAsState(target?.left ?: 0f, Motion.sp(0.9f), label = "indX") + val h by animateFloatAsState(target?.height ?: 0f, Motion.sp(1f, Spring.StiffnessMediumLow), label = "indH") + val w by animateFloatAsState(target?.width ?: 0f, Motion.sp(1f, Spring.StiffnessMediumLow), label = "indW") + val alpha by animateFloatAsState(if (target != null) 1f else 0f, Motion.tw(250), label = "indA") + val density = LocalDensity.current + Box( + modifier = Modifier + .offset { IntOffset(x.roundToInt(), y.roundToInt()) } + .width(with(density) { w.toDp() }).height(with(density) { h.toDp() }) + .alpha(alpha) + .graphicsLayer { shadowElevation = 6.dp.toPx(); shape = Shape10; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal } + .clip(Shape10) + .background(Brush.linearGradient(listOf(colors.primary, pal.primary2))), + ) + val register: (String, LayoutCoordinates) -> Unit = { key, c -> + val o = c.positionInRoot(); val r = Rect(o.x, o.y, o.x + c.size.width, o.y + c.size.height) + if (positions[key] != r) positions[key] = r + } + val unregister: (String) -> Unit = { positions.remove(it) } + Column(modifier = Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(2.dp)) { + if (s.isHomeApp) { + NavItem("Android apps", "android-apps", selected == "android-apps", count = s.androidApps.size, + register = register, unregister = unregister) { onSelect("android-apps") } + } + NavItem("Steam", "steam", selected == "steam", count = s.steamGames.size, register = register, unregister = unregister) { onSelect("steam") } + NavItem("Desktop", "desktop", selected == "desktop", count = s.emulators.count { it.installed }, register = register, unregister = unregister) { onSelect("desktop") } + NavItem("Setup", "setup", selected == "setup", register = register, unregister = unregister) { onSelect("setup") } + Spacer(Modifier.height(6.dp)) + } + } + + val creditsSrc = remember { MutableInteractionSource() } + val creditsHot = rememberHot(creditsSrc) + Text( + "credits", fontSize = 11.sp, color = if (creditsHot) LocalPalette.current.signal else colors.onSurfaceVariant, + modifier = Modifier.clip(Shape10) + .border(2.dp, if (creditsHot) LocalPalette.current.signal else Color.Transparent, Shape10) + .hoverable(creditsSrc).clickable(interactionSource = creditsSrc, indication = null, onClick = a.onCredits) + .padding(horizontal = 10.dp, vertical = 8.dp), ) - val register: (String, LayoutCoordinates) -> Unit = { key, c -> - val o = c.positionInRoot(); val r = Rect(o.x, o.y, o.x + c.size.width, o.y + c.size.height) - if (positions[key] != r) positions[key] = r - } - val unregister: (String) -> Unit = { positions.remove(it) } - Column(modifier = Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(2.dp)) { - if (s.isHomeApp) { - NavItem("Android apps", "android-apps", selected == "android-apps", count = s.androidApps.size, - register = register, unregister = unregister) { onSelect("android-apps") } - } - NavItem("Steam", "steam", selected == "steam", count = s.steamGames.size, register = register, unregister = unregister) { onSelect("steam") } - NavItem("Desktop", "desktop", selected == "desktop", count = s.emulators.count { it.installed }, register = register, unregister = unregister) { onSelect("desktop") } - NavItem("Setup", "setup", selected == "setup", register = register, unregister = unregister) { onSelect("setup") } - Spacer(Modifier.height(6.dp)) - } } - - // Outlined when a controller is on it, like every other control; the ripple alone was - // a faint box on the dark rail. - val creditsSrc = remember { MutableInteractionSource() } - val creditsHot = rememberHot(creditsSrc) - Text( - "credits", fontSize = 11.sp, color = if (creditsHot) LocalPalette.current.signal else colors.onSurfaceVariant, - modifier = Modifier.clip(Shape10) - .border(2.dp, if (creditsHot) LocalPalette.current.signal else Color.Transparent, Shape10) - .hoverable(creditsSrc).clickable(interactionSource = creditsSrc, indication = null, onClick = a.onCredits) - .padding(horizontal = 10.dp, vertical = 8.dp), + BuildStatus( + label = s.buildLabel, + onCheckLatest = a.onCheckLatestBuild, + modifier = Modifier.align(Alignment.Start).padding(start = 8.dp, top = 4.dp, bottom = 2.dp), ) } } @@ -471,13 +481,6 @@ private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: ( }, label = "pane", ) { key -> if (page != null && key == s.pageKey) page() else Content(s, key, a, Modifier.fillMaxSize(), onSelect) } - if (page == null && s.pageKey == null && selected == "steam") { - BuildStatus( - label = s.buildLabel, - onCheckLatest = a.onCheckLatestBuild, - modifier = Modifier.align(Alignment.TopEnd).padding(12.dp), - ) - } } } @@ -489,12 +492,10 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi val hot = rememberHot(interaction) Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(9.dp), + horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = modifier - .widthIn(max = 360.dp) - .clip(Shape12) - .background(colors.surface.copy(alpha = 0.96f)) - .border(1.5.dp, if (hot) pal.signal else pal.line2, Shape12) + .clip(RoundedCornerShape(6.dp)) + .semantics { contentDescription = "Build $label. Check for newest build." } .hoverable(interaction) .clickable( interactionSource = interaction, @@ -502,11 +503,11 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi role = Role.Button, onClick = onCheckLatest, ) - .padding(horizontal = 11.dp, vertical = 7.dp), + .heightIn(min = 40.dp) + .padding(horizontal = 8.dp), ) { - Text(label, modifier = Modifier.weight(1f), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) - Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(15.dp)) - Text("Check latest", fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = if (hot) pal.signal else colors.onBackground, maxLines = 1) + Text(label, fontSize = 10.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.72f), maxLines = 1, overflow = TextOverflow.Ellipsis) + Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.72f), modifier = Modifier.size(12.dp)) } } From 2b25e9bedd1b88ac3a1bd36d1cd89c668d71cbc2 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 07:46:20 -0400 Subject: [PATCH 10/20] Log session drawer controller routing --- .../java/com/droiddeck/launcher/SessionActivity.kt | 10 +++++++++- .../java/com/droiddeck/launcher/ui/SessionOverlay.kt | 6 +++++- .../java/com/droiddeck/launcher/ui/SettingsWidgets.kt | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 5330ee9cdd..f250d5e9f0 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -197,7 +197,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { if (drawerOpen) { padBridge?.releaseAll() androidx.compose.runtime.withFrameNanos { } - sessionOverlay.requestFocus() + val requested = sessionOverlay.requestFocus() + Log.i(TAG, "drawer root focus requested=$requested focused=${sessionOverlay.hasFocus()}") } else { releaseDrawerDirection() } @@ -676,6 +677,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } if (drawerOpen) { val handled = super.dispatchKeyEvent(event) + if (event.action == KeyEvent.ACTION_DOWN) { + Log.i(TAG, "drawer key=${KeyEvent.keyCodeToString(event.keyCode)} handled=$handled viewFocused=${sessionOverlay.hasFocus()}") + } if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B || event.keyCode == KeyEvent.KEYCODE_BACK) { if (!handled && event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) drawerOpen = false releaseDrawerDirection() @@ -769,6 +773,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } val now = SystemClock.uptimeMillis() if (keyCode != drawerDirectionKey) { + Log.i(TAG, "drawer axis source=${event.source} x=$x y=$y direction=$keyCode") releaseDrawerDirection() if (keyCode == KeyEvent.KEYCODE_UNKNOWN) return drawerDirectionKey = keyCode @@ -794,6 +799,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { drawerDirectionDownTime, eventTime, action, drawerDirectionKey, repeatCount, 0, drawerDirectionDeviceId, 0, 0, InputDevice.SOURCE_DPAD, ) + if (action == KeyEvent.ACTION_DOWN) { + Log.i(TAG, "drawer synthetic key=${KeyEvent.keyCodeToString(drawerDirectionKey)} viewFocused=${sessionOverlay.hasFocus()}") + } super.dispatchKeyEvent(event) } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index 0f443fbdce..b82c129468 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -69,6 +69,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.draw.clip import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.InputMode @@ -277,7 +278,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { onClick = { host.open = null; a.onSteamMenu.invoke() }, interactionSource = steamSrc, modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus) - .onFocusChanged { firstControlFocused = it.isFocused }.controllerConfirm { + .onFocusChanged { + firstControlFocused = it.isFocused + android.util.Log.i("SessionDrawer", "first control focused=${it.isFocused}") + }.controllerConfirm { host.open = null a.onSteamMenu.invoke() }, diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt index 5139689b8e..a7322987b0 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SettingsWidgets.kt @@ -122,6 +122,7 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no if (open) { repeat(2) { androidx.compose.runtime.withFrameNanos { } } runCatching { firstItemFocus.requestFocus() } + android.util.Log.i("AnchoredMenu", "requested first option focus") } } val gap = with(LocalDensity.current) { 6.dp.roundToPx() } From c11bca2dc255677d61ae78f15e1a83067a1d1ac2 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 07:50:22 -0400 Subject: [PATCH 11/20] Keep the build hash visible in rail watermark --- .../java/com/droiddeck/launcher/ui/FrontEndScreen.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 07c70f0b48..38a65ac75c 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -490,10 +490,14 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi val pal = LocalPalette.current val interaction = remember { MutableInteractionSource() } val hot = rememberHot(interaction) + val divider = label.lastIndexOf(" at ") + val branch = if (divider >= 0) label.substring(0, divider).substringAfterLast('/') else label + val displayLabel = if (divider >= 0) "$branch${label.substring(divider)}" else branch Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = modifier + .fillMaxWidth() .clip(RoundedCornerShape(6.dp)) .semantics { contentDescription = "Build $label. Check for newest build." } .hoverable(interaction) @@ -504,10 +508,10 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi onClick = onCheckLatest, ) .heightIn(min = 40.dp) - .padding(horizontal = 8.dp), + .padding(horizontal = 4.dp), ) { - Text(label, fontSize = 10.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.72f), maxLines = 1, overflow = TextOverflow.Ellipsis) - Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.72f), modifier = Modifier.size(12.dp)) + Text(displayLabel, modifier = Modifier.weight(1f), fontSize = 9.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1, overflow = TextOverflow.Ellipsis) + Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.82f), modifier = Modifier.size(12.dp)) } } From afdcf0591503995c12d3fab4a5933aa5cbc8e547 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 08:26:51 -0400 Subject: [PATCH 12/20] Proton launch: Quake-engine titles stay windowed at the session's size Quake III Arena, Team Arena, Return to Castle Wolfenstein and Jedi Academy set their own resolution and switch the display to it. Under gamescope with the ARM64 Proton that switch is refused ("calling CDS: failed, bad mode") and the game never gets OpenGL - device-seen on a Retroid Pocket 5 on Proton Experimental build 25406135 - and a window left at the game's own size draws small in a corner. Both wrappers (Valve's depot and an adopted GE or CachyOS) now add +set r_fullscreen 0 +set r_mode -1 +set r_customwidth/height at BL_WIDTH x BL_HEIGHT for those app ids, unless the user's launch options already set the video mode; the choice is logged. --- .../usr/local/bin/bannerlator-steam-compat | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat b/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat index b7c0659ad1..4156846a5b 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat @@ -87,6 +87,31 @@ bl_game_cpus() { } """ +# Quake III engine games (id Tech 3) set their own resolution and switch the display to it. Under +# gamescope with the ARM64 Proton that switch is refused ("calling CDS: failed, bad mode") and the +# game never gets OpenGL; left at its own size in a window, it draws small in a corner. So these +# titles are told to stay windowed at the session's own size - unless the user's launch options +# already say something about the video mode, which are left as they are. +BL_IDTECH3_SETUP = """ +bl_idtech3() { + BL_EXTRA_ARGS=() + case "${SteamAppId:-${STEAM_COMPAT_APP_ID:-}}" in + # Quake III Arena, Quake III: Team Arena, Return to Castle Wolfenstein, Jedi Academy. + 2200|2350|9010|6020) ;; + *) return 0 ;; + esac + case " $* " in + *r_fullscreen*|*r_mode*|*r_customwidth*|*r_customheight*) + echo "bannerlator-proton: Quake-engine title; its launch options set the video mode, left as they are" >&2 + return 0 ;; + esac + w=${BL_WIDTH:-1280} + h=${BL_HEIGHT:-720} + BL_EXTRA_ARGS=(+set r_fullscreen 0 +set r_mode -1 +set r_customwidth "$w" +set r_customheight "$h") + echo "bannerlator-proton: Quake-engine title: windowed at ${w}x${h}" >&2 +} +""" + BL_DIRECTAUDIO_SETUP = """ bl_directaudio() { base=$1 @@ -152,7 +177,8 @@ for name in %s; do if [ -d "$depot/files/bin-arm64" ] && [ -x "$depot/proton" ]; then bl_directaudio "$depot" bl_game_cpus - exec ${BL_TASKSET:-} "$depot/proton" "$verb" "$@" + bl_idtech3 "$@" + exec ${BL_TASKSET:-} "$depot/proton" "$verb" "$@" "${BL_EXTRA_ARGS[@]}" fi done echo "bannerlator-proton: no ARM64 Proton depot yet - the client downloads one as this tool's dependency; retry the launch once it has" >&2 @@ -162,7 +188,7 @@ exit 1 # and a % format would eat that into a single %, leaving a shell expansion that silently does # something else. LAUNCHER_SH = LAUNCHER_SH.replace( - "verb=$1; shift", "verb=$1; shift\n" + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP, 1) + "verb=$1; shift", "verb=$1; shift\n" + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP, 1) # A third-party Proton dropped into compatibilitytools.d - GE-Proton, proton-cachyos, anything of # that shape - is adopted rather than used as shipped, for the same two reasons Valve's ARM64 depot @@ -196,9 +222,10 @@ if [ -f "$fake" ]; then fi bl_directaudio "$here" bl_game_cpus +bl_idtech3 "$@" # Proton takes its base directory from dirname(sys.argv[0]) without resolving it, so it has to be # started from its own tree. -exec ${BL_TASKSET:-} "$here/%s" "$verb" "$@" +exec ${BL_TASKSET:-} "$here/%s" "$verb" "$@" "${BL_EXTRA_ARGS[@]}" """ EXTRA_COMPAT_TOOL_VDF = """"compatibilitytools" { @@ -357,7 +384,7 @@ def adopt_extras(tools): # ${major%%.*} of its own, and putting it through the format would eat both. body = (EXTRA_WRAPPER_SH % entry_point).replace( 'here=$(dirname "$0")', - 'here=$(dirname "$0")\n' + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP, 1) + 'here=$(dirname "$0")\n' + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP, 1) with open(wrapper, "w", encoding="utf-8") as f: f.write(body) os.chmod(wrapper, 0o755) From 88803f1276295989e6b09b389b92e981b5df6f77 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 08:59:45 -0400 Subject: [PATCH 13/20] Front end: controller focus starts on the rail and moves between rail and page predictably - The app opens with the selected rail item focused (its outline shows). - Right from the rail enters the page on its main button (Play, Open desktop, Open , Launch, Launch in ); Down from there reaches the tiles as before. - Left from anything at the page's left edge - the main button, the first tile of any row - returns to the selected rail item, not whichever one is nearest. (Up, where the rail sits above the page.) --- .../droiddeck/launcher/ui/FrontEndScreen.kt | 64 +++++++++++++++++-- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 92774857a6..0fbba69a88 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -1,5 +1,13 @@ package com.droiddeck.launcher.ui +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.foundation.focusGroup +import androidx.compose.ui.focus.FocusDirection +import androidx.compose.ui.focus.focusProperties +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.FocusRequester import android.graphics.Bitmap import android.os.Build import android.provider.Settings @@ -230,8 +238,29 @@ private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier } +/** + * Controller focus on the front end: each rail item's requester and the page's main button (Play, + * Open desktop, Open , Launch...). The pane enters on the main button and leaves, to the + * left, for the selected rail item - whatever tile or button it leaves from. + */ +private class FrontFocus { + val rail = HashMap() + val primary = FocusRequester() + var primaryAttached by mutableStateOf(0) + fun railFor(key: String): FocusRequester = rail.getOrPut(key) { FocusRequester() } +} + +private val LocalFrontFocus = staticCompositionLocalOf { null } + @Composable fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)? = null) { + val frontFocus = remember { FrontFocus() } + CompositionLocalProvider(LocalFrontFocus provides frontFocus) { FrontEndScreenBody(s, a, page, frontFocus) } +} + +@OptIn(ExperimentalComposeUiApi::class) +@Composable +private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)?, frontFocus: FrontFocus) { var selected by rememberSaveable { mutableStateOf("steam") } val colors = MaterialTheme.colorScheme val ctx = LocalContext.current @@ -272,7 +301,19 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () - modifier = if (wide) Modifier.width(236.dp).fillMaxHeight() else Modifier.fillMaxWidth().height(maxHeight * 0.42f), ) } - val content: @Composable (Modifier) -> Unit = { m -> Pane(s, selected, a, page, m) { selected = it } } + // The app opens with the selected rail item focused, so a controller sees where it is. + LaunchedEffect(Unit) { + kotlinx.coroutines.delay(150) + runCatching { frontFocus.railFor(railSelection).requestFocus() } + } + val back = if (wide) FocusDirection.Left else FocusDirection.Up + val paneFocus = Modifier + .focusProperties { + enter = { if (frontFocus.primaryAttached > 0) frontFocus.primary else FocusRequester.Default } + exit = { dir -> if (dir == back) frontFocus.rail[railSelection] ?: FocusRequester.Default else FocusRequester.Default } + } + .focusGroup() + val content: @Composable (Modifier) -> Unit = { m -> Pane(s, selected, a, page, m.then(paneFocus)) { selected = it } } if (wide) Row(modifier = Modifier.fillMaxSize()) { rail(); content(Modifier.weight(1f).fillMaxHeight()) } else Column(modifier = Modifier.fillMaxSize()) { rail(); content(Modifier.weight(1f).fillMaxWidth()) } } @@ -406,6 +447,7 @@ private fun NavItem( val colors = MaterialTheme.colorScheme val src = remember { MutableInteractionSource() } val focused by src.collectIsFocusedAsState() + val railRequester = if (register != null && key != "x") LocalFrontFocus.current?.railFor(key) else null val hovered by src.collectIsHoveredAsState() val pressed by src.collectIsPressedAsState() val fg by animateColorAsState(if (current) colors.onPrimary else if (muted) colors.onSurfaceVariant else colors.onBackground, Motion.tw(280), label = "navFg") @@ -418,6 +460,7 @@ private fun NavItem( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth() .then(if (register != null && key != "x") Modifier.onGloballyPositioned { register(key, it) } else Modifier) + .then(if (railRequester != null) Modifier.focusRequester(railRequester) else Modifier) .then(if (small && i >= 0 && register != null) Modifier.staggerIn(i) else Modifier) .graphicsLayer { scaleX = scale; scaleY = scale } .clip(Shape10) @@ -521,7 +564,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi Rise(3) { Actions { // Enabled without a runtime: the session's loading screen installs it first. - PrimaryButton("Play", enabled = !s.busy, onClick = a.onPlay) + PrimaryButton("Play", enabled = !s.busy, main = true, onClick = a.onPlay) SecondaryButton("Steam Desktop UI", enabled = !s.busy, onClick = a.onPlayDesktopUi) Cog(a.onSteamSettings) } @@ -547,7 +590,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi Row { Column(modifier = Modifier.weight(1f)) { Actions { - PrimaryButton("Launch", enabled = s.ready && !s.busy) { a.onSteamGame(g) } + PrimaryButton("Launch", enabled = s.ready && !s.busy, main = true) { a.onSteamGame(g) } Cog(a.onSteamSettings) Chip(if (s.ready) "● ready" else "runtime missing", ok = s.ready) } @@ -567,7 +610,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi Rise(3) { Actions { // Enabled without a runtime or the desktop: the session's loading screen installs them first. - PrimaryButton(if (s.desktopInstalled) "Open desktop" else "Install & open desktop", enabled = !s.busy, onClick = a.onDesktop) + PrimaryButton(if (s.desktopInstalled) "Open desktop" else "Install & open desktop", enabled = !s.busy, main = true, onClick = a.onDesktop) Cog(a.onDesktopSettings) } } @@ -593,7 +636,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi Rise(3) { Actions { Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp)) - PrimaryButton("Open ${e.name}", enabled = s.ready && !s.busy) { a.onEmulator(e) } + PrimaryButton("Open ${e.name}", enabled = s.ready && !s.busy, main = true) { a.onEmulator(e) } SecondaryButton("ROMs folder", onClick = a.onRoms) if (pkg != null) SecondaryButton( if (pkg.kind == "appimage") "Remove" else "Forget", @@ -670,7 +713,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi Spacer(Modifier.height(14.dp)) Actions { Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp)) - PrimaryButton("Launch in ${e.name}", enabled = s.ready && !s.busy) { a.onRom(g) } + PrimaryButton("Launch in ${e.name}", enabled = s.ready && !s.busy, main = true) { a.onRom(g) } Chip(g.hostPath.extension.uppercase().ifEmpty { "folder" }, ok = false) } } @@ -803,9 +846,15 @@ private fun Chip(t: String, ok: Boolean) { private fun rememberHot(src: MutableInteractionSource): Boolean = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value @Composable -private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () -> Unit) { +private fun PrimaryButton(text: String, enabled: Boolean = true, main: Boolean = false, onClick: () -> Unit) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current + // The page's main button is where the pane is entered from the rail. + val frontFocus = if (main) LocalFrontFocus.current else null + if (frontFocus != null) DisposableEffect(Unit) { + frontFocus.primaryAttached++ + onDispose { frontFocus.primaryAttached-- } + } val src = remember { MutableInteractionSource() } val hot = rememberHot(src) && enabled val pressed by src.collectIsPressedAsState() @@ -814,6 +863,7 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () -> Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier + .then(if (frontFocus != null) Modifier.focusRequester(frontFocus.primary) else Modifier) .graphicsLayer { scaleX = scale; scaleY = scale; shadowElevation = if (enabled) lift.dp.toPx() else 0f; shape = Shape12; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal } .clip(Shape12) .background(if (enabled) Brush.linearGradient(listOf(colors.primary, pal.primary2)) else Brush.linearGradient(listOf(colors.surfaceVariant, colors.surfaceVariant))) From 181b320ee1d6415bd5c7494d1aa312babdc864d5 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 09:03:34 -0400 Subject: [PATCH 14/20] DuckStation (PS1) set up like ARMSX2 - From the rail: -batch -bigpicture -fullscreen (the same flags as PCSX2's, src/duckstation-qt/qthost.cpp) - straight into the game, gone when it is quit. - bannerlator-pad-defaults: a new player starts on DuckStation's first-time setup with the BIOS folder in the ROMs folder (psx/bios, created, or an existing one), psx as the game list, Vulkan, the controller on Player 1 and the guide button on the pause menu (not the analog toggle). An existing install gets the guide and game-list changes, and once, its own empty BIOS folder moved to the ROMs folder and Automatic made Vulkan; later choices are kept. Users bring their own BIOS and games. --- .../droiddeck/launcher/frontend/Library.kt | 2 + .../usr/local/bin/bannerlator-pad-defaults | 116 +++++++++++++++++- 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt b/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt index 0337e9d940..f437de9a36 100644 --- a/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt +++ b/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt @@ -191,6 +191,8 @@ object Library { // Straight into the game in its controller-driven full-screen UI (first-time setup there // too), and gone when the game is quit from its pause menu (guide button): -batch. "armsx2" -> listOf("-batch", "-bigpicture", "-fullscreen", "--", guestPath) + // DuckStation shares PCSX2's flags (src/duckstation-qt/qthost.cpp): the same launch and exit. + "duckstation" -> listOf("-batch", "-bigpicture", "-fullscreen", "--", guestPath) "dolphin" -> listOf("-e", guestPath) "cemu" -> listOf("-g", guestPath) else -> listOf(guestPath) diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults b/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults index 45459a0e26..e9ca2b5d58 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults @@ -180,9 +180,121 @@ SmallMotor = SDL-0/SmallMotor """ +def ini_get(path, section, key): + try: + with open(path, encoding="utf-8", errors="replace") as f: + lines = f.read().splitlines() + except OSError: + return None + span = ini_section(lines, section) + if not span: + return None + for l in lines[span[0]:span[1]]: + if "=" in l and l.split("=", 1)[0].strip() == key: + return l.split("=", 1)[1].strip() + return None + + +def ini_set(path, section, key, value): + """Sets one key (the first of that name) in [section], adding either as needed.""" + with open(path, encoding="utf-8", errors="replace") as f: + lines = f.read().splitlines() + span = ini_section(lines, section) + if span is None: + lines += ["", f"[{section}]", f"{key} = {value}"] + else: + for i in range(span[0], span[1]): + if "=" in lines[i] and lines[i].split("=", 1)[0].strip() == key: + lines[i] = f"{key} = {value}" + break + else: + end = span[1] + while end > span[0] and not lines[end - 1].strip(): + end -= 1 + lines.insert(end, f"{key} = {value}") + with open(path + ".tmp", "w", encoding="utf-8") as f: + f.write("\n".join(lines) + "\n") + os.replace(path + ".tmp", path) + + +def drop_line(path, line): + with open(path, encoding="utf-8", errors="replace") as f: + lines = f.read().splitlines() + kept = [l for l in lines if l.replace(" ", "") != line.replace(" ", "")] + if len(kept) != len(lines): + with open(path + ".tmp", "w", encoding="utf-8") as f: + f.write("\n".join(kept) + "\n") + os.replace(path + ".tmp", path) + + +def system_folder(names, default): + for name in names: + for cand in (name, name.upper()): + d = os.path.join(ROMS, cand) + if os.path.isdir(d): + return d + return os.path.join(ROMS, default) + + +def bios_folder(base): + for name in ("bios", "BIOS", "firmware"): + d = os.path.join(base, name) + if os.path.isdir(d): + return d + d = os.path.join(base, "bios") + if os.path.isdir(ROMS): + try: + os.makedirs(d, exist_ok=True) # where the user is told to put their BIOS + except OSError: + pass + return d + + +# DuckStation (PS1) - set up like ARMSX2: users bring their own BIOS and games, in the ROMs folder. +# Front-end runs use -batch -bigpicture -fullscreen, so the guide button is the pause menu +# (Hotkeys OpenPauseMenu, src/core/hotkeys.cpp), not the analog toggle. Keys from +# src/core/settings.cpp: [BIOS] SearchDirectory, [GPU] Renderer ("Vulkan"), [Main] +# SetupWizardIncomplete (src/duckstation-qt/qthost.cpp). +DUCKSTATION_PAD1_GUIDE_FREE = "\n".join(l for l in DUCKSTATION_PAD1.splitlines() if not l.startswith("Analog ")) + "\n" + + def duckstation(): - for d in (os.path.join(CONFIG, "duckstation"), os.path.join(HOME, ".local/share/duckstation")): - patch_ini_section(os.path.join(d, "settings.ini"), "Pad1", DUCKSTATION_PAD1, "DuckStation") + ps1 = system_folder(("psx", "ps1"), "psx") + d = os.path.join(CONFIG, "duckstation") + ini = os.path.join(d, "settings.ini") + legacy = os.path.join(HOME, ".local/share/duckstation/settings.ini") + if not os.path.isfile(ini) and os.path.isfile(legacy): + ini = legacy + if not os.path.isfile(ini): + # A new player: DuckStation's own first-time setup still runs, looking in the ROMs folder. + bios = bios_folder(ps1) + seed(ini, "[Main]\nSetupWizardIncomplete = true\n\n" + f"[BIOS]\nSearchDirectory = {bios}\n\n" + f"[GameList]\nRecursivePaths = {ps1}\n\n" + "[GPU]\nRenderer = Vulkan\n\n" + "[Hotkeys]\nOpenPauseMenu = Keyboard/Escape\nOpenPauseMenu = SDL-0/Guide\n\n" + "[Pad1]\n" + DUCKSTATION_PAD1_GUIDE_FREE, "DuckStation", "first-time setup, BIOS from " + bios) + return + patch_ini_section(ini, "Pad1", DUCKSTATION_PAD1_GUIDE_FREE, "DuckStation") + drop_line(ini, "Analog = SDL-0/Guide") + patch_ini_section(ini, "Hotkeys", "OpenPauseMenu = SDL-0/Guide\n", "DuckStation", needle="SDL-0/Guide", + done="the guide button opens the pause menu") + patch_ini_section(ini, "GameList", f"RecursivePaths = {ps1}\n", "DuckStation", needle=ROMS, + done="games listed from the ROMs folder") + # Once, for a DuckStation set up before this: its own empty BIOS folder moves to the ROMs folder, + # and Automatic becomes Vulkan. A later choice in DuckStation's settings is kept. + marker = os.path.join(os.path.dirname(ini), ".droiddeck-setup") + if os.path.exists(marker): + return + current = ini_get(ini, "BIOS", "SearchDirectory") or "bios" + own = current if os.path.isabs(current) else os.path.join(os.path.dirname(ini), current) + if not (os.path.isdir(own) and os.listdir(own)): + ini_set(ini, "BIOS", "SearchDirectory", bios_folder(ps1)) + print(f"bannerlator-pad-defaults: DuckStation: BIOS from {bios_folder(ps1)}") + if (ini_get(ini, "GPU", "Renderer") or "Automatic") == "Automatic": + ini_set(ini, "GPU", "Renderer", "Vulkan") + print("bannerlator-pad-defaults: DuckStation: renderer Vulkan") + open(marker, "w").close() # PCSX2: FaceSouth/... names (pcsx2/Input/SDLInputSource.cpp), keys from SIO/Pad/PadDualshock2.cpp. From c5b58a938a442dcc25c71d26fdbef2a7d6014b4f Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 09:12:31 -0400 Subject: [PATCH 15/20] Front end: outline the rail item on open, remember the pane control across Left/Right --- .../droiddeck/launcher/ui/FrontEndScreen.kt | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 0fbba69a88..25853b1076 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -84,6 +84,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.snapshotFlow +import kotlinx.coroutines.flow.first import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -105,6 +107,7 @@ import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.layout.positionInRoot import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.platform.LocalWindowInfo import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -240,13 +243,16 @@ private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier /** * Controller focus on the front end: each rail item's requester and the page's main button (Play, - * Open desktop, Open , Launch...). The pane enters on the main button and leaves, to the - * left, for the selected rail item - whatever tile or button it leaves from. + * Open desktop, Open , Launch...). The pane leaves, to the left, for the selected rail + * item - whatever tile or button it leaves from - and remembers that control, so coming back in + * lands on it again; a page not yet visited enters on its main button. */ private class FrontFocus { val rail = HashMap() val primary = FocusRequester() + val pane = FocusRequester() var primaryAttached by mutableStateOf(0) + var railFocused by mutableStateOf(false) fun railFor(key: String): FocusRequester = rail.getOrPut(key) { FocusRequester() } } @@ -301,16 +307,29 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com modifier = if (wide) Modifier.width(236.dp).fillMaxHeight() else Modifier.fillMaxWidth().height(maxHeight * 0.42f), ) } - // The app opens with the selected rail item focused, so a controller sees where it is. + // The app opens with the selected rail item focused, so a controller sees where it is. A + // request before the window has focus is dropped, so wait for it and retry until it sticks. + val window = LocalWindowInfo.current LaunchedEffect(Unit) { - kotlinx.coroutines.delay(150) - runCatching { frontFocus.railFor(railSelection).requestFocus() } + snapshotFlow { window.isWindowFocused }.first { it } + repeat(20) { + if (frontFocus.railFocused) return@LaunchedEffect + runCatching { frontFocus.railFor(railSelection).requestFocus() } + kotlinx.coroutines.delay(100) + } } val back = if (wide) FocusDirection.Left else FocusDirection.Up val paneFocus = Modifier + .focusRequester(frontFocus.pane) .focusProperties { - enter = { if (frontFocus.primaryAttached > 0) frontFocus.primary else FocusRequester.Default } - exit = { dir -> if (dir == back) frontFocus.rail[railSelection] ?: FocusRequester.Default else FocusRequester.Default } + enter = { + if (frontFocus.pane.restoreFocusedChild()) FocusRequester.Cancel + else if (frontFocus.primaryAttached > 0) frontFocus.primary else FocusRequester.Default + } + exit = { dir -> + frontFocus.pane.saveFocusedChild() + if (dir == back) frontFocus.rail[railSelection] ?: FocusRequester.Default else FocusRequester.Default + } } .focusGroup() val content: @Composable (Modifier) -> Unit = { m -> Pane(s, selected, a, page, m.then(paneFocus)) { selected = it } } @@ -447,7 +466,9 @@ private fun NavItem( val colors = MaterialTheme.colorScheme val src = remember { MutableInteractionSource() } val focused by src.collectIsFocusedAsState() - val railRequester = if (register != null && key != "x") LocalFrontFocus.current?.railFor(key) else null + val frontFocus = if (register != null && key != "x") LocalFrontFocus.current else null + val railRequester = frontFocus?.railFor(key) + if (frontFocus != null) LaunchedEffect(focused) { if (focused) frontFocus.railFocused = true } val hovered by src.collectIsHoveredAsState() val pressed by src.collectIsPressedAsState() val fg by animateColorAsState(if (current) colors.onPrimary else if (muted) colors.onSurfaceVariant else colors.onBackground, Motion.tw(280), label = "navFg") From 3d051f018ebdd0b068d600a0404e3a4879a60a7d Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 09:19:10 -0400 Subject: [PATCH 16/20] Front end: leave touch mode on open so the rail item can take focus --- .../java/com/droiddeck/launcher/ui/FrontEndScreen.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 25853b1076..f562e19bd4 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -108,6 +108,8 @@ import androidx.compose.ui.layout.positionInRoot import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalWindowInfo +import androidx.compose.ui.platform.LocalInputModeManager +import androidx.compose.ui.input.InputMode import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -307,13 +309,17 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com modifier = if (wide) Modifier.width(236.dp).fillMaxHeight() else Modifier.fillMaxWidth().height(maxHeight * 0.42f), ) } - // The app opens with the selected rail item focused, so a controller sees where it is. A - // request before the window has focus is dropped, so wait for it and retry until it sticks. + // The app opens with the selected rail item focused, so a controller sees where it is. An + // app starts in touch mode, where clickables refuse focus, so leave it first (a touch goes + // straight back to it); a request before the window has focus is dropped, so wait for + // that and retry until it sticks. val window = LocalWindowInfo.current + val inputMode = LocalInputModeManager.current LaunchedEffect(Unit) { snapshotFlow { window.isWindowFocused }.first { it } repeat(20) { if (frontFocus.railFocused) return@LaunchedEffect + if (inputMode.inputMode != InputMode.Keyboard) inputMode.requestInputMode(InputMode.Keyboard) runCatching { frontFocus.railFor(railSelection).requestFocus() } kotlinx.coroutines.delay(100) } From 9584f946814ff94fca43bf32dac48fe9d168c42d Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 09:26:46 -0400 Subject: [PATCH 17/20] Front end: come back to the last focused tile or button, not the grid --- .../droiddeck/launcher/ui/FrontEndScreen.kt | 51 ++++++++++++++----- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index f562e19bd4..1263caa898 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.onFocusChanged import android.graphics.Bitmap import android.os.Build import android.provider.Settings @@ -252,10 +253,36 @@ private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier private class FrontFocus { val rail = HashMap() val primary = FocusRequester() - val pane = FocusRequester() var primaryAttached by mutableStateOf(0) var railFocused by mutableStateOf(false) fun railFor(key: String): FocusRequester = rail.getOrPut(key) { FocusRequester() } + // The pane's controls by id (a tile's key, a button's label), how many of each are on screen, + // and the last one focused. + val items = HashMap() + val attached = HashMap() + var last: String? = null + fun paneEntry(): FocusRequester { + val id = last + return when { + id == PRIMARY && primaryAttached > 0 -> primary + id != null && id != PRIMARY && (attached[id] ?: 0) > 0 -> items.getValue(id) + primaryAttached > 0 -> primary + else -> FocusRequester.Default + } + } + companion object { const val PRIMARY = "\u0000primary" } +} + +/** Lets the pane come back to this control: it is remembered when focused. */ +@Composable +private fun Modifier.paneItem(id: String): Modifier { + val ff = LocalFrontFocus.current ?: return this + val req = remember(id) { ff.items.getOrPut(id) { FocusRequester() } } + DisposableEffect(id) { + ff.attached[id] = (ff.attached[id] ?: 0) + 1 + onDispose { ff.attached[id] = (ff.attached[id] ?: 1) - 1 } + } + return this.focusRequester(req).onFocusChanged { if (it.isFocused) ff.last = id } } private val LocalFrontFocus = staticCompositionLocalOf { null } @@ -326,14 +353,9 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com } val back = if (wide) FocusDirection.Left else FocusDirection.Up val paneFocus = Modifier - .focusRequester(frontFocus.pane) .focusProperties { - enter = { - if (frontFocus.pane.restoreFocusedChild()) FocusRequester.Cancel - else if (frontFocus.primaryAttached > 0) frontFocus.primary else FocusRequester.Default - } + enter = { frontFocus.paneEntry() } exit = { dir -> - frontFocus.pane.saveFocusedChild() if (dir == back) frontFocus.rail[railSelection] ?: FocusRequester.Default else FocusRequester.Default } } @@ -882,6 +904,7 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, main: Boolean = frontFocus.primaryAttached++ onDispose { frontFocus.primaryAttached-- } } + val track = if (frontFocus == null) Modifier.paneItem("btn:$text") else Modifier val src = remember { MutableInteractionSource() } val hot = rememberHot(src) && enabled val pressed by src.collectIsPressedAsState() @@ -889,8 +912,8 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, main: Boolean = val lift by animateFloatAsState(if (hot) 14f else 6f, Motion.tw(300), label = "btnLift") Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), - modifier = Modifier - .then(if (frontFocus != null) Modifier.focusRequester(frontFocus.primary) else Modifier) + modifier = track + .then(if (frontFocus != null) Modifier.focusRequester(frontFocus.primary).onFocusChanged { if (it.isFocused) frontFocus.last = FrontFocus.PRIMARY } else Modifier) .graphicsLayer { scaleX = scale; scaleY = scale; shadowElevation = if (enabled) lift.dp.toPx() else 0f; shape = Shape12; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal } .clip(Shape12) .background(if (enabled) Brush.linearGradient(listOf(colors.primary, pal.primary2)) else Brush.linearGradient(listOf(colors.surfaceVariant, colors.surfaceVariant))) @@ -916,7 +939,7 @@ internal fun SecondaryButton(text: String, enabled: Boolean = true, onClick: () val edge by animateColorAsState(if (hot) pal.signal else pal.line2, Motion.tw(250), label = "secEdge") val fill by animateColorAsState(if (hot) pal.signal.copy(alpha = 0.14f) else Color.White.copy(alpha = 0.03f), Motion.tw(250), label = "secFill") Box( - modifier = Modifier.graphicsLayer { scaleX = scale; scaleY = scale }.clip(Shape12).background(fill).border(1.dp, edge, Shape12) + modifier = Modifier.paneItem("btn:$text").graphicsLayer { scaleX = scale; scaleY = scale }.clip(Shape12).background(fill).border(1.dp, edge, Shape12) .alpha(if (enabled) 1f else 0.5f) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick) .padding(horizontal = 16.dp, vertical = 11.dp), @@ -933,7 +956,7 @@ private fun Cog(onClick: () -> Unit) { val edge by animateColorAsState(if (hot) pal.signal else pal.line2, Motion.tw(250), label = "cogEdge") Box( contentAlignment = Alignment.Center, - modifier = Modifier.size(42.dp).clip(Shape12).background(Color.White.copy(alpha = 0.03f)).border(1.dp, edge, Shape12) + modifier = Modifier.paneItem("cog").size(42.dp).clip(Shape12).background(Color.White.copy(alpha = 0.03f)).border(1.dp, edge, Shape12) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, onClick = onClick), ) { Icon(Icons.Filled.Settings, "Settings", tint = if (hot) pal.signal else colors.onBackground, modifier = Modifier.size(18.dp).rotate(rot)) } } @@ -974,7 +997,7 @@ private fun ArtGrid(tiles: List, wide: Boolean = false) { for (t in row) key(t.key) { val src = remember { MutableInteractionSource() } val hot = rememberHot(src) - Box(modifier = Modifier.width(tileWidth).zIndex(if (hot) 1f else 0f)) { GameTile(t, wide, square, src, hot) } + Box(modifier = Modifier.width(tileWidth).zIndex(if (hot) 1f else 0f)) { GameTile(t, wide, square, src, hot, Modifier.paneItem("tile:" + t.key)) } } } } @@ -983,7 +1006,7 @@ private fun ArtGrid(tiles: List, wide: Boolean = false) { } @Composable -private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableInteractionSource, hot: Boolean) { +private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableInteractionSource, hot: Boolean, track: Modifier) { val colors = MaterialTheme.colorScheme val pressed by src.collectIsPressedAsState() val scale by animateFloatAsState(if (pressed) 0.97f else if (hot) 1.04f else 1f, Motion.sp(0.55f, Spring.StiffnessMedium), label = "tileScale") @@ -992,7 +1015,7 @@ private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableIntera val pal = LocalPalette.current val ring by animateColorAsState(if (hot) pal.signal else Color.Transparent, Motion.tw(220), label = "tileRing") Column( - modifier = Modifier + modifier = track .graphicsLayer { scaleX = scale; scaleY = scale; translationY = lift.dp.toPx(); shadowElevation = elev.dp.toPx(); shape = Shape12; clip = false; ambientShadowColor = if (hot) pal.signal else Color.Black; spotShadowColor = if (hot) pal.signal else Color.Black; transformOrigin = androidx.compose.ui.graphics.TransformOrigin(0.5f, 0.9f) } .clip(Shape12) .background(colors.surface) From 3345f1c32b7c1b0ab80345315b9a04cedf5288e3 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 09:40:50 -0400 Subject: [PATCH 18/20] Show build source and worktree state --- app/build.gradle | 11 +++++++++-- .../com/droiddeck/launcher/ui/FrontEndScreen.kt | 15 ++++++++++----- tools/build_local.sh | 9 +++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bf8efebbe9..7fa1adc1bc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,9 +11,9 @@ def gitValue = { List arguments -> workingDir rootProject.projectDir ignoreExitValue = true } - output.result.get().exitValue == 0 ? output.standardOutput.asText.get().trim() : '' + output.result.get().exitValue == 0 ? output.standardOutput.asText.get().trim() : null } catch (Exception ignored) { - '' + null } } @@ -40,6 +40,13 @@ if (buildLabel == null || buildLabel.trim().isEmpty()) { buildLabel = "${branch} at ${commit}" } } +def buildOrigin = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'true' ? 'remote' : 'local' +def treeState = providers.environmentVariable('DROIDDECK_BUILD_TREE_STATE').getOrNull() +if (!(treeState in ['clean', 'dirty'])) { + def status = gitValue(['status', '--porcelain']) + treeState = status == null ? 'unknown' : (status.isEmpty() ? 'clean' : 'dirty') +} +buildLabel = "${buildOrigin} ${treeState} · ${buildLabel}" def escapedBuildLabel = buildLabel.replace('\\', '\\\\').replace('"', '\\"') android { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 38a65ac75c..5a9c592d81 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -490,12 +490,15 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi val pal = LocalPalette.current val interaction = remember { MutableInteractionSource() } val hot = rememberHot(interaction) - val divider = label.lastIndexOf(" at ") - val branch = if (divider >= 0) label.substring(0, divider).substringAfterLast('/') else label - val displayLabel = if (divider >= 0) "$branch${label.substring(divider)}" else branch + val contextDivider = label.indexOf(" · ") + val context = if (contextDivider >= 0) label.substring(0, contextDivider) else "" + val identity = if (contextDivider >= 0) label.substring(contextDivider + 3) else label + val identityDivider = identity.lastIndexOf(" at ") + val branch = (if (identityDivider >= 0) identity.substring(0, identityDivider) else identity).substringAfterLast('/') + val commit = if (identityDivider >= 0) identity.substring(identityDivider + 4) else "" Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(6.dp), + horizontalArrangement = Arrangement.spacedBy(5.dp), modifier = modifier .fillMaxWidth() .clip(RoundedCornerShape(6.dp)) @@ -510,7 +513,9 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi .heightIn(min = 40.dp) .padding(horizontal = 4.dp), ) { - Text(displayLabel, modifier = Modifier.weight(1f), fontSize = 9.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1, overflow = TextOverflow.Ellipsis) + if (context.isNotEmpty()) Text(context, fontSize = 8.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1) + Text(branch, modifier = Modifier.weight(1f), fontSize = 9.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1, overflow = TextOverflow.Ellipsis) + if (commit.isNotEmpty()) Text("@$commit", fontSize = 8.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1) Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.82f), modifier = Modifier.size(12.dp)) } } diff --git a/tools/build_local.sh b/tools/build_local.sh index 450fef9cc3..cd831a8dfe 100755 --- a/tools/build_local.sh +++ b/tools/build_local.sh @@ -2,6 +2,15 @@ set -euo pipefail repo_root=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +if tree_status=$(git -C "${repo_root}" status --porcelain 2>/dev/null); then + if [[ -n "${tree_status}" ]]; then + export DROIDDECK_BUILD_TREE_STATE=dirty + else + export DROIDDECK_BUILD_TREE_STATE=clean + fi +else + export DROIDDECK_BUILD_TREE_STATE=unknown +fi sdk_dir=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-"${HOME}/Library/Android/sdk"}} java_dir=${JAVA_HOME:-"/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home"} image_name=${DROIDDECK_BUILD_IMAGE:-droiddeck-local-cross:24.04-v2} From 90391973494f68f46d93d449b6f280a24e8b69c0 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 09:43:09 -0400 Subject: [PATCH 19/20] Put build source below watermark identity --- .../droiddeck/launcher/ui/FrontEndScreen.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 5a9c592d81..4a98d8ce22 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -496,9 +496,8 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi val identityDivider = identity.lastIndexOf(" at ") val branch = (if (identityDivider >= 0) identity.substring(0, identityDivider) else identity).substringAfterLast('/') val commit = if (identityDivider >= 0) identity.substring(identityDivider + 4) else "" - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(5.dp), + Column( + verticalArrangement = Arrangement.spacedBy(1.dp), modifier = modifier .fillMaxWidth() .clip(RoundedCornerShape(6.dp)) @@ -510,13 +509,19 @@ private fun BuildStatus(label: String, onCheckLatest: () -> Unit, modifier: Modi role = Role.Button, onClick = onCheckLatest, ) - .heightIn(min = 40.dp) - .padding(horizontal = 4.dp), + .heightIn(min = 44.dp) + .padding(horizontal = 4.dp, vertical = 3.dp), ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(5.dp), + modifier = Modifier.fillMaxWidth(), + ) { + Text(branch, modifier = Modifier.weight(1f), fontSize = 9.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1, overflow = TextOverflow.Ellipsis) + if (commit.isNotEmpty()) Text("@$commit", fontSize = 8.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1) + Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.82f), modifier = Modifier.size(12.dp)) + } if (context.isNotEmpty()) Text(context, fontSize = 8.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1) - Text(branch, modifier = Modifier.weight(1f), fontSize = 9.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = if (hot) colors.onSurfaceVariant else colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1, overflow = TextOverflow.Ellipsis) - if (commit.isNotEmpty()) Text("@$commit", fontSize = 8.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant.copy(alpha = 0.82f), maxLines = 1) - Icon(Icons.Filled.Refresh, contentDescription = null, tint = if (hot) pal.signal else colors.onSurfaceVariant.copy(alpha = 0.82f), modifier = Modifier.size(12.dp)) } } From 1d2df612e07e694c3af3e891b99526b0b343bde3 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 10:39:38 -0400 Subject: [PATCH 20/20] Snapshot CI tree state before generated assets --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8511575544..951d3a9b89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,6 +149,12 @@ jobs: BUILD_REF: ${{ github.ref_name }} BUILD_SHA: ${{ github.sha }} run: | + if [[ -n "$(git status --porcelain)" ]]; then + tree_state=dirty + else + tree_state=clean + fi + echo "DROIDDECK_BUILD_TREE_STATE=$tree_state" >> "$GITHUB_ENV" if [[ -n "$PR_NUMBER" ]]; then label="pr${PR_NUMBER} at ${PR_HEAD_SHA:0:7}" else