comparison src/main/macosx/SDLMain.m @ 476:a7129c0083f4

Tell the dock about command-line launched applications
author Sam Lantinga <slouken@libsdl.org>
date Sat, 31 Aug 2002 04:01:19 +0000
parents 19e73568a75c
children 217f119a19a0
comparison
equal deleted inserted replaced
475:429fe382fe4f 476:a7129c0083f4
11 #import <unistd.h> 11 #import <unistd.h>
12 12
13 /* Use this flag to determine whether we use SDLMain.nib or not */ 13 /* Use this flag to determine whether we use SDLMain.nib or not */
14 #define SDL_USE_NIB_FILE 0 14 #define SDL_USE_NIB_FILE 0
15 15
16 /* Use this flag to determine whether we use CPS (docking) or not */
17 #define SDL_USE_CPS 1
18 #ifdef SDL_USE_CPS
19 /* Portions of CPS.h */
20 typedef struct CPSProcessSerNum
21 {
22 UInt32 lo;
23 UInt32 hi;
24 } CPSProcessSerNum;
25
26 extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
27 extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
28 extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
29
30 #endif /* SDL_USE_CPS */
16 31
17 static int gArgc; 32 static int gArgc;
18 static char **gArgv; 33 static char **gArgv;
19 static BOOL gFinderLaunch; 34 static BOOL gFinderLaunch;
20 35
160 SDLMain *sdlMain; 175 SDLMain *sdlMain;
161 176
162 /* Ensure the application object is initialised */ 177 /* Ensure the application object is initialised */
163 [SDLApplication sharedApplication]; 178 [SDLApplication sharedApplication];
164 179
180 #ifdef SDL_USE_CPS
181 {
182 CPSProcessSerNum PSN;
183 /* Tell the dock about us */
184 if (!CPSGetCurrentProcess(&PSN))
185 if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
186 if (!CPSSetFrontProcess(&PSN))
187 [SDLApplication sharedApplication];
188 }
189 #endif /* SDL_USE_CPS */
190
165 /* Set up the menubar */ 191 /* Set up the menubar */
166 [NSApp setMainMenu:[[NSMenu alloc] init]]; 192 [NSApp setMainMenu:[[NSMenu alloc] init]];
167 setupAppleMenu(); 193 setupAppleMenu();
168 setupWindowMenu(); 194 setupWindowMenu();
169 195