I will not describe the DND internals in detail. Instead, I will give the information necessary for the non-Xt programmers to handle DND drops. I will do that because I don't have time to document the whole thing, sorry. If you want to handle drags you may take a look at the DND code. DND defines two atoms that you must define too. This can be done with the following code:
Atom DndProtocol,DndSelection;
DndProtocol=XInternAtom(display,"DndProtocol",False);
DndSelection=XInternAtom(display,"DndSelection",False);
When a drop occurs, DND will send a client message event to the top level window of the application that receives the drop. The event will have the following data:
Event.xclient.type = ClientMessage;
Event.xclient.message_type = DndProtocol;
Event.xclient.format = 32;
Event.xclient.data.l[0] = DataType;
Event.xclient.data.l[1] = (long)event->xbutton.state;
Event.xclient.data.l[2] = (long)widget;
Event.xclient.data.l[3] = 0;
Event.xclient.data.l[4] = 0;
So your program main event loop will need to intercept this message and take
the appropriate action. Normally, this action consists in getting the drop data
and processing it. This can be done by getting the DndSelection
property
contents of the root window.
Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter