On Wed, 18 Jun 2025 20:58:20 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 works without any errors.
> 
> Co-Author: @FlorianKirmaier

If You mean it why I didn't fix it there the answer is that when You have for 
example two screens and You switch from a Swing window that is in the first 
screen to a other unrelated window in another screen, the menu bar should stay 
in the first screen. If Swing would remove the menu items on focus loss, this 
menu would be gone as well.

If You mean it as a edge case and if my code would handle it correctly, it 
would, as it just removes all items not owned by JavaFX and so if there are no 
menus that fall in that category, it simply will do nothing.

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

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

Reply via email to