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, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
modifierCommands = @{
|
modifierCommands = @{
|
||||||
kKPKAutotypeAlt : @(kCGEventFlagMaskAlternate),
|
kKPKAutotypeAlt : @(kCGEventFlagMaskAlternate),
|
||||||
kKPKAutotypeControl : @(kCGEventFlagMaskCommand),
|
kKPKAutotypeControl : @(kCGEventFlagMaskControl),
|
||||||
kKPKAutotypeShift : @(kCGEventFlagMaskShift)
|
kKPKAutotypeShift : @(kCGEventFlagMaskShift)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,14 +7,25 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPAutotypeKeyPress.h"
|
#import "MPAutotypeKeyPress.h"
|
||||||
|
#import "MPFlagsHelper.h"
|
||||||
#import "MPKeyMapper.h"
|
#import "MPKeyMapper.h"
|
||||||
|
|
||||||
|
#import "MPSettingsHelper.h"
|
||||||
|
|
||||||
@implementation MPAutotypeKeyPress
|
@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 {
|
- (instancetype)initWithModifierMask:(CGEventFlags)modiferMask keyCode:(CGKeyCode)code {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if(self) {
|
if(self) {
|
||||||
_modifierMask = modiferMask;
|
_modifierMask = _updateModifierMaskForCurrentDefaults(modiferMask);
|
||||||
_keyCode = code;
|
_keyCode = code;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|||||||
Reference in New Issue
Block a user