Drag-And-Drop Protocol for the X Window System

 

Dropping on the root window

While any program can draw to the root window, it does not seem possible for more than one program to accept drops on the root window. To prepare for this, the program must do the following:

  1. Call XGrabServer() to insure synchronous behavior.
  2. Check for XdndProxy on the root window. If it exists and is valid (Refer to the Technical Details section of the main XDND protocol.), give up because somebody else is already catching root window drops. Otherwise, set XdndProxy to point to your proxy window, and set XdndProxy on your proxy window to point to itself.
  3. Call XUngrabServer().

Note that only applications that implement XDND v4 or later will be able to drop on the root window. In such applications, no special code is required.

When the program no longer wants to accept drops on the root window, simply remove XdndProxy from the root window. One does not need to call XGrabServer() because this is a single operation.

Allowing the source to do the work

Programs may want implement private behaviors when dropping on the root window. To allow for this, an application that accepts drops on the root window should always be willing to accept drops of the special type application/x-rootwindow-drop, along with any other data types that it accepts. The target application should request this type if the source lists it and no other acceptable type is available. In response to a request for this type, the source should send empty data of type NULL to the target (just like for the X Selection target DELETE) and then perform its private actions.

Developed by Owen Taylor [otaylor@redhat.com] at RedHat.

Last updated on May 1, 1999

Back to the main page.