On Wed, 2 Apr 2025 14:06:58 GMT, Pabulaner IV <d...@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 I verified that, in connection with the AWT fix, this fix allows the AWT OpenURIHandler to receive events when JavaFX is the primary toolkit. I also verified that in the case where AWT is the primary toolkit, the code in question isn't ever called. So that mode works equally well with or without this fix. I left a comment with a requested change, both to the name of the custom embedded event, and a request that it be defined as a static constant (put it near the top of the file). modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m line 486: > 484: > 485: [[NSNotificationCenter defaultCenter] > 486: postNotificationName:@"EmbeddedEvent" I left a related comment in the AWT fix: `EmbeddedEvent` is too generic a name. I recommend two things: 1. Prefix it with `AWT`, so it would become `AWTEmbeddedEvent` 2. Create a static NSString constant for this string with a comment that this will allow JavaFX to send an event to AWT when AWT is embedded. Note in this comment that the name must match the name used by AWT. Put this string near the top of the file, perhaps after the `runLoopModes` constant. ------------- PR Review: https://git.openjdk.org/jfx/pull/1755#pullrequestreview-2819606151 PR Review Comment: https://git.openjdk.org/jfx/pull/1755#discussion_r2076259111