From 2ad4bd2abcc263862c2a2e3191c1b72724c6cfae Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Thu, 8 Oct 2020 23:28:54 +0200 Subject: [PATCH] correctly set global autotype on initailizer --- MacPass/MPAutotypeEnvironment.h | 2 +- MacPass/MPAutotypeEnvironment.m | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MacPass/MPAutotypeEnvironment.h b/MacPass/MPAutotypeEnvironment.h index 2b033c3b..f2736e00 100644 --- a/MacPass/MPAutotypeEnvironment.h +++ b/MacPass/MPAutotypeEnvironment.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly) BOOL hidden; /// If set to YES, MacPass was hidden when autotype was initiated @property (readonly) BOOL isSelfTargeting; /// If MacPass should autotype to itself, YES, otherwise NO @property (readonly) NSString *overrideSequence; /// If set, this sequence is used for running the command regardless of the matched one -@property (readonly) BOOL globalAutotype; +@property (readonly) BOOL globalAutotype; /// YES, if autotype is run as global autotype, NO otherwise + (instancetype)environmentWithTargetApplication:(NSRunningApplication * _Nullable)targetApplication entry:(KPKEntry * _Nullable)entry overrideSequence:(NSString * _Nullable)overrideSequence; diff --git a/MacPass/MPAutotypeEnvironment.m b/MacPass/MPAutotypeEnvironment.m index 934cf1f1..cc2664dd 100644 --- a/MacPass/MPAutotypeEnvironment.m +++ b/MacPass/MPAutotypeEnvironment.m @@ -20,14 +20,16 @@ - (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry overrideSequence:(NSString *)overrdieSequence { self = [super init]; if(self) { + _globalAutotype = NO; _preferredEntry = entry; _hidden = NSRunningApplication.currentApplication.isHidden; _overrideSequence = [overrdieSequence copy]; /* capture the front most application if no one was supplied */ if(nil == targetApplication) { + _globalAutotype = YES; targetApplication = NSWorkspace.sharedWorkspace.frontmostApplication; } - if(!targetApplication) { + if(nil == targetApplication) { _pid = -1; _windowTitle = @""; }