summaryrefslogtreecommitdiff
path: root/src/SDLMain.m
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-05-13 12:01:29 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-05-13 12:01:29 (GMT)
commit17229ead05caae32a0c7c6c7a553442abcb6aede (patch)
tree702931ea04f9131a9ec132afc4a346137c2846e7 /src/SDLMain.m
parent58ea2b2acf2a959f286ed5ae996b6e6a74206e0d (diff)
downloadpowder-17229ead05caae32a0c7c6c7a553442abcb6aede.zip
powder-17229ead05caae32a0c7c6c7a553442abcb6aede.tar.gz
URI handling for MacOS
Diffstat (limited to 'src/SDLMain.m')
-rw-r--r--src/SDLMain.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/SDLMain.m b/src/SDLMain.m
index b6216af..3298fc2 100644
--- a/src/SDLMain.m
+++ b/src/SDLMain.m
@@ -9,6 +9,7 @@
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
+#include "defines.h"
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare
@@ -282,6 +283,21 @@ static void CustomApplicationMain (int argc, char **argv)
return TRUE;
}
+- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
+{
+ NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
+ int tempSaveOpen = [[url host] intValue];
+ if(tempSaveOpen > 0)
+ saveURIOpen = tempSaveOpen;
+}
+
+-(void)applicationWillFinishLaunching:(NSNotification *)aNotification
+{
+ NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
+ [appleEventManager setEventHandler:self
+ andSelector:@selector(handleGetURLEvent:withReplyEvent:)
+ forEventClass:kInternetEventClass andEventID:kAEGetURL];
+}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note