RFR: 8354631: [macos] OpenURIHandler events not received by AWT when JavaFX is primary toolkit [v2]

Pabulaner IV duke at openjdk.org
Thu May 15 20:35:59 UTC 2025


On Wed, 7 May 2025 16:41:37 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
>
> Pabulaner IV has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8332947: [macos] java.awt.desktop.OpenURIHandler is not receiving events

Interesting feedback.

I was told that it did work on an older version, but I don't remember if I tested it or not. Apparently MacOS changed something in their event handling logic from one version to another so that only one event handler could be registered at a time.

If JavaFX would have its own Desktop class, then the NativeEvent handler would not need to forward those events anymore, as FX would handle it.

If JavaFX would handle some events that AWT doesn't, then I guess it would make sense to also allow AWT to send native events. Since I didn't found any such events yet, I didn't look into it.

I don't understand Your last point. If no event handler is registered, JavaFX still forwards them, but they won't do anything unless a handler is registered at some point. So what exactly do You mean?

So is there something You want me to do in the code?
Or did I answer Your questions?

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

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


More information about the openjfx-dev mailing list