Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyCode.SHORTCUT not working when adding keyboard accelerators #24

Open
jkaving opened this issue Nov 18, 2022 · 0 comments · May be fixed by #25
Open

KeyCode.SHORTCUT not working when adding keyboard accelerators #24

jkaving opened this issue Nov 18, 2022 · 0 comments · May be fixed by #25

Comments

@jkaving
Copy link

jkaving commented Nov 18, 2022

Using the KeyCode.SHORTCUT constant doesn't work for adding keyboard shortcuts with the Command key.
The same issue was reported in codecentric#42 .

The shortcut key is a virtual key that is used to represent different keys on different platforms (in order to create platform-independent keyboard shortcuts). Here's a part of the Javadoc for KeyCombination:

/**
 * ...
 * The {@code shortcut} modifier is used to represent the modifier key which is
 * used commonly in keyboard shortcuts on the host platform. This is for
 * example {@code control} on Windows and {@code meta} (command key) on Mac.
 * By using {@code shortcut} key modifier developers can create platform
 * independent shortcuts. So the "Shortcut+C" key combination is handled
 * internally as "Ctrl+C" on Windows and "Meta+C" on Mac.
 * ...
 */
jkaving added a commit to jkaving/NSMenuFX that referenced this issue Nov 18, 2022
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
@jkaving jkaving linked a pull request Nov 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant