• Welcome to the new Mac-Forums. See News and Community Announcements for more details.

Most Core Graphics key events not triggering in Java

Apr 26, 2020
Reaction score
See this issue on the jnativehook GitHub page for more information. That’s where I first posted my question.

Environment specs:
IDE = Eclipse 2019-12 IDE
JavaFX = version 13
OS = macOS Catalina 10.15.3
jnativehook = version 2.1.0
libuiohook = dependency of jnativehook

The jnativehook library uses the JNI to call compiled c++ (?) code that creates Core Graphics event taps when run on a mac. When the system input events occur, in Java I can specify event handlers to handle them.

Most mouse events register fine and are passed to the Java event handlers. However, most key events are completely ignored. I’ve gone all the way to the source c++ code (libuiohook) where the event tap is created and confirm that no events are being registered. However, when I run the libuiohook through a compiled c++ driver program, all events are registered.

At this point I’m pretty sure that the issue of lost events has to do with the isolation of the JVM from the rest of the system. Does anyone know how to pass Core Graphics/Quartz events through to a Java app?

I’ve already tried asking on the Apple Dev forums but my question needs to be approved before it can be posted and after about a week I’ve seen no updates as to that. I’ve also asked this same question on stackoverflow.