mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
minor update from SDL-1.2 mainstream tree. (our binaries don't change.)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1650 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
a1ae4bdc7c
commit
93aca471a3
1 changed files with 35 additions and 16 deletions
|
@ -20,6 +20,22 @@
|
|||
/* 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;
|
||||
static BOOL gFinderLaunch;
|
||||
|
@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv)
|
|||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
|
||||
[NSApplication 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))
|
||||
[NSApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
|
@ -318,6 +345,7 @@ static void CustomApplicationMain (int argc, char **argv)
|
|||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
@ -330,25 +358,16 @@ static int IsRootCwd()
|
|||
return (cwd && (strcmp(cwd, "/") == 0));
|
||||
}
|
||||
|
||||
static int IsTenPointNineOrLater()
|
||||
{
|
||||
/* Gestalt() is deprecated in 10.8, but I don't care. Stop using SDL 1.2. */
|
||||
SInt32 major, minor;
|
||||
Gestalt(gestaltSystemVersionMajor, &major);
|
||||
Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
return ( ((major << 16) | minor) >= ((10 << 16) | 9) );
|
||||
}
|
||||
|
||||
static int IsFinderLaunch(const int argc, char **argv)
|
||||
{
|
||||
const int bIsNewerOS = IsTenPointNineOrLater();
|
||||
/* -psn_XXX is passed if we are launched from Finder in 10.8 and earlier */
|
||||
if ( (!bIsNewerOS) && (argc >= 2) && (strncmp(argv[1], "-psn", 4) == 0) ) {
|
||||
/* -psn_XXX is passed if we are launched from Finder, SOMETIMES */
|
||||
if ( (argc >= 2) && (strncmp(argv[1], "-psn", 4) == 0) ) {
|
||||
return 1;
|
||||
} else if ((bIsNewerOS) && (argc == 1) && IsRootCwd()) {
|
||||
} else if ((argc == 1) && IsRootCwd()) {
|
||||
/* we might still be launched from the Finder; on 10.9+, you might not
|
||||
get the -psn command line anymore. Check version, if there's no
|
||||
command line, and if our current working directory is "/". */
|
||||
get the -psn command line anymore. If there's no
|
||||
command line, and if our current working directory is "/", it
|
||||
might as well be a Finder launch. */
|
||||
return 1;
|
||||
}
|
||||
return 0; /* not a Finder launch. */
|
||||
|
|
Loading…
Reference in a new issue