RFR: 8332947: [macos] java.awt.desktop.OpenURIHandler is not receiving events

Kevin Rushforth kcr at openjdk.org
Mon Apr 14 21:23:44 UTC 2025


On Wed, 2 Apr 2025 14:06:58 GMT, Pabulaner IV <duke at openjdk.org> wrote:

> When trying to register an open URI handler when using JavaFX with a native menu, this task fails on Mac.
> Either the native menu is not shown or the URIs are not received.
> 
> This pull request fixes this issue if AWT is registered after JavaFX, so that AWT runs embedded inside JavaFX.
> It fixes this by introducing a native event to AWT, which can be used by JavaFX to forward events such as an openURL event.
> 
> The test for this pull request is non trivial, as the application needs to be installed on the Mac before it can be tested. Therefore the test is provided in a separate repository and it needs to be discussed if the test is necessary to have inside the JFX repo and if so, how it should be integrated.
> 
> JDK Pull Request: https://github.com/openjdk/jdk/pull/24379
> Co-Author: @FlorianKirmaier
> 
> Link to the test repo: https://github.com/pabulaner/openurifx

We'll need some sort of standalone test, even if it can't be automated, that we can use to test the fix. Something that isn't a full-blown app. The test program should be able to reproduce the problem without the fix and can then be used to verify the fix.

When testing, we will want to consider the following scenarios:

1. Pure JavaFX app (even though there isn't a `java.awt.desktop.OpenURIHandler` in this case, we need to make sure that it doesn't misbehave)
2. JavaFX + Swing app -- JavaFX Toolkit initialized first (I think this is the main case you want to handle)
3. JavaFX + Swing app -- AWT Toolkit initialized first (I presume this case already works, so the main thing is to ensure no regressions)

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1755#issuecomment-2803055709


More information about the openjfx-dev mailing list