Merge remote-tracking branch 'origin/main' into feat/fullscreen-toggle

This commit is contained in:
The412Banner committed 2026-09-24 08:35:43 -04:00
commit 691dbe80d9
7 files changed
+206 -21

No files matched your search

@@ -171,6 +171,7 @@ class MainActivity : ComponentActivity() {
private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO)
private var suspendPolicy by mutableStateOf(SessionPrefs.SUSPEND_MANUAL)
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
private var backActionsInverted by mutableStateOf(false)
private var renderer by mutableStateOf("vulkan")
private var gameStorage by mutableStateOf("")
private var storageOptions by mutableStateOf<List<Pair<String, String>>>(emptyList())
@@ -212,6 +213,7 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
theme = SessionPrefs.theme(this)
backActionsInverted = SessionPrefs.backActionsInverted(this)
setContent {
DroidDeckTheme(theme) {
val sm = settingsMode
@@ -242,6 +244,7 @@ class MainActivity : ComponentActivity() {
packageStage = pkgStage,
packagePercent = pkgPercent,
sessionRunning = SessionState.running,
backActionsInverted = backActionsInverted,
),
FrontEndActions(
onPlay = { startSession(Intent(this, SessionActivity::class.java)) },
@@ -302,6 +305,10 @@ class MainActivity : ComponentActivity() {
onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id },
onHomeApp = { manageHomeApp() },
onAndroidApp = { app -> launchAndroidApp(app) },
onBackActionsInverted = { inverted ->
SessionPrefs.setBackActionsInverted(this, inverted)
backActionsInverted = inverted
},
),
page = page,
)
@@ -517,6 +524,7 @@ class MainActivity : ComponentActivity() {
touchMode = touchMode,
suspendPolicy = suspendPolicy,
oscMode = if (mode == SessionService.MODE_STEAM) oscMode else null,
backActionsInverted = backActionsInverted,
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
clientDirectAudio = clientDirectAudio,
forceFullscreen = if (mode == SessionService.MODE_STEAM) forceFullscreen else null,
@@ -549,6 +557,10 @@ class MainActivity : ComponentActivity() {
onTouch = { t -> SessionPrefs.setTouchMode(this, t); touchMode = t },
onSuspendPolicy = { policy -> SessionPrefs.setSuspendPolicy(this, mode, policy); suspendPolicy = policy },
onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o },
onBackActionsInverted = { inverted ->
SessionPrefs.setBackActionsInverted(this, inverted)
backActionsInverted = inverted
},
onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on },
onClientDirectAudio = { on -> SessionPrefs.setClientDirectAudio(this, on); clientDirectAudio = on },
onForceFullscreen = { on -> SessionPrefs.setForceFullscreen(this, on); forceFullscreen = on },
@@ -645,6 +657,7 @@ class MainActivity : ComponentActivity() {
touchMode = SessionPrefs.touchMode(this)
suspendPolicy = SessionPrefs.suspendPolicy(this, mode)
oscMode = SessionPrefs.oscMode(this)
backActionsInverted = SessionPrefs.backActionsInverted(this)
directAudio = SessionPrefs.directAudio(this)
clientDirectAudio = SessionPrefs.clientDirectAudio(this)
forceFullscreen = SessionPrefs.forceFullscreen(this)
@@ -8,7 +8,9 @@ import android.os.Bundle
import android.os.Environment
import android.os.Handler
import android.os.Looper
import android.os.SystemClock
import android.util.Log
import android.view.InputDevice
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.Display
@@ -58,6 +60,7 @@ import com.droiddeck.launcher.ui.DroidDeckTheme
import com.droiddeck.launcher.wayland.CompositorHost
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.File
import kotlin.math.abs
/**
* The session's screen: our Wayland compositor presenting onto this activity's Surface, and the
@@ -72,6 +75,7 @@ import java.io.File
*/
class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private lateinit var surfaceView: SurfaceView
private lateinit var sessionOverlay: ComposeView
private lateinit var loading: LoadingState
private lateinit var hud: PerfHud
private var padBridge: PadBridge? = null
@@ -85,9 +89,15 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private var cursorVisible by mutableStateOf(false)
private val cursorHide = Runnable { cursorVisible = false }
private val uiHandler = Handler(Looper.getMainLooper())
private var pendingBackAction: Runnable? = null
private var drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN
private var drawerDirectionDownTime = 0L
private var drawerDirectionLastRepeat = 0L
private var drawerDirectionDeviceId = -1
// Compose reads these; the activity writes them.
private var drawerOpen by mutableStateOf(false)
private var backActionsInverted by mutableStateOf(false)
/** 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)
@@ -176,14 +186,24 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// One Compose layer for every menu and overlay. Touches nothing in it consumes fall
// through to the pad and the game underneath.
root.addView(ComposeView(this).apply {
sessionOverlay = ComposeView(this).apply {
isFocusable = true
isFocusableInTouchMode = true
setContent {
DroidDeckTheme {
CursorOverlay(cursorPos, cursorVisible, resources.displayMetrics.density)
if (hud.text.isNotEmpty()) HudText(hud.text)
if (loading.visible) LoadingOverlay(loading.step, loading.percent, loading.elapsed, loading.hint, loading.ended)
// Opening the drawer takes the controller away from the game: release its pad.
androidx.compose.runtime.LaunchedEffect(drawerOpen) { if (drawerOpen) padBridge?.releaseAll() }
androidx.compose.runtime.LaunchedEffect(drawerOpen) {
if (drawerOpen) {
padBridge?.releaseAll()
androidx.compose.runtime.withFrameNanos { }
sessionOverlay.requestFocus()
} else {
releaseDrawerDirection()
}
}
// The PC keyboard takes it too, for moving over the keys; the drawer opens over it.
androidx.compose.runtime.LaunchedEffect(pcKeyboardOpen) { if (pcKeyboardOpen) padBridge?.releaseAll() }
if (pcKeyboardOpen) com.droiddeck.launcher.ui.PcKeyboard(
@@ -217,10 +237,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; keyboard?.toggle() },
onHardwareKeyboard = { drawerOpen = false; pcKeyboardOpen = !pcKeyboardOpen },
onSteamMenu = if (SessionState.mode == SessionService.MODE_STEAM) ({ sendSteamGuide() }) else null,
onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({
drawerOpen = false
padBridge?.triggerQam()
}) else null,
onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({ triggerSteamQam() }) else null,
backActionsInverted = backActionsInverted,
onBackActionsInverted = { inverted ->
SessionPrefs.setBackActionsInverted(this@SessionActivity, inverted)
backActionsInverted = inverted
},
onOsc = { v -> SessionPrefs.setOscMode(this@SessionActivity, v); readPrefs(); updateOnScreenControls() },
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
onShape = { v -> SessionPrefs.setShapeMode(this@SessionActivity, v); readPrefs() },
@@ -244,7 +266,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
}
}
})
}
root.addView(sessionOverlay)
setContentView(root)
handleHomeGuideIntent(intent)
@@ -257,13 +280,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
}
SessionState.endListener = endListener
// Back opens the drawer (and closes it again). Leaving the session running in the
// background and ending it are both actions in there, so neither can happen by accident
// from a button a game might also be reading.
// A single Back opens the session menu; two quick presses/swipes send the Steam QAM chord.
// The single action waits out the double-press window so the two actions stay distinct.
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// The PC keyboard closes first (B on a controller), then Back is the drawer again.
if (pcKeyboardOpen && !drawerOpen) pcKeyboardOpen = false else drawerOpen = !drawerOpen
when {
drawerOpen -> drawerOpen = false
pcKeyboardOpen -> pcKeyboardOpen = false
else -> routeBackAction()
}
}
})
watchSession()
@@ -282,6 +308,32 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}, 90)
}
private fun triggerSteamQam() {
drawerOpen = false
padBridge?.triggerQam()
}
private fun routeBackAction() {
pendingBackAction?.let { pending ->
uiHandler.removeCallbacks(pending)
pendingBackAction = null
performBackAction(double = true)
return
}
val pending = Runnable {
pendingBackAction = null
performBackAction(double = false)
}
pendingBackAction = pending
uiHandler.postDelayed(pending, BACK_DOUBLE_PRESS_TIMEOUT_MS)
}
private fun performBackAction(double: Boolean) {
val isSteam = SessionState.mode == SessionService.MODE_STEAM
val opensQam = isSteam && (double xor backActionsInverted)
if (opensQam) triggerSteamQam() else drawerOpen = !drawerOpen
}
private fun handleHomeGuideIntent(incoming: Intent?) {
if (incoming?.action != SessionService.ACTION_HOME_GUIDE) return
incoming.action = null
@@ -299,6 +351,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
fexPreset = SessionPrefs.fexPreset(this)
oscMode = SessionPrefs.oscMode(this)
shapeMode = SessionPrefs.shapeMode(this)
backActionsInverted = SessionPrefs.backActionsInverted(this)
}
// ── Compositor ──────────────────────────────────────────────────────────────────────────
@@ -626,10 +679,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE ->
return super.dispatchKeyEvent(event)
}
// With the drawer open the controller drives the drawer, not the game: Android's own
// handling moves focus with the d-pad and stick, and its fallbacks make A select and B Back
// (which closes the drawer) - the same as on the app's main screen.
if ((drawerOpen || pcKeyboardOpen) && event.device != null && PadBridge.isFromController(event.device)) 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.
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
releaseDrawerDirection()
return true
}
return super.dispatchKeyEvent(event)
}
if (pcKeyboardOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchKeyEvent(event)
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
// A hardware keyboard, forwarded to the compositor's wl_keyboard. Back is left to the
// activity, which opens the drawer.
@@ -671,12 +731,60 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean {
if ((drawerOpen || pcKeyboardOpen) && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchGenericMotionEvent(event)
if (drawerOpen && event.device != null && PadBridge.isFromController(event.device)) {
dispatchDrawerDirection(event)
return true
}
if (drawerDirectionKey != KeyEvent.KEYCODE_UNKNOWN) releaseDrawerDirection()
if (pcKeyboardOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchGenericMotionEvent(event)
if (padBridge?.onMotionEvent(event) == true) return true
if (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) && !drawerOpen && onMouse(event)) return true
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)
val x = if (abs(hatX) > 0.4f) hatX else event.getAxisValue(MotionEvent.AXIS_X)
val y = if (abs(hatY) > 0.4f) hatY else event.getAxisValue(MotionEvent.AXIS_Y)
val keyCode = when {
maxOf(abs(x), abs(y)) < 0.45f -> KeyEvent.KEYCODE_UNKNOWN
abs(x) > abs(y) && x < 0f -> KeyEvent.KEYCODE_DPAD_LEFT
abs(x) > abs(y) -> KeyEvent.KEYCODE_DPAD_RIGHT
y < 0f -> KeyEvent.KEYCODE_DPAD_UP
else -> KeyEvent.KEYCODE_DPAD_DOWN
}
val now = SystemClock.uptimeMillis()
if (keyCode != drawerDirectionKey) {
releaseDrawerDirection()
if (keyCode == KeyEvent.KEYCODE_UNKNOWN) return
drawerDirectionKey = keyCode
drawerDirectionDeviceId = event.deviceId
drawerDirectionDownTime = now
drawerDirectionLastRepeat = now
dispatchDrawerKey(KeyEvent.ACTION_DOWN, 0, now)
} else if (keyCode != KeyEvent.KEYCODE_UNKNOWN && now - drawerDirectionLastRepeat >= 240L) {
drawerDirectionLastRepeat = now
dispatchDrawerKey(KeyEvent.ACTION_DOWN, 1, now)
}
}
private fun releaseDrawerDirection() {
if (drawerDirectionKey == KeyEvent.KEYCODE_UNKNOWN) return
dispatchDrawerKey(KeyEvent.ACTION_UP, 0, SystemClock.uptimeMillis())
drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN
drawerDirectionDeviceId = -1
}
private fun dispatchDrawerKey(action: Int, repeatCount: Int, eventTime: Long) {
val event = KeyEvent(
drawerDirectionDownTime, eventTime, action, drawerDirectionKey,
repeatCount, 0, drawerDirectionDeviceId, 0, 0, InputDevice.SOURCE_DPAD,
)
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
@@ -984,6 +1092,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// Deliberately does NOT end the session: this activity can be destroyed while the user is
// in another app, and the whole point of the service is that Steam survives that.
watching = false
pendingBackAction?.let(uiHandler::removeCallbacks)
pendingBackAction = null
closeSecondScreen(reset = true)
if (::hud.isInitialized) hud.stop()
padBridge?.stop()
@@ -1000,6 +1110,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
companion object {
private const val TAG = "SessionActivity"
private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L
/** Compositor scale modes (Container.FULLSCREEN_* values): 1 = fit with bars, centred. */
private const val SCALE_FIT = 1
private const val ALIGN_CENTER = 0
@@ -13,6 +13,12 @@ object SessionPrefs {
const val OSC_STEAM_QAM = "steam-qam"
const val OSC_NEVER = "never"
const val BACK_MENU_THEN_QAM = "1: menu 2: QAM"
const val BACK_QAM_THEN_MENU = "1: QAM 2: menu"
fun backActionsOrder(inverted: Boolean): String =
if (inverted) BACK_QAM_THEN_MENU else BACK_MENU_THEN_QAM
private fun prefs(context: Context) = context.getSharedPreferences("session", Context.MODE_PRIVATE)
fun hudEnabled(context: Context): Boolean = prefs(context).getBoolean("hud", true)
@@ -21,6 +27,13 @@ object SessionPrefs {
prefs(context).edit().putBoolean("hud", on).apply()
}
/** When enabled, a single Back opens Steam QAM and a double Back opens the session menu. */
fun backActionsInverted(context: Context): Boolean = prefs(context).getBoolean("backActionsInverted", false)
fun setBackActionsInverted(context: Context, inverted: Boolean) {
prefs(context).edit().putBoolean("backActionsInverted", inverted).apply()
}
const val TOUCH_AUTO = "auto"
const val TOUCH_PAD = "touchpad"
const val TOUCH_DIRECT = "direct"
@@ -108,6 +108,7 @@ import coil.compose.AsyncImage
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import kotlin.math.roundToInt
@@ -141,6 +142,7 @@ class FrontEndState(
val packageStage: String? = null,
val packagePercent: Int = -1,
val sessionRunning: Boolean = false,
val backActionsInverted: Boolean = false,
)
class FrontEndActions(
@@ -169,6 +171,7 @@ class FrontEndActions(
val onTheme: (String) -> Unit = {},
val onHomeApp: () -> Unit = {},
val onAndroidApp: (com.droiddeck.launcher.HomeApp.LaunchableApp) -> Unit = {},
val onBackActionsInverted: (Boolean) -> Unit = {},
)
@@ -711,6 +714,13 @@ private fun SetupPanel(s: FrontEndState, a: FrontEndActions) {
ActionRow("ROMs folder", s.romsDir ?: "Choose where emulator games are stored", "Choose", a.onRoms)
}
SettingsGroup("Session") {
ChoiceRow(
host, "back-actions", "Back", SessionPrefs.backActionsOrder(s.backActionsInverted),
listOf(
false to SessionPrefs.BACK_MENU_THEN_QAM,
true to SessionPrefs.BACK_QAM_THEN_MENU,
), s.backActionsInverted, onPick = a.onBackActionsInverted,
)
SettingsRow("Frame generation", "Select the frame generation mode") {
Box {
ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" }
@@ -46,6 +46,8 @@ class ModeSettings(
val suspendPolicy: String,
/** Steam only. */
val oscMode: String?,
/** Steam only: whether single and double Back actions are swapped. */
val backActionsInverted: Boolean = false,
val directAudio: Boolean?,
val clientDirectAudio: Boolean = false,
val mic: Boolean?,
@@ -93,6 +95,7 @@ class ModeSettingsActions(
val onTouch: (String) -> Unit,
val onSuspendPolicy: (String) -> Unit,
val onOsc: (String) -> Unit,
val onBackActionsInverted: (Boolean) -> Unit = {},
val onDirectAudio: (Boolean) -> Unit,
val onClientDirectAudio: (Boolean) -> Unit = {},
val onMic: (Boolean) -> Unit,
@@ -229,6 +232,13 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
), s.oscMode,
note = "Auto shows all controls without a controller. Steam + QAM shows only those buttons.", onPick = a.onOsc,
)
if (steam) ChoiceRow(
host, "back-actions", "Back", SessionPrefs.backActionsOrder(s.backActionsInverted),
listOf(
false to SessionPrefs.BACK_MENU_THEN_QAM,
true to SessionPrefs.BACK_QAM_THEN_MENU,
), s.backActionsInverted, onPick = a.onBackActionsInverted,
)
}
SettingsGroup("Session") {
ChoiceRow(
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.ui
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.focusGroup
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.ui.focus.focusRequester
import androidx.compose.material3.ButtonDefaults
@@ -30,7 +31,9 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.res.painterResource
@@ -64,6 +67,8 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.InputMode
import androidx.compose.ui.platform.LocalInputModeManager
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
@@ -151,6 +156,7 @@ class DrawerActions(
val frameGenMultiplier: Int,
val lsfgReady: Boolean,
val oscMode: String,
val backActionsInverted: Boolean,
val touchMode: String,
val touchAuto: String,
val shapeMode: String,
@@ -169,6 +175,7 @@ class DrawerActions(
val onSteamMenu: (() -> Unit)?,
val onQam: (() -> Unit)?,
val onOsc: (String) -> Unit,
val onBackActionsInverted: (Boolean) -> Unit,
val onTouch: (String) -> Unit,
val onShape: (String) -> Unit,
val onFexPreset: (String) -> Unit,
@@ -181,6 +188,7 @@ class DrawerActions(
val onClose: () -> Unit,
)
@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun SessionDrawer(open: Boolean, a: DrawerActions) {
val colors = MaterialTheme.colorScheme
@@ -191,11 +199,19 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
// A controller starts on the drawer's first control, highlighted, as on the app's main screen:
// the STEAM button, or in a desktop session the first setting.
val firstFocus = remember { androidx.compose.ui.focus.FocusRequester() }
var firstControlFocused by remember { mutableStateOf(false) }
val inputModeManager = LocalInputModeManager.current
val steamButtons = a.onSteamMenu != null && a.onQam != null
LaunchedEffect(open) {
if (open) {
androidx.compose.runtime.withFrameNanos { }
runCatching { firstFocus.requestFocus() }
inputModeManager.requestInputMode(InputMode.Keyboard)
var attempts = 0
while (attempts < 24 && !firstControlFocused) {
firstFocus.requestFocus()
androidx.compose.runtime.withFrameNanos { }
attempts++
}
if (!firstControlFocused) android.util.Log.w("SessionDrawer", "first controller focus request did not focus a control")
}
}
if (open || veil > 0.01f) Box(
@@ -214,6 +230,7 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
.width(340.dp)
.background(pal.background.copy(alpha = 0.97f))
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
.focusGroup()
.verticalScroll(rememberScrollState())
.padding(horizontal = 14.dp, vertical = 16.dp),
) {
@@ -244,7 +261,8 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
OutlinedButton(
onClick = { host.open = null; a.onSteamMenu.invoke() },
interactionSource = steamSrc,
modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus),
modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus)
.onFocusChanged { firstControlFocused = it.isFocused },
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),
@@ -299,7 +317,8 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
SettingsGroup("Now") {
ToggleRow(
host, "hud", "Performance HUD", null, a.hudOn,
chipModifier = if (steamButtons) Modifier else Modifier.focusRequester(firstFocus), onChange = a.onHud,
chipModifier = if (steamButtons) Modifier else Modifier.focusRequester(firstFocus)
.onFocusChanged { firstControlFocused = it.isFocused }, onChange = a.onHud,
)
if (a.fillScreen != null) ToggleRow(
host, "fill", "Stretch games to fill the screen",
@@ -334,6 +353,13 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
a.oscMode,
onPick = a.onOsc,
)
if (a.steam) ChoiceRow(
host, "back-actions", "Back", SessionPrefs.backActionsOrder(a.backActionsInverted),
listOf(
false to SessionPrefs.BACK_MENU_THEN_QAM,
true to SessionPrefs.BACK_QAM_THEN_MENU,
), a.backActionsInverted, onPick = a.onBackActionsInverted,
)
SettingsRow("Keyboard", null) {
Row(verticalAlignment = Alignment.CenterVertically) {
SecondaryButton("Hardware") { host.open = null; a.onHardwareKeyboard() }