mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 20:02:27 +00:00
Respecting settings for command and control swap
This commit is contained in:
@@ -93,7 +93,7 @@ static CGKeyCode kMPFunctionKeyCodes[] = { kVK_F1, kVK_F2, kVK_F3, kVK_F4, kVK_F
|
||||
dispatch_once(&onceToken, ^{
|
||||
modifierCommands = @{
|
||||
kKPKAutotypeAlt : @(kCGEventFlagMaskAlternate),
|
||||
kKPKAutotypeControl : @(kCGEventFlagMaskCommand),
|
||||
kKPKAutotypeControl : @(kCGEventFlagMaskControl),
|
||||
kKPKAutotypeShift : @(kCGEventFlagMaskShift)
|
||||
};
|
||||
});
|
||||
|
||||
@@ -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