This seems a reasonable approach to me.

-- Kevin


On 3/19/2019 6:38 AM, Dean Wookey wrote:
Returning a boolean in View.notifyKey may also be useful for the windows
bug: https://bugs.openjdk.java.net/browse/JDK-8089986 where, regardless of
whether the accelerator is missing or not, there is a beeping sound.
Ideally there would be a beep only if the event isn't consumed.

Dean

On Tue, Mar 19, 2019 at 3:23 PM Johan Vos <[email protected]> wrote:

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


Reply via email to