summaryrefslogtreecommitdiff
path: root/src/player/SDLMain.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/player/SDLMain.m')
-rw-r--r--src/player/SDLMain.m32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/player/SDLMain.m b/src/player/SDLMain.m
new file mode 100644
index 0000000..bec828d
--- /dev/null
+++ b/src/player/SDLMain.m
@@ -0,0 +1,32 @@
+#import <SDL/SDL.h>
+#import "SDLMain.h"
+
+#import <Cocoa/Cocoa.h>
+
+/* 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);
+
+void CustomSDLMain()
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [ NSApplication sharedApplication ];
+ [ NSApp setMainMenu:[[NSMenu alloc] init] ];
+
+ {
+ CPSProcessSerNum PSN;
+ /* Tell the dock about us */
+ if (!CPSGetCurrentProcess(&PSN))
+ if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
+ if (!CPSSetFrontProcess(&PSN))
+ [NSApplication sharedApplication];
+ }
+}
+