Accelerator in System MenuBar
Johan Vos
johan.vos at gluonhq.com
Tue Mar 19 13:21:52 UTC 2019
Related to https://github.com/javafxports/openjdk-jfx/issues/370:
The issue appears on Mac, with a system menubar. When the scene contains
e.g. a TextField (which has a CMD-V keymapping), and a menuitem has been
assigned a CMD-V accelerator, the latter should not be invoked when the
action is performed on the TextField.
When the menuitem is in a normal JavaFX MenuBar, this works fine as the
event handling marks the event as consumed when the TextField processes it,
hence it won't continue to the accelerators.
However, when the menuitem is in a system menubar, the native
performKeyEquivalent function first calls the the Java layer
(View.notifyKey) and then unconditionally passes the event so that the
system can process it.
My thinking is that this can be avoided by having the View.notifyKey
returning a boolean, which is true when the Java layer consumed the event,
in which case the native performKeyEquivalent should return YES.
Before I create a PR on this, I wonder if there are other ideas for doing
this?
- Johan
More information about the openjfx-dev
mailing list