matthiasm wrote:

> 
> On 30.12.2007, at 13:11, Alvin wrote:
> 
>>  Is the problem that the DND operation is done since the mouse button
>> isn't being held down?
> 
> 
> Yes, the screen manager thiks that this is an invalid DND operation
> because the mouse button is not held down.
> 
> ----
> http://robowerk.com/

After looking into Fl::dnd() in fl_dnd_x.cxx, I figured it was something
like that. I tried to cheat and inject the event using Fl::add_check()
which simply did Fl::pushed(dnd_box). Where dnd_box is my widget that does
all the DND event handling. That didn't work. So the dnd_box widget simply
provides DND receiving capability.

I wrote a DND test app that allows one to drag an image file onto a Fl_Box.
The DND widget then calls its callback which in turns uses Fl_Shared_Image
to load the image and apply it to the Fl_Box. I was successfull at dragging
the image off the box onto a konqueror window by calling Fl::dnd() when the
FL_DRAG event was seen (The image path was copied to the selection buffer
using Fl::copy()).

I gave it more thought and I don't think I can do DND sending without doing
it within the same FLTK app, atleast not for what I am trying to do anyway.

The DND test app works great if the file path is prefixed with a protocol
(file://, http://, smb://) that is known to the receiver. That's where my
problem begins. I'm trying to drag files off of a MP3 player that uses MTP
(libmtp). Konqueror, and I figure Nautilus too, know nothing about MTP. So,
the mtp app I wrote will need to download the file from the device before
calling Fl::dnd(). But, Fl::dnd() can only be called during a FL_DRAG which
would result in a very complicated synchronisation and error handling
solution.

I think what I'm going to do is stick with the user right-clicking on the
table rows (the files) and selecting "Download file(s)". Perhaps in the
future I will integrate a file browser plane into the app. This way the
drag and drop will only occur within the fltk app which I think is easy to
implement.

Thanks for you assistance.

-- 
Alvin
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to