# HG changeset patch # User Sam Lantinga # Date 1030766479 0 # Node ID a7129c0083f4b9fa8d537b788281b99e24de7d22 # Parent 429fe382fe4f51674c295c8f859e2d3235e3122f Tell the dock about command-line launched applications diff -r 429fe382fe4f -r a7129c0083f4 src/main/macosx/SDLMain.m --- a/src/main/macosx/SDLMain.m Sat Aug 31 01:31:44 2002 +0000 +++ b/src/main/macosx/SDLMain.m Sat Aug 31 04:01:19 2002 +0000 @@ -13,6 +13,21 @@ /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ static int gArgc; static char **gArgv; @@ -162,6 +177,17 @@ /* Ensure the application object is initialised */ [SDLApplication sharedApplication]; +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [SDLApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; setupAppleMenu();