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 5449 - SDL_DROPFILE update mouse location of drop in Cocoa
Summary: SDL_DROPFILE update mouse location of drop in Cocoa
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Mac OS X (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-07 14:08 UTC by Dominik Reichardt
Modified: 2021-01-07 19:50 UTC (History)
0 users

See Also:


Attachments
patch (826 bytes, patch)
2021-01-07 14:08 UTC, Dominik Reichardt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Reichardt 2021-01-07 14:08:04 UTC
Created attachment 4641 [details]
patch

Exult (http://exult.info) has an editor app that uses GTK+2. Up to now we were using X's drag'n'drop to allow dropping of assets from the editor onto Exult.
There is now an experimental branch that makes use of SDL_DROPFILE. That works under X, dropping in Exult's SDL2 window puts the asset right at the spot you dropped at.
On macOS with native Exult and Quartz GTK+2 this doesn't work, the location of the drop is where the mouse was last tracked before you left the window (usually one of the edges, unless you tabbed out).
All we tried out pointed to the fact that the location update needs to be done by the dropfile event in SDL2, not by our own (which always only worked after the Exult window getting focus).

This patch adds this to SDL_cocoawindow.m and it works perfectly, passing the correct coordinates to our code (SDL_GetMouseState()).

I really hope this is acceptable to be added.
If you do, please credit it to the Exult team, not me.
Comment 1 Sam Lantinga 2021-01-07 19:50:18 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/206fbf808fdb