mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
feat(session): split the display resolution into landscape and portrait (#2990)
## Summary Splits the session resolution setting into two: **Landscape resolution** and **Portrait resolution**. Each has the same options as the old Resolution row, plus a Follow option so one orientation can mirror the other. ## Why A single resolution has to serve both orientations. Presets and Match screen flip automatically in portrait, but a custom size is used exactly as typed, so a landscape size in a portrait session is wrong. Users who play in both orientations couldn't pick a good size for each. ## Behavior - The Display tab shows **Landscape resolution** and, underneath it, **Portrait resolution**. Both offer the full existing list: presets, Match screen, Follow screen, scaled follow options and Custom. - Each row has an extra option at the top. **Follow portrait** (on the landscape row) and **Follow landscape** (on the portrait row) use the other orientation's choice, so someone can set one resolution and let the other mirror it. The label shows the size it resolves to. - A session picks the landscape or portrait choice from its orientation. This uses the same orientation check as the output size, so the unfolded-controls layout still counts as landscape. - Custom WxH sizes are flipped to match the target orientation when followed, e.g. portrait following 1280x720 uses 720x1280. - If both rows would follow each other, the other row is set to the concrete size it currently resolves to, so there is never a loop and nothing visibly changes. - The glasses output keeps using the landscape resolution. - Applies to the Steam and Desktop Display tabs, which share the same row. ## Compatibility - The existing saved choice (`displayResolution.<mode>`) is now the landscape resolution, so existing users keep their setting. - The portrait choice is stored as `displayResolution.portrait.<mode>` and defaults to Follow landscape, so portrait sessions behave as before until it is changed. The settings reset covers it through the existing `displayResolution.` prefix. - One visible difference: a typed landscape custom size, used as typed in portrait before, now flips to portrait while portrait follows landscape. ## Known limitation "Follow screen" is still decided once when the session starts, not on every rotation. Re-evaluating it on rotation could make the window orientation flip repeatedly when no orientation is pinned. ## Changes - `SessionDisplay`: `LINK_LANDSCAPE` / `LINK_PORTRAIT`, `isLink`, `orientCustom`, `effectiveChoice` - `SessionPrefs`: `resolutionStored` (raw value per orientation), `resolutionChoice(..., portrait)`, `setResolutionChoice(..., portrait)` with the loop guard, `resolutionChosen(..., portrait)` - `SessionActivity`: `portraitOutput()` drives the output size, follow-screen choice and follow scale; the Match-screen default for programs that draw at the panel size checks the matching orientation - `ResolutionRow`, `ModeSettingsDialog`, `FrontEndActivity`: two rows, the Follow option, state and actions - `DeviceReport`: logs landscape and portrait separately - Strings: `display_resolution_landscape`, `display_resolution_portrait`, `display_follow_landscape`, `display_follow_portrait` in all 33 locales; the unused `display_resolution` is removed - Tests: `PortraitResolutionTest` ## Testing - Unit tests added for the preference logic, follow resolution, loop guard and reset.
This commit is contained in:
42 files changed
+388
-103
No files matched your search
@@ -586,6 +586,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
private var settingsMode by mutableStateOf<String?>(null)
|
||||
private var resolution by mutableStateOf(com.droiddeck.launcher.session.SessionDisplay.DEFAULT_RESOLUTION)
|
||||
private var resolutionPortrait by mutableStateOf(com.droiddeck.launcher.session.SessionDisplay.LINK_LANDSCAPE)
|
||||
private var fexPreset by mutableStateOf("")
|
||||
private var forceSsbs by mutableStateOf(false)
|
||||
private var steamClientArch by mutableStateOf("arm64")
|
||||
@@ -2593,7 +2594,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (settingsMode != mode) return
|
||||
com.droiddeck.launcher.ui.ModeSheetRows(
|
||||
ModeSettings(
|
||||
mode = mode, resolution = resolution,
|
||||
mode = mode, resolution = resolution, resolutionPortrait = resolutionPortrait,
|
||||
panelSize = com.droiddeck.launcher.session.SessionDisplay.panelSize(this),
|
||||
hdr = hdrOn, hdrReason = hdrReason, hdrDisplay = hdrDisplay, zeroCopy = zeroCopyOn,
|
||||
upscaler = upscaler, upscaleSharpness = upscaleSharpness,
|
||||
@@ -2648,7 +2649,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onIntegration = ::configureIntegration,
|
||||
onIntegrationAppInfo = ::openAppInfo,
|
||||
onIntegrationLocation = ::openWifiDiscoverySettings,
|
||||
onResolution = { value -> SessionPrefs.setResolutionChoice(this, mode, value); resolution = value },
|
||||
onResolution = { value -> SessionPrefs.setResolutionChoice(this, mode, value); loadResolutions(mode) },
|
||||
onResolutionPortrait = { value -> SessionPrefs.setResolutionChoice(this, mode, value, portrait = true); loadResolutions(mode) },
|
||||
onHdr = { on -> com.droiddeck.launcher.session.SessionHdr.set(this, mode, on); hdrOn = on },
|
||||
onZeroCopy = { on ->
|
||||
SessionPrefs.setZeroCopy(this, mode, on); zeroCopyOn = on
|
||||
@@ -2981,11 +2983,17 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}, "shader-precache").start()
|
||||
}
|
||||
|
||||
private fun loadResolutions(mode: String) {
|
||||
val panel = com.droiddeck.launcher.session.SessionDisplay.panelSize(this)
|
||||
resolution = SessionPrefs.resolutionStored(this, mode, panel, false)
|
||||
resolutionPortrait = SessionPrefs.resolutionStored(this, mode, panel, true)
|
||||
}
|
||||
|
||||
private fun loadModeSettings(mode: String) {
|
||||
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
||||
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
||||
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
|
||||
resolution = SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this))
|
||||
loadResolutions(mode)
|
||||
fexPreset = SessionPrefs.fexPreset(this)
|
||||
forceSsbs = SessionPrefs.forceSsbs(this)
|
||||
fastSync = SessionPrefs.fastSync(this)
|
||||
|
||||
Reference in new issue
Block a user