On Wed, 6 May 2026 15:17:54 GMT, Martin Fox <[email protected]> wrote:
>> Pabulaner IV has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - 8359108: Mac - When Swing starts First, native application menu doesn't >> work for JavaFX >> - 8359108: Mac - When Swing starts First, native application menu doesn't >> work for JavaFX > > I think I understand what's going on now (it helps that I'm no longer on > vacation and no longer on jury duty). Again, this PR concerns what happens > when you have a top-level JavaFX window focused inside an AWT application. > > In the past the only application menu you would see would be provided by AWT. > The AWT application menu always has an About item and optionally has a > Settings item if the client has called `Desktop.setPreferencesHandler`. With > this PR when a JavaFX window is focused you'll see the JavaFX version of the > application menu, not the AWT one. That might be considered a regression > though it's hard to say since I think this whole setup is officially > unsupported (?) > > @crschnick The MenuBar.java test you provided illustrates something entirely > new. When a top-level JavaFX window is focused in an AWT application and you > call `Desktop.setPreferencesHandler` AWT will manipulate the JavaFX platform > menu and insert the Settings item into it. The result is a weird menu with > Settings in the wrong location and a mix of NSMenuItems created by Glass and > AWT. Again, technically a bug but maybe the resolution is just to tell > developers to not do that. > > The MenuBar.java test only reproduces the issue when run inside the jfx-test > harness. When run as a standalone program the issue doesn't reproduce > (Settings never appears in the application menu). This is true even after I > tweaked `main` to ensure it ran. In the future please provide a stand-alone > reproducer. @beldenfox Thanks for the explaination. Would it be possible for JavaFX to not touch anything for the menu bar when no system menu bar is set from the JavaFX side? That would make these problems go away in the smoothest fashion. The test harness shouldn't do anything differently than just launching the test program with the latest jfx changes, so I am not sure why that works differently. So it should behave identical to a standalone reproducer. I will try to figure that one out. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1904#issuecomment-4390709597
