From 7438479aa735a56f22645c226d5f1db6ba8ef0a2 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 14 Mar 2013 21:25:47 +0100 Subject: [PATCH] Fix another bad property name. --- Classes/NJOutputController.m | 4 ++-- Classes/NJOutputKeyPress.h | 2 +- Classes/NJOutputKeyPress.m | 22 +++++++++++++--------- Info.plist | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Classes/NJOutputController.m b/Classes/NJOutputController.m index 95d28c4..07c077b 100644 --- a/Classes/NJOutputController.m +++ b/Classes/NJOutputController.m @@ -166,7 +166,7 @@ case 1: if (keyInput.hasKeyCode) { NJOutputKeyPress *k = [[NJOutputKeyPress alloc] init]; - k.vk = keyInput.keyCode; + k.keyCode = keyInput.keyCode; return k; } else { return nil; @@ -237,7 +237,7 @@ if ([output isKindOfClass:NJOutputKeyPress.class]) { [radioButtons selectCellAtRow:1 column:0]; - keyInput.keyCode = [(NJOutputKeyPress*)output vk]; + keyInput.keyCode = [(NJOutputKeyPress*)output keyCode]; } else if ([output isKindOfClass:NJOutputMapping.class]) { [radioButtons selectCellAtRow:2 column:0]; NSMenuItem *item = [mappingPopup itemWithRepresentedObject:[(NJOutputMapping *)output mapping]]; diff --git a/Classes/NJOutputKeyPress.h b/Classes/NJOutputKeyPress.h index 052b010..ce98668 100644 --- a/Classes/NJOutputKeyPress.h +++ b/Classes/NJOutputKeyPress.h @@ -10,6 +10,6 @@ @interface NJOutputKeyPress : NJOutput -@property (nonatomic, assign) CGKeyCode vk; +@property (nonatomic, assign) CGKeyCode keyCode; @end diff --git a/Classes/NJOutputKeyPress.m b/Classes/NJOutputKeyPress.m index 622cf41..1cc7e65 100644 --- a/Classes/NJOutputKeyPress.m +++ b/Classes/NJOutputKeyPress.m @@ -16,28 +16,32 @@ } - (NSDictionary *)serialize { - return _vk != NJKeyInputFieldEmpty - ? @{ @"type": self.class.serializationCode, @"key": @(_vk) } + return _keyCode != NJKeyInputFieldEmpty + ? @{ @"type": self.class.serializationCode, @"key": @(_keyCode) } : nil; } + (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { NJOutputKeyPress *output = [[NJOutputKeyPress alloc] init]; - output.vk = [serialization[@"key"] intValue]; + output.keyCode = [serialization[@"key"] intValue]; return output; } - (void)trigger { - CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _vk, YES); - CGEventPost(kCGHIDEventTap, keyDown); - CFRelease(keyDown); + if (_keyCode != NJKeyInputFieldEmpty) { + CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _keyCode, YES); + CGEventPost(kCGHIDEventTap, keyDown); + CFRelease(keyDown); + } } - (void)untrigger { - CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _vk, NO); - CGEventPost(kCGHIDEventTap, keyUp); - CFRelease(keyUp); + if (_keyCode != NJKeyInputFieldEmpty) { + CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _keyCode, NO); + CGEventPost(kCGHIDEventTap, keyUp); + CFRelease(keyUp); + } } @end diff --git a/Info.plist b/Info.plist index ed9e83f..1ddd7ca 100644 --- a/Info.plist +++ b/Info.plist @@ -46,7 +46,7 @@ CFBundleSignature ???? CFBundleVersion - 301 + 303 LSApplicationCategoryType public.app-category.utilities NSHumanReadableCopyright -- 2.30.2