mikehearn
10/08/2018, 10:01 PMfun Stage.stealFocus() {
requestFocus()
// We can steal focus using this macOS specific API. Unfortunately JavaFX won't do it for us.
val nsRunningApplication: Pointer = ObjectiveC.objc_lookUpClass("NSRunningApplication")
check(ObjectiveC.class_getName(nsRunningApplication) == "NSRunningApplication")
val currentAppSel: Pointer = ObjectiveC.sel_getUid("currentApplication")
val currentApp = Pointer(ObjectiveC.objc_msgSend(nsRunningApplication, currentAppSel))
val activateSel: Pointer = ObjectiveC.sel_getUid("activateWithOptions:")
ObjectiveC.objc_msgSend(currentApp, activateSel, 3)
}