feat: the unfolded controls can stay while a controller is connected (#996)

On foldables the unfolded-screen controls panel hides whenever a
controller is connected (#829). Phones held in a telescopic controller
still want its trackpads and back grips, so a new setting under
"Controls on the unfolded screen" keeps the panel with a controller.
It is off by default and appears in the launcher settings and the
in-session menu while unfolded controls are on.

The visibility decision moves into SessionDisplay.unfoldedControlsWanted
with unit tests.

Closes #861

Co-authored-by: ovurrsl <ovurrsl@users.noreply.github.com>
Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-22 10:43:41 -04:00
1 parent 8ed98b570b
commit 3c622a9323
11 files changed
+96 -6

No files matched your search

@@ -44,6 +44,19 @@ object SessionDisplay {
fun unfoldedGameHeight(width: Int, height: Int): Int =
minOf(width * 9 / 16, (height * UNFOLDED_MAX_GAME_SHARE).toInt()) and 1.inv()
fun unfoldedControlsWanted(
enabled: Boolean,
foldable: Boolean,
controllerConnected: Boolean,
keepWithController: Boolean,
steamDeckPad: Boolean,
pip: Boolean,
width: Int,
height: Int,
smallestWidthDp: Int,
): Boolean = enabled && foldable && (keepWithController || !controllerConnected) && steamDeckPad &&
!pip && width > 0 && height > 0 && smallestWidthDp >= UNFOLDED_MIN_DP
fun panelSize(context: Context): Pair<Int, Int> {
val manager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
@@ -989,6 +989,13 @@ object SessionPrefs {
prefs(context).edit().putBoolean("unfoldedControls", enabled).apply()
}
fun unfoldedControlsWithController(context: Context): Boolean =
prefs(context).getBoolean("unfoldedControlsWithController", false)
fun setUnfoldedControlsWithController(context: Context, enabled: Boolean) {
prefs(context).edit().putBoolean("unfoldedControlsWithController", enabled).apply()
}
const val SURFACE_STICK = "stick"
const val SURFACE_TRACKPAD = "trackpad"
@@ -15,7 +15,8 @@ object SettingsReset {
"gameStoresEnabled", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature",
"storesInstallLanguage",
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "backActionsInverted", "touch", "osc", "shape", "steamController",
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "stretch16x9", "picturePosition",
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
"stretch16x9", "picturePosition",
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime",
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",