Adding embedded events to awt ApplicationDelegate on MacOS
Kevin Rushforth
kevin.rushforth at oracle.com
Fri Mar 28 16:50:54 UTC 2025
Please direct your question to client-libs-dev at openjfx.org (you can
continue discussing the JavaFX part of your question on
openjfx-dev at openjdk.org)
-- Kevin
On 3/28/2025 9:27 AM, Paul Hayder wrote:
> Dear developers,
>
> I am currently fixing a bug on the JavaFX side which also affects the
> JDK (for details: https://bugs.openjdk.org/browse/JDK-8332947).
> I need to handle openURL events for a MacOS native Java application,
> while also using the native menu bar from within JavaFX.
> The main issue is that for opening an URL, I rely on AWT.
> Now I have the problem when firstly registering the openURL event
> handler with AWT, JavaFX will run embedded and won’t register the
> native menu.
> But if I firstly initialize JavaFX, AWT won’t receive the openURL
> events as it is running embedded and won’t register the appropriate
> app delegate.
>
> My proposal is to add a notification listener to the Notification
> Center that listens for events if running embedded (for the
> implementation: https://github.com/pabulaner/jdk/tree/embedded-event).
> Those events can be used to forward events not handled by other
> applications (like JavaFX and openURL) to AWT to handle them on their
> behalf.
> This would allow JavaFX to call the AWT openURL method without adding
> a direct dependency to it and would allow AWT to receive events, even
> if it runs embedded and only if the application desires it.
>
> Please let me know what Your feedback is on that proposal and the
> concrete implementation.
>
> Best Regards
> Paul Hayder
>
> Github: https://github.com/pabulaner
More information about the jdk-dev
mailing list