| Summary: | SDL does not handle URL Schemes in MacOS | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Jason <Jason.carr01> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.12 | ||
| Hardware: | All | ||
| OS: | Mac OS X (All) | ||
| Attachments: | Additions on line 251 and 262 | ||
Can you attach your SDL_cocoaevents.m file, so I can see the context? Line 205 is in a different function here. Thanks! Created attachment 4293 [details]
Additions on line 251 and 262
Changes committed, thanks! https://hg.libsdl.org/SDL/rev/19139846279c |
In iOS, URL Events trigger the DropFile event. I would also expect the same event to be fired on the macOS platform but this is not implemented at all in the AppDelegate. As a quick fix, I modified the app delegate defined in src/video/cocoa/SDL_cocoaevents.m Added to applicationDidFinishLaunching (line 205) [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; ----------------------------------------- Added after applicationDidFinishLaunching - (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { NSString* path = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; SDL_SendDropFile(NULL, [path UTF8String]); SDL_SendDropComplete(NULL); }