XDND is one of the many drag and drop
protocols used in X Window System
It is relatively widely supported in the new applications; For example, GTK+, Qt, WindowMaker, Mozilla and GNOME support it.
Here's an example of how it works, shortened version of the example that's in the home page:
- Windows that support XDnD have property XdndAware.
- When drag begins, the source takes ownership of XdndSelection. When mouse enters XdndAware window, the source sends an XdndEnter ClientMessage to the window. This has the protocol version number.
- Target receives the XdndEnter.
- Source sends XdndPosition ClientMessage (position of the mouse, type of the action).
- Target receives XdndPosition, figures out where the data has been dropped to, and decides whether or not to accept it.
- Target sends XdndStatus to source, telling in it whether or not it accepted it and what it decided to do with it.
- Source receives XdndStatus.
- If the mouse leaves the window or something similiarly silly happens, source sends XdndLeave ClientMessage.
- Target receives XdndLeave, frees data and forgets that the whole thing happened. (Yes, that's how the web page phrases it =)
The same call, XConvertSelection(), can be used to process both Clipboard and XDnD, while from user point of view, using XDnD won't mess up the X selections. Cool, huh? =) Also, XDnD ignores old protocol versions; this probably makes it safer against malfunctioning programs.
Currently, the home page is here: