Accepting all DNDs on Mac

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Accepting all DNDs on Mac

Sean P. DeNigris
Administrator
Use case: Accept DND from Mail.app
Problem: Currently, it seems that this would require a custom built VM
Solution: VM should accept all drops by default and let the user decide what to do

btw is there an issue tracker for the VM where I can open a ticket?

From original discussion at http://forum.world.st/Accepting-Email-Drops-on-Pharo-Window-tt4841915.html#a4841939 :

Ben Coman wrote
> On StackOverflow [1], it was shown how to do this in
> Cocoa:
> ```
> [window registerForDraggedTypes:[NSArray
> arrayWithObjects:(NSString*)kPasteboardTypeFileURLPromise,nil]];
> ```
> but do I really need to modify the VM? It seems like, since Smalltalk is so
> malleable, and more like an OS than an app, we should accept all types and
> let the user decide whether to do something with them, no?
>
> [1]
> http://stackoverflow.com/questions/4115987/how-to-get-dropped-mail-message-data-in-a-cocoa-application
>

That sounds right.  Bring up a dialog reporting "Unknown paste type"
with a button to view raw and/or start decoding it from within the
debugger.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Accepting all DNDs on Mac

johnmci
 
The carbon and cocoa VM does support drag and drop see https://isqueak.org/ioGetNextEvent

Maybe someone ripped out the image side logic?

Sent from my iPhone

> On Aug 11, 2015, at 4:41 AM, Sean P. DeNigris <[hidden email]> wrote:
>
>
> Use case: Accept DND from Mail.app
> Problem: Currently, it seems that this would require a custom built VM
> Solution: VM should accept all drops by default and let the user decide what
> to do
>
> btw is there an issue tracker for the VM where I can open a ticket?
>
>> From original discussion at
> http://forum.world.st/Accepting-Email-Drops-on-Pharo-Window-tt4841915.html#a4841939
> :
>
>
> Ben Coman wrote
>>> On StackOverflow [1], it was shown how to do this in
>>> Cocoa:
>>> ```
>>> [window registerForDraggedTypes:[NSArray
>>> arrayWithObjects:(NSString*)kPasteboardTypeFileURLPromise,nil]];
>>> ```
>>> but do I really need to modify the VM? It seems like, since Smalltalk is
>>> so
>>> malleable, and more like an OS than an app, we should accept all types
>>> and
>>> let the user decide whether to do something with them, no?
>>>
>>> [1]
>>> http://stackoverflow.com/questions/4115987/how-to-get-dropped-mail-message-data-in-a-cocoa-application
>>
>> That sounds right.  Bring up a dialog reporting "Unknown paste type"
>> with a button to view raw and/or start decoding it from within the
>> debugger.
>
>
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Accepting-all-DNDs-on-Mac-tp4842062.html
> Sent from the Squeak VM mailing list archive at Nabble.com.

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Accepting all DNDs on Mac

Sean P. DeNigris
Administrator
johnmci wrote
The carbon and cocoa VM does support drag and drop see https://isqueak.org/ioGetNextEvent
Maybe someone ripped out the image side logic?
The reason I thought it was a VM issue is that, for Mail.app message drops (unlike with file drops), the icon flies back to Mail.app, and no event is generated (i.e. `Sensor nextEvent` never returns a non-nil value). Also, with files, the Pharo window shows an inside border, apparently indicating that the drop will be accepted. Is all that determined on the image-side? If so, can you point me in the direction of that code?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Accepting all DNDs on Mac

johnmci
 
There is a pool variable EventTypeDragDropFiles
Look at method generateDropFilesEvent:

There is sqMacDragDrop.c for Carbon
For Cocoa there is sqSqueakOSXDropAPI.m

So it should support drag/drop of files
As it only supports NSFilenamesPboardType

    [self registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];


On Tue, Aug 11, 2015 at 7:18 AM, Sean P. DeNigris <[hidden email]> wrote:

johnmci wrote
> The carbon and cocoa VM does support drag and drop see
> https://isqueak.org/ioGetNextEvent
> Maybe someone ripped out the image side logic?

The reason I thought it was a VM issue is that, for Mail.app message drops
(unlike with file drops), the icon flies back to Mail.app, and no event is
generated (i.e. `Sensor nextEvent` never returns a non-nil value). Also,
with files, the Pharo window shows an inside border, apparently indicating
that the drop will be accepted. Is all that determined on the image-side? If
so, can you point me in the direction of that code?



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Accepting-all-DNDs-on-Mac-tp4842062p4842116.html
Sent from the Squeak VM mailing list archive at Nabble.com.



--
===========================================================================
John M. McIntosh <[hidden email]https://www.linkedin.com/in/smalltalk
===========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Accepting all DNDs on Mac

Sean P. DeNigris
Administrator
johnmci wrote
As it only supports NSFilenamesPboardType
    [self registerForDraggedTypes: [NSArray arrayWithObjects:
NSFilenamesPboardType, nil]];
And Bob's your uncle!

So, what I'm suggesting is that we add support for other-than-file drags (in my two cases URLs and file promises).

Reference: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html#//apple_ref/doc/uid/20001288-CEGJFDFG
Cheers,
Sean