RFR: JDK-8284445: macOS 12 prints a warning when a function key shortcut is assigned to a menu

Martin Fox duke at openjdk.org
Fri Oct 20 20:15:37 UTC 2023


On Mon, 2 Oct 2023 12:51:52 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!

I can't officially approve this PR but I can save other reviewers a grueling five minutes of research.

MODIFIER_FUNCTION is barely mentioned in the code (and I mean the entire codebase, tests and all). When processing a key event the Mac code maps NSFunctionKeyMask to MODIFIER_FUNCTION even though it's not really a modifier (it is unconditionally set on certain keys). The Java side just ignores it.

The only other usage is in these two files. The Mac code shouldn't be setting NSFunctionKeyMask on the key equivalent because the function key is not a modifier. There's no point in the Java code setting this flag since the Mac is the only client. So all usage of MODIFIER_FUNCTION should just go away.

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

PR Comment: https://git.openjdk.org/jfx/pull/1252#issuecomment-1773338433


More information about the openjfx-dev mailing list