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

@@ -40,6 +40,33 @@ class SessionDisplayTest {
assertEquals(864, SessionDisplay.unfoldedGameHeight(1920, 1080))
}
private fun unfoldedWanted(
enabled: Boolean = true,
controller: Boolean = false,
keepWithController: Boolean = false,
foldable: Boolean = true,
steamDeckPad: Boolean = true,
pip: Boolean = false,
smallestWidthDp: Int = 700,
) = SessionDisplay.unfoldedControlsWanted(enabled, foldable, controller, keepWithController, steamDeckPad, pip,
2448, 1848, smallestWidthDp)
@Test fun unfoldedControlsHideForAControllerUnlessKeptWithOne() {
assertTrue(unfoldedWanted())
assertFalse(unfoldedWanted(controller = true))
assertTrue(unfoldedWanted(controller = true, keepWithController = true))
assertTrue(unfoldedWanted(keepWithController = true))
}
@Test fun keepingUnfoldedControlsWithAControllerLeavesTheOtherConditions() {
assertFalse(unfoldedWanted(enabled = false, controller = true, keepWithController = true))
assertFalse(unfoldedWanted(foldable = false, keepWithController = true))
assertFalse(unfoldedWanted(steamDeckPad = false, keepWithController = true))
assertFalse(unfoldedWanted(pip = true, keepWithController = true))
assertFalse(unfoldedWanted(smallestWidthDp = 599, keepWithController = true))
assertFalse(SessionDisplay.unfoldedControlsWanted(true, true, true, true, true, false, 0, 1848, 700))
}
@Test fun followScreenKeepsTheWindowShapeAndSkipsTinyWindows() {
assertEquals(2520 to 1080, SessionDisplay.resolveChoice(1080 to 2520, SessionDisplay.FOLLOW_SCREEN))
@@ -27,6 +27,7 @@ class SettingsResetTest {
@Test fun settingsGoBackToTheirDefaults() {
SessionPrefs.setTheme(app, "ocean")
SessionPrefs.setUnfoldedControlsWithController(app, true)
SessionPrefs.setNoXalia(app, false)
SessionPrefs.setFpsLimit(app, SessionService.MODE_STEAM, 30)
SessionPrefs.setHdr(app, SessionService.MODE_DESKTOP, true)
@@ -45,6 +46,7 @@ class SettingsResetTest {
assertTrue(SettingsReset.resetAll(app, gameProfiles = false))
assertEquals("graphite", SessionPrefs.theme(app))
assertFalse(SessionPrefs.unfoldedControlsWithController(app))
assertTrue(SessionPrefs.noXalia(app))
assertEquals(0, SessionPrefs.fpsLimit(app, SessionService.MODE_STEAM))
assertFalse(SessionPrefs.hdr(app, SessionService.MODE_DESKTOP))