From a8528a256b0a0801b1c22db66a4babd0311ac14e Mon Sep 17 00:00:00 2001 From: Robert Patchett Date: Wed, 25 Jul 2018 14:46:37 +0200 Subject: [PATCH] Add an option to turn off hideOnDeactivate in SPUStandardUserDriver for forground apps --- Sparkle/SPUStandardUserDriver.h | 5 +++++ Sparkle/SPUStandardUserDriver.m | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Sparkle/SPUStandardUserDriver.h b/Sparkle/SPUStandardUserDriver.h index d84bcc14..7f1a03a7 100644 --- a/Sparkle/SPUStandardUserDriver.h +++ b/Sparkle/SPUStandardUserDriver.h @@ -33,6 +33,11 @@ SU_EXPORT @interface SPUStandardUserDriver : NSObject )delegate; +/*! + * Enable or disable hideOnDeactivate for standard update window. + */ +@property (nonatomic) BOOL hideOnDeactivate; + @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index 2e53dd15..b3e3891b 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -39,6 +39,7 @@ @synthesize delegate = _delegate; @synthesize checkingController = _checkingController; @synthesize activeUpdateAlert = _activeUpdateAlert; +@synthesize hideOnDeactivate = _hideOnDeactivate; @synthesize statusController = _statusController; #pragma mark Birth @@ -50,6 +51,7 @@ _host = [[SUHost alloc] initWithBundle:hostBundle]; _delegate = delegate; _coreComponent = [[SPUUserDriverCoreComponent alloc] init]; + _hideOnDeactivate = YES; } return self; } @@ -88,12 +90,15 @@ // Make sure the window is loaded in any case [self.activeUpdateAlert window]; + if (!self.hideOnDeactivate) { + [self.activeUpdateAlert.window setHidesOnDeactivate:NO]; + } + // If the app is a menubar app or the like, we need to focus it first and alter the // update prompt to behave like a normal window. Otherwise if the window were hidden // there may be no way for the application to be activated to make it visible again. if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) { [self.activeUpdateAlert.window setHidesOnDeactivate:NO]; - [NSApp activateIgnoringOtherApps:YES]; }