in sample/src/main/kotlin/org/jetbrains/desktop/sample/linux/SkikoSampleLinux.kt [978:1008]
fun configure(event: Event.WindowConfigure) {
val shouldUseCustomTitlebar = when (event.decorationMode) {
WindowDecorationMode.Client -> !event.fullscreen
WindowDecorationMode.Server -> false
}
if (shouldUseCustomTitlebar) {
val titlebarLayout = TitlebarLayout(
layoutLeft = filterUnsupportedButtons(xdgDesktopSettings.titlebarLayout.layoutLeft, event.capabilities),
layoutRight = filterUnsupportedButtons(xdgDesktopSettings.titlebarLayout.layoutRight, event.capabilities),
)
val titlebarSize = LogicalSize(width = event.size.width, height = SkikoCustomTitlebarLinux.CUSTOM_TITLEBAR_HEIGHT)
val titlebar = customTitlebar ?: SkikoCustomTitlebarLinux(
origin = LogicalPoint.Zero,
size = titlebarSize,
titlebarLayout,
requestClose,
).also {
customTitlebar = it
}
titlebar.configure(event, titlebarLayout)
val customBorders = customBorders ?: CustomBorders().also { customBorders = it }
customBorders.configure(event)
contentArea.origin = LogicalPoint(x = 0f, y = titlebar.size.height)
contentArea.size =
LogicalSize(width = event.size.width, height = event.size.height - titlebar.size.height)
} else {
customTitlebar = null
contentArea.origin = LogicalPoint(x = 0f, y = 0f)
contentArea.size = event.size
}
}