Skip to content

Commit

Permalink
Replace use of deprecated SetFrontProcessWithOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nriley committed Nov 9, 2014
1 parent cef65c6 commit 9610abf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Source/PSAlarmAlertController.h
Expand Up @@ -13,7 +13,7 @@ extern NSString * const PSAlarmAlertStopNotification;

@interface PSAlarmAlertController : NSObject {
NSMutableSet *pendingAlerts;
ProcessSerialNumber frontmostApp;
NSRunningApplication *frontmostApplication;
BOOL appWasHidden;
}

Expand Down
11 changes: 6 additions & 5 deletions Source/PSAlarmAlertController.m
Expand Up @@ -33,8 +33,10 @@ - (void)_resumeAlarm:(PSAlarm *)alarm;
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[alarm setTimer]; // if snooze not set and not repeating, alarm will die
if (frontmostApp.highLongOfPSN != 0 || frontmostApp.lowLongOfPSN != 0) {
SetFrontProcessWithOptions(&frontmostApp, kSetFrontProcessFrontWindowOnly);
if (frontmostApplication != nil) {
[frontmostApplication activateWithOptions: NSApplicationActivateIgnoringOtherApps];
[frontmostApplication release];
frontmostApplication = nil;
if (appWasHidden)
[NSApp hide: self];
}
Expand Down Expand Up @@ -69,9 +71,8 @@ - (void)performAlertsForAlarm:(PSAlarm *)alarm;
}
[alerts triggerForAlarm: alarm];
if ([alerts requirePesterFrontmost] && ![NSApp isActive]) { // restore frontmost process afterward
NSDictionary *activeProcessInfo = [[NSWorkspace sharedWorkspace] activeApplication];
frontmostApp.highLongOfPSN = [[activeProcessInfo objectForKey: @"NSApplicationProcessSerialNumberHigh"] longValue];
frontmostApp.lowLongOfPSN = [[activeProcessInfo objectForKey: @"NSApplicationProcessSerialNumberLow"] longValue];
[frontmostApplication release];
frontmostApplication = [[[NSWorkspace sharedWorkspace] frontmostApplication] retain];
appWasHidden = [NSApp isHidden];
[NSApp performAlertSelectorWhenIdle: @selector(activateIgnoringOtherApps) withObject: nil];
}
Expand Down

0 comments on commit 9610abf

Please sign in to comment.