Tell the dock about command-line launched applications
authorSam Lantinga <slouken@libsdl.org>
Sat, 31 Aug 2002 04:01:19 +0000
changeset 476a7129c0083f4
parent 475 429fe382fe4f
child 477 22581630aab7
Tell the dock about command-line launched applications
src/main/macosx/SDLMain.m
     1.1 --- a/src/main/macosx/SDLMain.m	Sat Aug 31 01:31:44 2002 +0000
     1.2 +++ b/src/main/macosx/SDLMain.m	Sat Aug 31 04:01:19 2002 +0000
     1.3 @@ -13,6 +13,21 @@
     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 @@ -162,6 +177,17 @@
    1.26      /* Ensure the application object is initialised */
    1.27      [SDLApplication sharedApplication];
    1.28      
    1.29 +#ifdef SDL_USE_CPS
    1.30 +    {
    1.31 +        CPSProcessSerNum PSN;
    1.32 +        /* Tell the dock about us */
    1.33 +        if (!CPSGetCurrentProcess(&PSN))
    1.34 +            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
    1.35 +                if (!CPSSetFrontProcess(&PSN))
    1.36 +                    [SDLApplication sharedApplication];
    1.37 +    }
    1.38 +#endif /* SDL_USE_CPS */
    1.39 +
    1.40      /* Set up the menubar */
    1.41      [NSApp setMainMenu:[[NSMenu alloc] init]];
    1.42      setupAppleMenu();