[Lazarus] GTK2: Drag files to other applications (to the file manager, Thunar, Nautilus, etc)
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu Aug 23 17:46:02 CEST 2012
On 22 August 2012 14:49, Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
> The protocol for all these operations is platform specific, and not based on
> window handles on platforms which don't have such handles.
>
> The RTL can ask the Application object to handle DND related events, e.g. by
> generating the according messages, if not already done by the OS.
Then it's just amazing how toolkits like fpGUI and Qt managed to
implement cross-platform drag-n-drop by giving the toolkit users a
single DND API to work with - completely hiding the complexities of
each platform. Wow, we must be good at what we do. ;-)
Oh, and Qt moved in v4.4 to a single handle per window design, thus no
widget has its own window handle any more. They also openly admitted
that they had to do a lot of "fake window handle" trickery to get DND
to continue working on platforms like Windows - which require window
handles for DND to work.
"A somewhat funny scenario is drag’n'drop on Windows which is based on
Object Linking and Embedding (OLE). Every drag’n'drop operation
consists of at least two COM objects representing the source and the
target. A widget acting as a drop target must register its window
handle such that Windows can communicate between the source and the
target. It’s not hard to imagine that some black magic is needed when
the top-level window is the only native window we have, possibly
acting as source and target at the same time."
--- http://labs.qt.nokia.com/2007/08/09/qt-invaded-by-aliens-the-end-of-all-flicker/
But please don't let that deter you from submitting a fully working
x-platform DND implementation without window handles to the FPC
project. I'm sure everybody would welcome such a contribution, and I
would love to study your implementation.
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
More information about the Lazarus
mailing list