drag/drop events fro dragging from applications?

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

drag/drop events fro dragging from applications?

timrowledge
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.

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.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Death is a nonmaskable interrupt. For now...



Reply | Threaded
Open this post in threaded view
|

Re: drag/drop events fro dragging from applications?

Tobias Pape
Hi tim

On 17.07.2019, at 22:27, tim Rowledge <[hidden email]> 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:

Hope that helps.

Best regards
-Tobias



Reply | Threaded
Open this post in threaded view
|

Re: drag/drop events fro dragging from applications?

timrowledge


> On 2019-07-17, at 2:23 PM, Tobias Pape <[hidden email]> wrote:
>
> What works is dropping files. Just tested with a TXT file.

Yup, that stuff has worked for years - maybe decades; I recall having fun doing the RISC OS vm part a looooooooong time ago.



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

I do not like Holes in Walls. Not one little bit. At least if I run it in VMWare on my mac  I can kill it easily.

>
> 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:

Well that's all going to be *such* fun, isn't it? It turns out that we're not the only ones with issues to fix though; if you drag an email directly to TextWrangler, for example, it only reads the email subject line... ooh, just worked out that option-click/drag will drop the whole raw text into TW. Interesting... so there may be options.
Sadly, if it involves noticeable VM work across platforms I don't think I'm going to get a chance to do anything about it.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
To define recursion, we must first define recursion.



Reply | Threaded
Open this post in threaded view
|

Re: drag/drop events fro dragging from applications?

Tobias Pape

> On 18.07.2019, at 00:04, tim Rowledge <[hidden email]> wrote:
>
>
>
>> On 2019-07-17, at 2:23 PM, Tobias Pape <[hidden email]> wrote:
>>
>> What works is dropping files. Just tested with a TXT file.
>
> Yup, that stuff has worked for years - maybe decades; I recall having fun doing the RISC OS vm part a looooooooong time ago.
>
>
>
>> NOTE the next is OSX (or macOS) specific. The world is completely different with holes in Walls and penguins (let alone, demons and pufferfishes)
>
> I do not like Holes in Walls. Not one little bit. At least if I run it in VMWare on my mac  I can kill it easily.
>
>>
>> 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:
>
> Well that's all going to be *such* fun, isn't it? It turns out that we're not the only ones with issues to fix though; if you drag an email directly to TextWrangler, for example, it only reads the email subject line... ooh, just worked out that option-click/drag will drop the whole raw text into TW. Interesting... so there may be options.
> Sadly, if it involves noticeable VM work across platforms I don't think I'm going to get a chance to do anything about it.

If just we could register custom urls (we already have some in the info.plist) on the fly so that you could say "yup, if someone is clicking a timsawesomelicense://PCFET0NUWVBFIGh0bWw+PHRpdGxlPmg8L3RpdGxlPjxwPmhlbGxvLCB3b3JsZDwvcD4K link, fire up squeak and here we go"…

-t

>
> tim