aleksey.tomin
11/20/2020, 10:28 AMapp.finishLaunching()
while (active.value) {
app.nextEventMatchingMask(NSEventMaskAny, null, NSDefaultRunLoopMode, true)?.let {
app.sendEvent(it)
}
runBlocking {
delay(100.milliseconds)
}
}
But now hotkeys (cmd+Q) and window’s button close
don’t work.
How can I process this events manually in macOS code?
In main cycle? In Controller? In some NSWindow
field?jasper
11/21/2020, 10:26 PMapp.run()
runloop?aleksey.tomin
11/22/2020, 3:37 AMjasper
11/22/2020, 5:09 AMjasper
11/22/2020, 5:11 AMaleksey.tomin
11/22/2020, 12:00 PMnewSingleThreadContext
and run app.run()
in the main thread.jasper
11/22/2020, 2:57 PMjasper
11/22/2020, 2:58 PMDispatchQueue.main.async {
// your code here
}
^-- that's Swift, Kotlin equivalent must be similar (or same).jasper
11/22/2020, 2:58 PMjasper
11/22/2020, 2:59 PMaleksey.tomin
11/23/2020, 2:39 AMAtomicReference
. Later - delay
and perform next request.
If I use app.run
- request works 10 seconds. If don’t use - 0.3..0.5 seconds.jasper
11/23/2020, 3:26 AMaleksey.tomin
11/25/2020, 3:44 PM