[squeak-dev] drag/drop events fro dragging from applications?

Tobias Pape Das.Linux at gmx.de
Wed Jul 17 21:23:31 UTC 2019


Hi tim

> On 17.07.2019, at 22:27, tim Rowledge <tim at rowledge.org> wrote:
> 
> We've had handlers for dropping files onto Squeak for ages but it doesn't appear to do anything if I drag an item from an outside application - for example, dragging an email from the mail app on my iMac. So far as I can tell it doesn't even get an event into the image.
> 

What works is dropping files. Just tested with a TXT file.

Please doIt: [FileStream primDropRequestFileName: 0]  and then see if [SmalltalkImage current listLoadedModules] contains the DropPlugin.

It should, because it usually is compiled-in, at least on mac.

I dropped some other files and you should at least get a question what to do with it…


> Has anyone done anything with this ? I'm hoping to make it possible to drag an email with license/key info and avoid a user having to manually paste stuff. Seems like it might be a nice way to simplify life.

NOTE the next is OSX (or macOS) specific. The world is completely different with holes in Walls and penguins (let alone, demons and pufferfishes)

Dragging an email directly has not worked for me.
Reading the code in platforms/iOS/vm/OSX/sqSqueakOS*View.m, specifically -filterOutSqueakImageFilesFromDraggedFiles: (which is the same in all implementations *hint hint*)
it seems we filter out anything in dragged stuff that is _NOT_ filenames:


	if ([[pboard types] containsObject: NSFilenamesPboardType]) {
		NSArray *files= [pboard propertyListForType: NSFilenamesPboardType];
		NSString *fileName;
		for (fileName in files) {/*...*/


While this (NSFilenamesPboardType) is already deprecated since *rustling* exactly 10 years![1] and we should use 
a completely different API [2], we still have to deal with the fact, that files look different when dragging:




than an email:




(especially the promised-content part!)

And we somehow have to make up our mind how to turn that into squeak events (which currently only deals in file names and file handles…)

Further reading:
	- https://stackoverflow.com/questions/14397905/drag-and-drop-mail-into-os-x-app
	- https://stackoverflow.com/questions/17859184/drop-e-mail-from-mail-app-into-nswindow-object

Hope that helps.

Best regards
	-Tobias

[1]: https://developer.apple.com/documentation/appkit/nspasteboardtype?language=objc
[2]: https://developer.apple.com/documentation/appkit/nspasteboard/1524454-readobjectsforclasses?language=objc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190717/ed0bb3f2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2019-07-17 um 23.16.34.PNG
Type: image/png
Size: 29212 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190717/ed0bb3f2/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2019-07-17 um 23.17.56.PNG
Type: image/png
Size: 49469 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190717/ed0bb3f2/attachment-0003.png>


More information about the Squeak-dev mailing list