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

Conflicting validation with implicitly set key equivalent modifier flags. #22

Closed
jnorth opened this issue Sep 13, 2013 · 3 comments
Closed

Comments

@jnorth
Copy link

jnorth commented Sep 13, 2013

With the recent addition of SRKeyCodeWithFlagsEqualToKeyEquivalentWithFlags, I've noticed that menu item validation is giving false-negatives with certain flags.

I have a menu item with a key equivalent of e, with no modifier flags 0. When I try to record a shortcut of ⌘e, the validator says it is taken by the same menu item.

How to reproduce:

  1. Create a menu item with a key equivalent of e, no modifiers.

  2. Create a SRRecorderControl that allows no modifier flags.

    [recorder setAllowedModifierFlags:SRCocoaModifierFlagsMask requiredModifierFlags:0 allowsEmptyModifierFlags:YES];

  3. In the recorder delegate method -shortcutRecorder:canRecordShortcut: use a SRValidator to check if taken: [validator isKeyCode:keyCode andFlagsTaken:flags error:&error];.

  4. Try recording ⌘e.

Here is an example of the errors that the validator returns:

2013-09-13 15:03:26.753 The key combination "E" can't be used because it's already used by the menu item "File➝Demo Item".
2013-09-13 15:03:27.888 The key combination "Command-E" can't be used because it's already used by the menu item "File➝Demo Item".

And here is an example project:

http://sublink.ca/clients/shortcutrecorder/ShortcutRecorderDemo.zip

Kentzo added a commit that referenced this issue Sep 13, 2013
…h different modifier flags considered equal.
@Kentzo
Copy link
Owner

Kentzo commented Sep 13, 2013

@jnorth Thanks for reporting.
Please try now.

@Kentzo
Copy link
Owner

Kentzo commented Sep 15, 2013

@jnorth Note that cmd-e will be rejected, but for another reason: it's used for one of Edit menu items.

@jnorth
Copy link
Author

jnorth commented Sep 16, 2013

Thanks @Kentzo. This change fixes the issue for me.

@Kentzo Kentzo closed this as completed Sep 17, 2013
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

No branches or pull requests

2 participants