Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.ui.draw.clip
import dev.nihildigit.windowstouch.ProvideTouchViewConfiguration
import java.awt.Container
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import org.jetbrains.skia.FontMgr
import org.jetbrains.skia.FontStyle
import org.jetbrains.skiko.SkiaLayer
Expand Down Expand Up @@ -600,7 +602,11 @@ private fun FrameWindowScope.MacTitleBarEffect() {
// 画布的原生层在窗口显示时才建好,之前调用什么也不做,所以先等窗口显示出来
LaunchedEffect(window) {
while (!window.isShowing) delay(16)
findSkiaLayer(window)?.disableTitleBar(TitleBarHeight.value)
// Skiko 在原生侧 dispatch_sync 到主队列;若在 EDT 上调用,而主线程恰好在
// LWCToolkit.invokeAndWait 的嵌套 run loop(javaRunLoopMode,不处理主队列)里等 EDT,
// 两边互等即死锁(#69)。放到后台线程调用,只阻塞该后台线程。
val layer = findSkiaLayer(window)
if (layer != null) withContext(Dispatchers.IO) { layer.disableTitleBar(TitleBarHeight.value) }
MacOs.patchTitleBarDoubleClick()
}
}
Expand Down