On Sun, 31 Aug 2025 07:03:40 GMT, Pabulaner IV <d...@openjdk.org> wrote:

>> This pull request fixes the system menu bar on Mac when combining windows of 
>> Swing and JavaFX.
>> 
>> The first issue was to get the native menu bar working simultaneously on 
>> Swing and JavaFX, which was done by just returning always true inside the 
>> supportsSystemMenu method.
>> 
>> The second issue was to remove all system menu items installed by a swing 
>> window. This was fixed by checking the system menu bar every time an item is 
>> inserted or removed and removing all menu items that are not owned by 
>> JavaFX. This check is done on every insert and remove as JavaFX does not 
>> have a clear method inside the MenuBarDelegate class that could be called 
>> every time the window gets the focus.
>> 
>> I tested the fix with two Swing and two JavaFX windows that are run inside 
>> the same application and it worked without any errors, but on further 
>> testing I noticed some issues with the menu bar. I am currently writing the 
>> test and fixes for it.
>> 
>> Co-Author: @FlorianKirmaier
>
> Pabulaner IV has refreshed the contents of this pull request, and previous 
> commits have been removed. The incremental views will show differences 
> compared to the previous content of the PR. The pull request contains one new 
> commit since the last revision:
> 
>   8359108: Mac - When Swing starts First, native application menu doesn't 
> work for JavaFX

I have now added 3 test cases to show that the change works as expected:

- one test for a single window
- one test for multiple windows
- one test for enabling / disabling the system menu on a JFX window while the 
application is running

I used osascript for the tests to get back the native menus of the currently 
active application.

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

PR Comment: https://git.openjdk.org/jfx/pull/1835#issuecomment-3239839961

Reply via email to