On Wed, 2 Apr 2025 14:15:28 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. > > JavaFX Pull Request: https://github.com/openjdk/jfx/pull/1755 > Co-Author: @FlorianKirmaier I discussed this with @honkar-jdk, who did the AWT side of the fix for [JDK-8318854](https://bugs.openjdk.org/browse/JDK-8318854) -- PR #16569 (I did the FX side of that fix) -- which ensured that only the first toolkit , AWT or JavaFX in this case, installs its `NSApplicationDelegate`. We can both review it, and @prrace will need to review / approve as well. We ought to be able to use the simple test program in your repo to reproduce the failure, although I will need to build it myself and package it up manually using jpackage (not running the setup or test script which needs to publish to use a local maven repo and then install in the system using "sudo ..."). Before I do that, I have a couple high-level questions: 1. Without the fixes, does this bug only happen in the "after" case, where JavaFX is initialized first (i.e., when AWT is running embedded)? I presume it currently works in the "before" case, where AWT is initialized first (and JavaFX is embedded)? 2. Presuming that the failing case is when JavaFX owns the NSApplication, I don't understand how this fix helps. In the case where AWT is running embedded, the `[ApplicationDelegate init]` receiver never gets called. At least not without setting the (undocumented, and certainly not recommended when running with JavaFX) `AWT_OVERRIDE_NSDELEGATE` env variable. So: how is this working for you? One thing that might help us understand it better, is for you to apply the following debug patch on top of this PR's patch, run the "AWT after" case (with both AWT and FX fixes applied), and post the output. [debug.patch](https://github.com/user-attachments/files/19914799/debug.patch) ------------- PR Review: https://git.openjdk.org/jdk/pull/24379#pullrequestreview-2794998328