From d4ba2e7a36a06880553d2ad95c1d295f706a2c7f Mon Sep 17 00:00:00 2001 From: Tomáš Znamenáček Date: Mon, 5 Jan 2015 11:21:33 +0100 Subject: 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. --- Framework/MASShortcutView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Framework/MASShortcutView.m') 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; -- cgit v1.2.3