Update SDLMain.m fram SDL-1.2 tree. SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Wed, 13 Nov 2019 08:11:10 +0300
branchSDL-1.2
changeset 743c018b8d5c83e
parent 742 94528168d03e
Update SDLMain.m fram SDL-1.2 tree.

Reverts SDL-1.2 changeset 67f391c74aee after the breakage report
See: https://bugzilla.libsdl.org/show_bug.cgi?id=4114#c5
Xcode/showimage/SDLMain.m
     1.1 --- a/Xcode/showimage/SDLMain.m	Sun Nov 10 11:00:02 2019 +0300
     1.2 +++ b/Xcode/showimage/SDLMain.m	Wed Nov 13 08:11:10 2019 +0300
     1.3 @@ -20,6 +20,22 @@
     1.4  /* Use this flag to determine whether we use SDLMain.nib or not */
     1.5  #define		SDL_USE_NIB_FILE	0
     1.6  
     1.7 +/* Use this flag to determine whether we use CPS (docking) or not */
     1.8 +#define		SDL_USE_CPS		1
     1.9 +#ifdef SDL_USE_CPS
    1.10 +/* Portions of CPS.h */
    1.11 +typedef struct CPSProcessSerNum
    1.12 +{
    1.13 +	UInt32		lo;
    1.14 +	UInt32		hi;
    1.15 +} CPSProcessSerNum;
    1.16 +
    1.17 +extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
    1.18 +extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    1.19 +extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
    1.20 +
    1.21 +#endif /* SDL_USE_CPS */
    1.22 +
    1.23  static int    gArgc;
    1.24  static char  **gArgv;
    1.25  static BOOL   gFinderLaunch;
    1.26 @@ -185,7 +201,18 @@
    1.27      SDLMain				*sdlMain;
    1.28  
    1.29      /* Ensure the application object is initialised */
    1.30 -    [[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
    1.31 +    [NSApplication sharedApplication];
    1.32 +    
    1.33 +#ifdef SDL_USE_CPS
    1.34 +    {
    1.35 +        CPSProcessSerNum PSN;
    1.36 +        /* Tell the dock about us */
    1.37 +        if (!CPSGetCurrentProcess(&PSN))
    1.38 +            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
    1.39 +                if (!CPSSetFrontProcess(&PSN))
    1.40 +                    [NSApplication sharedApplication];
    1.41 +    }
    1.42 +#endif /* SDL_USE_CPS */
    1.43  
    1.44      /* Set up the menubar */
    1.45      [NSApp setMainMenu:[[NSMenu alloc] init]];
    1.46 @@ -318,6 +345,7 @@
    1.47  @end
    1.48  
    1.49  
    1.50 +
    1.51  #ifdef main
    1.52  #  undef main
    1.53  #endif