mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Fix screen effects upscaler profile inheritance
This commit is contained in:
1 parent
aabd7b9e93
commit
dcb16dd2b0
2 files changed
+30
-3
No files matched your search
@@ -1424,9 +1424,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
|
||||
if (target == screenEffectsTarget) {
|
||||
upscaler = m
|
||||
if (screenEffectsTargetAppliesToLiveOutput(target)) {
|
||||
WaylandCompositor.nativeSetUpscaler(m)
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(effects, m)?.name)
|
||||
if (screenEffectsUpscalerTargetAppliesToLiveOutput(target)) {
|
||||
val liveProfileId =
|
||||
SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity)
|
||||
val liveUpscaler =
|
||||
SessionPrefs.screenEffectsUpscaler(this@SessionActivity, liveProfileId)
|
||||
val liveEffects =
|
||||
SessionPrefs.screenEffects(this@SessionActivity, liveProfileId)
|
||||
WaylandCompositor.nativeSetUpscaler(liveUpscaler)
|
||||
WaylandCompositor.nativeSetLookName(
|
||||
ScreenEffectLooks.match(liveEffects, liveUpscaler)?.name
|
||||
)
|
||||
liveEffects.push(liveUpscaler)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2146,6 +2155,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
|
||||
private fun screenEffectsUpscalerTargetAppliesToLiveOutput(target: String): Boolean {
|
||||
if (target == SCREEN_EFFECTS_TARGET_AUTO) return true
|
||||
val selectedProfileId = screenEffectsProfileIdForTarget(target)
|
||||
val activeProfileId = currentScreenEffectsProfileId()
|
||||
if (selectedProfileId == activeProfileId) return true
|
||||
return selectedProfileId == null &&
|
||||
(activeProfileId == null ||
|
||||
!SessionPrefs.hasScreenEffectsUpscalerOverride(this, activeProfileId))
|
||||
}
|
||||
|
||||
private fun screenEffectsTargetAppliesToLiveOutput(target: String): Boolean {
|
||||
if (target == SCREEN_EFFECTS_TARGET_AUTO) return true
|
||||
val selectedProfileId = screenEffectsProfileIdForTarget(target)
|
||||
|
||||
@@ -1500,6 +1500,14 @@ object SessionPrefs {
|
||||
sessionPrefs.edit().putString(SCREEN_EFFECTS_PROFILES_KEY, profiles.toString()).apply()
|
||||
}
|
||||
|
||||
fun hasScreenEffectsUpscalerOverride(context: Context, profileId: String?): Boolean {
|
||||
if (profileId.isNullOrBlank()) return false
|
||||
return runCatching {
|
||||
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
profiles.optJSONObject(profileId)?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
|
||||
fun screenEffectsUpscaler(context: Context, profileId: String?): Int {
|
||||
if (profileId.isNullOrBlank()) return upscaler(context)
|
||||
val stored = runCatching {
|
||||
|
||||
Reference in new issue
Block a user