Drag and Drop
*************

WARNING: the Drag'n'Drop API is still under development and the interface may change! The current implementation is considered experimental.

Drag'n'drop is a way to transfer information between multiple applications. To do this several GUIs define their own protocols. Examples are OffiX, CDE, Motif, KDE, MSWindows, GNOME, and many more. To catch all these protocols, XEmacs provides a generic API.

One prime idea behind the API is to use a data interface that is transparent for all systems. The author thinks that this is best archived by using URL and MIME data, cause any internet enabled system must support these for email already. XEmacs also already provides powerful interfaces to support these types of data (tm and w3).

Supported Protocols
===================

The current release of XEmacs only support a small set of Drag'n'drop protocols. Some of these only support limited options available in the API.

OffiX DND
---------

WARNING: If you compile in OffiX, you may not be able to use multiple X displays successfully.  If the two servers are from different vendors, the results may be unpredictable.

The OffiX Drag'n'Drop protocol is part of a X API/Widget library created by Cesar Crusius. It is based on X-Atoms and ClientMessage events, and works with any X platform supporting them.

OffiX is supported if 'offix is member of the variable dragdrop-protocols, or the feature 'offix is defined.

Unfortunately it uses it's own data types. Examples are: File, Files, Exe, Link, URL, MIME. The API tries to choose the right type for the data that is dragged from XEmacs (well, not yet...).

XEmacs supports both MIME and URL drags and drops using this API. No application interaction is possible while dragging is in progress.

For information about the OffiX project have a look at http://leb.net/~offix/

CDE dt
------

CDE stands for Common Desktop Environment. It is based on the Motif widget library. It's drag'n'drop protocol is also an abstraction of the Motif protocol (so it might be possible, that XEmacs will also support the Motif protocol soon).

CDE has three different types: file, buffer, and text. XEmacs only uses file and buffer drags. The API will disallow full URL drags, only file method URLs are passed through.

Buffer drags are always converted to plain text.

MSWindows OLE
-------------

Only allows file drags and drops.

Loose ends
----------

The following protocols will be supported soon: Xdnd, Motif, Xde (if I get some specs), KDE OffiX (if KDE can find XEmacs windows).

In particular Xdnd will be one of the protocols that can benefit from the XEmacs API, cause it also uses MIME types to encode dragged data.

Drop Interface
==============

For each activated low-level protocol, a internal routine will catch incoming drops and convert them to a dragdrop-drop type misc-user-event.

This misc-user-event has its function argument set to dragdrop-drop-dispatch and the object contains the data of the drop (converted to URL/MIME specific data). This function will search the variable experimental-dragdrop-drop-functions for a function that can handle the dropped data.

To modify the drop behavior, the user can modify the variable experimental-dragdrop-drop-functions. Each element of this list specifies a possible handler for dropped data. The first one that can handle the data will return t and exit. Another possibility is to set a extent-property with the same name. Extents are checked prior to the variable.

The customization group drag-n-drop shows all variables of user interest.

Drag Interface
==============

This describes the drag API (not implemented yet).