aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomáš Znamenáček2015-01-05 11:21:33 +0100
committerTomáš Znamenáček2015-01-07 16:26:49 +0100
commitd4ba2e7a36a06880553d2ad95c1d295f706a2c7f (patch)
tree02104361825b845f011e6f65ef27edb10c10856d
parent29cf3be3ad6998b3ab63ef82d9a53fb5a1b5950d (diff)
downloadMASShortcut-d4ba2e7a36a06880553d2ad95c1d295f706a2c7f.tar.bz2
Accept Backspace and Delete keys with modifiers as valid shortcuts.
When recording a new shortcut using the MASShortcutView control, the user may press Delete or Backspace to clear the current shortcut. In the previous versions the corresponding code branch didn’t test the modifier flags, making it impossible to record shortcuts such as Cmd-Alt-Delete. Now the control should behave as expected, only using “naked” Delete and Backspace keys to clear the shortcut.
-rw-r--r--Framework/MASShortcutView.m2
1 files changed, 1 insertions, 1 deletions
diff --git a/Framework/MASShortcutView.m b/Framework/MASShortcutView.m
index 716edba..cdb7855 100644
--- a/Framework/MASShortcutView.m
+++ b/Framework/MASShortcutView.m
@@ -379,7 +379,7 @@ void *kUserDataHint = &kUserDataHint;
eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *event) {
MASShortcut *shortcut = [MASShortcut shortcutWithEvent:event];
- if ((shortcut.keyCode == kVK_Delete) || (shortcut.keyCode == kVK_ForwardDelete)) {
+ if ((shortcut.modifierFlags == 0) && ((shortcut.keyCode == kVK_Delete) || (shortcut.keyCode == kVK_ForwardDelete))) {
// Delete shortcut
weakSelf.shortcutValue = nil;
weakSelf.recording = NO;