From 3877d0696f1be6d3d00413f78cd0a5724ae8dd3f Mon Sep 17 00:00:00 2001 From: The412Banner Date: Sat, 19 Sep 2026 16:09:09 -0400 Subject: [PATCH] Keep the session's output size across a Surface recreation gamescope's display is sized once when the session starts and cannot change, but the size was recomputed on every surfaceCreated. A foldable recreates the Surface on the other panel, so a session started on the 21:9 outer screen and opened onto the square inner one told the compositor its 21:9 buffer was 16:9 and the picture came back squashed sideways. While a session runs its size is kept; the compositor letterboxes it onto whatever panel is current. Also the Compose build: BoxWithConstraints' maxWidth read outside its scope. --- .../main/java/com/steamdeck/launcher/SessionActivity.kt | 8 ++++++-- app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt index 50e0ea9f1e..ef5133d9ca 100644 --- a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt @@ -200,9 +200,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { val turnip = TurnipDriver(this) val driverId = if (CompositorHost.isStarted) null else turnip.install() - val size = outputSize() + // The output size belongs to the session, not to the Surface: gamescope's display is + // sized once when the session starts and cannot change. A foldable recreates the Surface + // on the other panel, and recomputing the size there told the compositor a 21:9 buffer + // was 16:9 — the picture came back squashed sideways. While a session runs, keep its size. + val size = if (SessionState.running) SessionState.outputSize else outputSize() SessionState.outputSize = size - SessionState.refreshHz = refreshHz() + if (!SessionState.running) SessionState.refreshHz = refreshHz() // Letterbox, never stretch or crop: the output can be a different shape from the panel, // and a game's picture must keep its proportions with bars, not lose its edges. WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER) diff --git a/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt b/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt index 38e7929dde..00dc0faa17 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt @@ -61,6 +61,7 @@ fun MainScreen( .background(MaterialTheme.colorScheme.background), contentAlignment = Alignment.TopCenter, ) { + val wide = maxWidth > 600.dp Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier @@ -76,7 +77,7 @@ fun MainScreen( Image( painter = painterResource(R.drawable.logo), contentDescription = null, - modifier = Modifier.size(if (maxWidth > 600.dp) 88.dp else 72.dp), + modifier = Modifier.size(if (wide) 88.dp else 72.dp), ) Spacer(Modifier.height(8.dp)) Text("SteamDeck", style = MaterialTheme.typography.headlineSmall, color = MaterialTheme.colorScheme.onBackground)