RFR: JDK-8284445: macOS 12 prints a warning when a function key shortcut is assigned to a menu [v3]
Martin Fox
duke at openjdk.org
Thu Nov 2 16:03:25 UTC 2023
On Tue, 31 Oct 2023 08:05:56 GMT, vlaaad <duke at openjdk.org> wrote:
>> This PR addresses [JDK-8284445](https://bugs.openjdk.org/browse/JDK-8284445).
>>
>> Context: the warning might be more important than it seems. Our JavaFX-based desktop app has [an issue](https://github.com/defold/defold/issues/7845) — when the user opens 2 instances of the app, one of the instances hangs after a while. While debugging the issue, I found that it's somehow related to the system menu bar — not refreshing it fixes the issue. Further investigations revealed that the app hangs only if we show menus that use F1-F24 shortcuts. This reminded me of the warnings we get about `NSEventModifierFlagFunction specified to -setKeyEquivalentModifierMask` for such shortcuts. I experimented with removing the modifier for these shortcuts, and it helped with our issue!
>
> vlaaad has updated the pull request incrementally with one additional commit since the last revision:
>
> Don't use NSFunctionKeyMask as modifier at all
The MODIFIER_FUNCTION constant is poorly named and in the wrong place since it has nothing to do with key events. There is no Function modifier in Java. The Mac glass code sets this flag on certain key events but Java just ignores it.
The only use for this flag is setting up the system menu bar. We don't have an existing test to verify that the system menu bar processes key events correctly (that would require a Robot and I don't see any Robot tests for this). I will enter a follow-up bug to fix that testing gap. For now I think it's enough that the warning is gone.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1252#issuecomment-1791016957
More information about the openjfx-dev
mailing list