performExternalDragDropOfFiles is not synchronous on MAC

The documentation for this function clearly states that

"This performs a synchronous drag-and-drop of a set of files to some external application.

You can call this function in response to a mouseDrag callback, and it will block, running its own internal message loop and tracking the mouse, while it uses a native operating system drag-and-drop operation to move or copy some files to another application."

And it will return
“true if the files were successfully dropped somewhere, or false if it was interrupted”

This is not at all how it is behaving on MAC currently, instead it will return immediately after calling this, it will return true if a drag could be started and false otherwise.

Is this a bug or is the documentation wrong? What is intended?
Are there any plans on fixing this so it works the same as on Windows where it works just like the documentation states?

Currently we do a lot of not-so-pretty hacks to counter this behavior on MAC, it would be nice to not have to do that :slight_smile:

Feel free to join the currently open conversation in @Rail_Jon_Rogut’s thread:

Thanks for the report @patrikwa. This commit has changed the behaviour of DragAndDropContainer::performExternalDragDropOfFiles() and ::performExternalDragDropOfText() so that they are asynchronous operations on all platforms (previously only Windows was synchronous) and the docs have been updated to reflect this. This means that the operation will no longer block the message thread on Windows as it runs on a separate background thread, but you can pass the methods a callback parameter which will be called when the operation has ended.

Hopefully you’ll agree that uniformly doing this asynchronously is a better solution and you should be able to work around any issues that arise using the callback, but feel free to post back if you have any issues.

1 Like