We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2757

Summary: [Patch] Mac: add support for dragging files directly onto SDL windows
Product: SDL Reporter: Alex Szpakowski <amaranth72>
Component: videoAssignee: Jørgen Tjernø <jorgen>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: jorgen
Version: HG 2.0   
Hardware: x86_64   
OS: Mac OS X (All)   
Attachments: Patch to allow users to drop files onto SDL windows in OS X
Updated patch to allow users to drop files onto SDL windows in OS X

Description Alex Szpakowski 2014-10-19 18:58:34 UTC
Created attachment 1907 [details]
Patch to allow users to drop files onto SDL windows in OS X

SDL's Cocoa code currently triggers SDL_DROPFILE events when the user drops a file onto the application's icon, but another idiomatic way for OS X users to drag-and-drop files is to put the file directly inside the window's frame.

I have attached a patch which adds that functionality to SDL's Cocoa video backend.
Comment 1 Alex Szpakowski 2014-10-20 05:38:24 UTC
Created attachment 1909 [details]
Updated patch to allow users to drop files onto SDL windows in OS X

The previous patch didn't handle OS X alias files. I've attached a new updated patch which does.
Comment 2 Jørgen Tjernø 2014-11-24 19:42:18 UTC
    if (isAlias != nil && [isAlias boolValue]) {    

Just using [isAlias boolValue] is cleaner -- calling any method on nil returns nil, which is a false value.

Other than that, it LGTM. I can merge and make that change.
Comment 3 Jørgen Tjernø 2014-11-24 19:48:01 UTC
Fixed in https://hg.libsdl.org/SDL/rev/2cc90bb31777