Respecting settings for command and control swap

This commit is contained in:
michael starke
2014-12-14 16:12:07 +01:00
parent f65fc31408
commit af8743b5cc
2 changed files with 13 additions and 2 deletions

View File

@@ -7,14 +7,25 @@
//
#import "MPAutotypeKeyPress.h"
#import "MPFlagsHelper.h"
#import "MPKeyMapper.h"
#import "MPSettingsHelper.h"
@implementation MPAutotypeKeyPress
static CGEventFlags _updateModifierMaskForCurrentDefaults(CGEventFlags modifiers) {
BOOL sendCommand = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeySendCommandForControlKey];
if(sendCommand && MPIsFlagSetInOptions(kCGEventFlagMaskControl, modifiers)) {
return (modifiers ^ kCGEventFlagMaskControl) | kCGEventFlagMaskCommand;
}
return modifiers;
}
- (instancetype)initWithModifierMask:(CGEventFlags)modiferMask keyCode:(CGKeyCode)code {
self = [super init];
if(self) {
_modifierMask = modiferMask;
_modifierMask = _updateModifierMaskForCurrentDefaults(modiferMask);
_keyCode = code;
}
return self;