ioquake / ioq3

The ioquake3 community effort to continue supporting/developing id's Quake III Arena
https://ioquake3.org/
GNU General Public License v2.0
2.38k stars 527 forks source link

Use SDL event for protocol handler on macOS #603

Closed zturtleman closed 1 year ago

zturtleman commented 1 year ago

Use SDL's SDL_DROPFILE event to receive URLs to handle on macOS for URL protocol schemes listed in the AppBundle Info.plist. This also handles URLs while the game is running (connect to new server) instead of nothing happening when clicking a link while the game is running.

This fixes the macOS client and server being completely unusable when run from a terminal. They blocked forever in [NSApp run]; which was called by Sys_InitProtocolHandler(). applicationDidFinishLaunching was never called to exit the NSApp run loop.

I didn't manage to find a way to know whether it was run from terminal or launch services (?) to not enter [NSApp run] or another way to allow bailing out of [NSApp run]. So use the SDL event instead.