in sample/src/main/kotlin/org/jetbrains/desktop/sample/macos/SkikoSampleMac.kt [552:584]
fun handleEvent(event: Event): EventHandlerResult {
// logEvents(event)
val result = when (event) {
is Event.WindowCloseRequest -> {
windows.find {
it.window.windowId() == event.windowId
}?.let { window ->
killWindow(window)
} ?: run {
Logger.warn { "Can't find window for $event" }
}
EventHandlerResult.Stop
}
is Event.WindowFullScreenToggle -> {
AppMenuManager.setMainMenu(buildMenu())
EventHandlerResult.Continue
}
else -> EventHandlerResult.Continue
}
return if (result == EventHandlerResult.Continue && event is WindowEvent) {
val window = windows.find {
it.window.windowId() == event.windowId
}
window?.let {
window.handleEvent(event)
} ?: EventHandlerResult.Continue
} else {
EventHandlerResult.Stop
}
}