mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-25 04:09:24 +00:00
Restrucuterde Autotype commands a bit
This commit is contained in:
@@ -7,11 +7,25 @@
|
||||
//
|
||||
|
||||
#import "MPAutotypeKeyPress.h"
|
||||
#import "MPKeyMapper.h"
|
||||
|
||||
@implementation MPAutotypeKeyPress
|
||||
|
||||
- (void)execute {
|
||||
|
||||
if(![self isValid]) {
|
||||
return; // no valid command. Stop.
|
||||
}
|
||||
CGKeyCode mappedKey = [self _transformKeyCode];
|
||||
[self sendPressKey:mappedKey modifierFlags:self.modifierMask];
|
||||
}
|
||||
|
||||
- (BOOL)isValid {
|
||||
return ([self _transformKeyCode] != kMPUnknownKeyCode);
|
||||
}
|
||||
|
||||
- (CGKeyCode)_transformKeyCode {
|
||||
NSString *key = [MPKeyMapper stringForKey:self.keyCode];
|
||||
return [MPKeyMapper keyCodeForCharacter:key];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user