mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 16:29:23 +00:00
Respecting settings for command and control swap
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user