fix crash when changing theme in linux (#348)

This commit is contained in:
AmirHossein Abdolmotallebi 2025-01-06 04:58:32 +03:30 committed by GitHub
parent ef869a2851
commit b8ce924ad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,8 @@ import ir.amirab.util.customwindow.HitSpots
import ir.amirab.util.customwindow.util.CustomWindowDecorationAccessing import ir.amirab.util.customwindow.util.CustomWindowDecorationAccessing
import ir.amirab.util.customwindow.windowFrameItem import ir.amirab.util.customwindow.windowFrameItem
import ir.amirab.util.ifThen import ir.amirab.util.ifThen
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
// a window frame which totally rendered with compose // a window frame which totally rendered with compose
@ -318,11 +320,13 @@ fun CustomWindow(
val isLight = myColors.isLight val isLight = myColors.isLight
val background = myColors.background val background = myColors.background
LaunchedEffect(background) { LaunchedEffect(background) {
//I set window background fix window edge flickering on window resize withContext(Dispatchers.Main) {
window.background = background.takeOrElse { //I set window background fix window edge flickering on window resize
if (isLight) Color.White window.background = background.takeOrElse {
else Color.Black if (isLight) Color.White
}.toWindowColorType() else Color.Black
}.toWindowColorType()
}
} }
UiScaledContent { UiScaledContent {
CompositionLocalProvider( CompositionLocalProvider(