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.windowFrameItem
import ir.amirab.util.ifThen
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
// a window frame which totally rendered with compose
@ -318,12 +320,14 @@ fun CustomWindow(
val isLight = myColors.isLight
val background = myColors.background
LaunchedEffect(background) {
withContext(Dispatchers.Main) {
//I set window background fix window edge flickering on window resize
window.background = background.takeOrElse {
if (isLight) Color.White
else Color.Black
}.toWindowColorType()
}
}
UiScaledContent {
CompositionLocalProvider(
LocalWindowController provides windowController,