Fix screen effects profile switching

This commit is contained in:
EnzoDLofi committed 2026-11-13 23:23:18 -04:00
1 parent 9bd407c4c5
commit cfb52ded61
2 files changed
+76 -17

No files matched your search

@@ -1388,19 +1388,46 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
onHudExport = { exportHudDiagnostics() },
onUpscaler = { m ->
SessionPrefs.setUpscaler(this@SessionActivity, m); upscaler = m
WaylandCompositor.nativeSetUpscaler(m)
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(effects, m)?.name)
SessionPrefs.setUpscaler(this@SessionActivity, m)
val activeProfileId =
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
val activeEffects =
SessionPrefs.screenEffects(this@SessionActivity, activeProfileId)
val activeUpscaler =
SessionPrefs.screenEffectsUpscaler(this@SessionActivity, activeProfileId)
if ((effectsEditorTarget ?: screenEffectsTarget) == SCREEN_EFFECTS_TARGET_AUTO) {
effects = activeEffects
upscaler = activeUpscaler
}
WaylandCompositor.nativeSetUpscaler(activeUpscaler)
WaylandCompositor.nativeSetLookName(
ScreenEffectLooks.match(activeEffects, activeUpscaler)?.name
)
activeEffects.push(activeUpscaler)
},
onPresetUpscaler = { m ->
val target = effectsEditorTarget ?: screenEffectsTarget
val profileId = screenEffectsProfileIdForTarget(target)
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
if (target == screenEffectsTarget) {
upscaler = m
if (screenEffectsTargetAppliesToLiveOutput(target)) {
WaylandCompositor.nativeSetUpscaler(m)
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(effects, m)?.name)
val activeProfileId = if (target == SCREEN_EFFECTS_TARGET_AUTO) {
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
} else null
if (activeProfileId != null && activeProfileId != effectsEditorProfileId) {
Log.w(TAG, "Screen effects profile changed while editing; discarding stale upscaler edit")
observedScreenEffectsProfileId = activeProfileId
val activeEffects = SessionPrefs.screenEffects(this@SessionActivity, activeProfileId)
effects = activeEffects
activeEffects.push(upscaler)
} else {
val profileId = screenEffectsProfileIdForTarget(target)
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
if (target == screenEffectsTarget) {
upscaler = m
if (screenEffectsTargetAppliesToLiveOutput(target)) {
WaylandCompositor.nativeSetUpscaler(m)
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(effects, m)?.name)
}
}
}
},