-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Description
Hello, I'm trying to consume events within a JavaFX program.
It works well, but I discovered that closing the program doesn't run the shutdown hook.
Here is my code(called during startup by the UI thread):
private static void setupJNativeHook()
{
try
{
GlobalScreen.setEventDispatcher(new VoidDispatchService());
GlobalScreen.registerNativeHook();
}
catch(NativeHookException exception)
{
throw new IllegalStateException("Failed to enable JNativeHook", exception);
}
Runtime.getRuntime().addShutdownHook(new Thread(() ->
{
try
{
GlobalScreen.unregisterNativeHook();
}
catch(NativeHookException exception)
{
throw new IllegalStateException("Failed to unregister JNativeHook", exception);
}
}));
}Metadata
Metadata
Assignees
Labels
No labels