Skip to content

Commit

Permalink
Handle the shortcut key like the meta key
Browse files Browse the repository at this point in the history
KeyCombination.shortcut is a way to add platform-independent keyboard
shortcuts that will e.g. use "Ctrl" on Windows and "Cmd" on macOS
(see the Javadoc in javafx.scene.input.KeyCombination).

This commit just adds a check for getShortcut() and sets the
NSEventModifierFlagCommand just like is already done for getMeta().

Fixes 0x4a616e#24
  • Loading branch information
jkaving committed Nov 18, 2022
1 parent c39a355 commit b947c1c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ private static int toKeyEventModifierFlags(KeyCombination accelerator) {
if (accelerator.getAlt() == KeyCombination.ModifierValue.DOWN) {
modifiers |= NSEventModifierFlags.NSEventModifierFlagOption;
}
if (accelerator.getMeta() == KeyCombination.ModifierValue.DOWN) {
if (accelerator.getMeta() == KeyCombination.ModifierValue.DOWN ||
accelerator.getShortcut() == KeyCombination.ModifierValue.DOWN) {
modifiers |= NSEventModifierFlags.NSEventModifierFlagCommand;
}
if (accelerator.getControl() == KeyCombination.ModifierValue.DOWN) {
Expand Down

0 comments on commit b947c1c

Please sign in to comment.