-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Drag and Drop SDL_EVENT_DROP_TEXT in Cocoa #10323
Conversation
I've tested this on macOS 14.5 for arm64 and for intel I tested this on macOS 10.11/10.14/14.5. Edit: we are using this with Exult (which has already been ported to SDL3 by the OP) and Exult Studio. Exult Studio is a GTK+3 app and is our world editor. You can drag graphics onto Exult to change the game world. Not too long ago we changed our drag and drop from native ways to use the SDL 2 code to drop the files onto Exult. But this is a bit limited and extending SDL's drop code would help a lot. |
In general this looks good. You should wrap the verbose logging with |
I placed them into the INPUT log category to avoid having them displayed by default as they would be in the APPLICATION category. Add-on I could also push them to log priority DEBUG instead of INFO. |
I don't think drag and drop is a large enough subsystem to warrant its own category (e.g. audio, video, etc.) but we can move a bunch of the input logging to the verbose level if it's too much. Which ones are particularly verbose? |
These diagnostic messages should definitely be at the debug level. |
src/video/cocoa/SDL_cocoawindow.m Support Copy in addition to Generic as Drag and Drop operation, Register and Support public.utf8-plain-text for SDL_EVENT_DROP_TEXT.
a08c6b5
to
af05f71
Compare
Done ( and Rebased to main ). But I found DEBUG to be too verbose not in the category INPUT, but in all categories, because I thought that I only could control the Log subsystem programmatically , using I was ignorant of the But now that I know about it, I feel that it is the most important hint in SDL 3 for us application developers, before even the backend choosing hints Could you highlight it in some way in the Migration README, for example in carrying into it the sample in |
Looks good! I'll go ahead and merge this, and I created a separate issue to track illuminating SDL_HINT_LOGGING. Thanks for the feedback! |
Into
src/video/cocoa/SDL_cocoawindow.m
public.utf8-plain-text
forSDL_EVENT_DROP_TEXT
.This is the equivalent of
text/plain;charset=utf-8
for macOS.Description
Main target : Provide TEXT Drag and Drop
SDL_EVENT_DROP_TEXT
to macOS ( Cocoa )kUTTypeUTF8PlainText
orpublic.utf8-plain-text
intoRegisterForDraggedTypes
on theNSWindow
NSPasteboardTypeString
orpublic.utf8-plain-text
intoAvailableTypesFromArray
on theNSPasteboard
,NSPasteboardTypeString
asNSString
, split it by lines like thetext/plain;charset=utf-8
Drags and Drops, submit each line toSDL_SendDropText
.Secondary target : Support Drag and Drop Copy in addition to Drag and Drop Generic
draggingEntered
anddraggingUpdated
.Secondary target : Report properly the pointer location at Drop
SDL_SendDropPosition
instead ofSDL_SendMouseMotion
inperformDragOperation
.Secondary target : Print suitable messages in the SDL Log
draggingEntered
on Window Enter,draggingUpdated
on Pointer Move in Window,performDragOperation
on Drop,performDragOperation
on Drop,SDL_SendDropFile
andSDL_SendDropText
inperformDragOperation
on Drop.