Added API stub to allow for keystroke overrides when performing autotype

This commit is contained in:
Michael Starke
2018-08-24 15:57:00 +02:00
parent affc02c933
commit 2276a2b954
2 changed files with 8 additions and 4 deletions

View File

@@ -39,6 +39,7 @@
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (void)performAutotypeForEntry:(KPKEntry *)entry; - (void)performAutotypeForEntry:(KPKEntry *)entry;
- (void)performAutotypeForEntry:(KPKEntry *)entry overrideSequence:(NSString *)sequence;
- (void)selectAutotypeCandiate:(MPAutotypeContext *)context; - (void)selectAutotypeCandiate:(MPAutotypeContext *)context;
- (void)cancelAutotypeCandidateSelection; - (void)cancelAutotypeCandidateSelection;

View File

@@ -125,6 +125,9 @@ static MPAutotypeDaemon *_sharedInstance;
#pragma mark - #pragma mark -
#pragma mark Autotype Invocation #pragma mark Autotype Invocation
- (void)performAutotypeForEntry:(KPKEntry *)entry { - (void)performAutotypeForEntry:(KPKEntry *)entry {
[self performAutotypeForEntry:entry overrideSequence:nil];
}
- (void)performAutotypeForEntry:(KPKEntry *)entry overrideSequence:(NSString *)sequence {
if(entry) { if(entry) {
[self _updateTargeInformationForApplication:self.previousApplication]; [self _updateTargeInformationForApplication:self.previousApplication];
[self _performAutotypeForEntry:entry]; [self _performAutotypeForEntry:entry];
@@ -132,7 +135,7 @@ static MPAutotypeDaemon *_sharedInstance;
} }
- (void)_didPressHotKey { - (void)_didPressHotKey {
[self _updateTargetInfoForFrontMostApplication]; [self _updateTargetInformationForFrontMostApplication];
[self _performAutotypeForEntry:nil]; [self _performAutotypeForEntry:nil];
} }
@@ -330,15 +333,15 @@ static MPAutotypeDaemon *_sharedInstance;
#pragma mark Application information #pragma mark Application information
- (BOOL)_orderApplicationToFront:(pid_t)processIdentifier { - (BOOL)_orderApplicationToFront:(pid_t)processIdentifier {
NSRunningApplication *runingApplication = [NSRunningApplication runningApplicationWithProcessIdentifier:processIdentifier]; NSRunningApplication *runingApplication = [NSRunningApplication runningApplicationWithProcessIdentifier:processIdentifier];
NSRunningApplication *frontApplication = [NSWorkspace sharedWorkspace].frontmostApplication; NSRunningApplication *frontApplication = NSWorkspace.sharedWorkspace.frontmostApplication;
if(frontApplication.processIdentifier == processIdentifier) { if(frontApplication.processIdentifier == processIdentifier) {
return NO; return NO;
} }
[runingApplication activateWithOptions:NSApplicationActivateIgnoringOtherApps]; [runingApplication activateWithOptions:NSApplicationActivateIgnoringOtherApps];
return YES; return YES;
} }
- (void)_updateTargetInfoForFrontMostApplication { - (void)_updateTargetInformationForFrontMostApplication {
[self _updateTargeInformationForApplication:[NSWorkspace sharedWorkspace].frontmostApplication]; [self _updateTargeInformationForApplication:NSWorkspace.sharedWorkspace.frontmostApplication];
} }
- (void)_updateTargeInformationForApplication:(NSRunningApplication *)application { - (void)_updateTargeInformationForApplication:(NSRunningApplication *)application {