src/video/cocoa/SDL_cocoaevents.m
changeset 9820 c0bcc39a3491
parent 9619 b94b6d0bff0f
child 9822 371d82c6bf94
     1.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Wed Jul 29 17:19:13 2015 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Wed Jul 29 17:19:15 2015 -0700
     1.3 @@ -26,6 +26,7 @@
     1.4  #include "SDL_cocoavideo.h"
     1.5  #include "../../events/SDL_events_c.h"
     1.6  #include "SDL_assert.h"
     1.7 +#include "SDL_hints.h"
     1.8  
     1.9  /* This define was added in the 10.9 SDK. */
    1.10  #ifndef kIOPMAssertPreventUserIdleDisplaySleep
    1.11 @@ -318,19 +319,21 @@
    1.12          [SDLApplication sharedApplication];
    1.13          SDL_assert(NSApp != nil);
    1.14  
    1.15 +        const char *hint = SDL_GetHint(SDL_HINT_MAC_BACKGROUND_APP);
    1.16 +		if (!hint && *hint != '0') {
    1.17  #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
    1.18 -        if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) {
    1.19 +			if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) {
    1.20  #endif
    1.21 -            [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    1.22 +				[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    1.23  #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
    1.24 -        } else {
    1.25 -            ProcessSerialNumber psn = {0, kCurrentProcess};
    1.26 -            TransformProcessType(&psn, kProcessTransformToForegroundApplication);
    1.27 -        }
    1.28 +			} else {
    1.29 +				ProcessSerialNumber psn = {0, kCurrentProcess};
    1.30 +				TransformProcessType(&psn, kProcessTransformToForegroundApplication);
    1.31 +			}
    1.32  #endif
    1.33 -
    1.34 -        [NSApp activateIgnoringOtherApps:YES];
    1.35 -
    1.36 +            [NSApp activateIgnoringOtherApps:YES];
    1.37 +		}
    1.38 +		
    1.39          if ([NSApp mainMenu] == nil) {
    1.40              CreateApplicationMenus();
    1.41          }