Class X11Drag

java.lang.Object
limn.backend.lwjgl.transfer.X11Drag

public final class X11Drag extends Object
The system's drag and drop on X11, which is the XDND protocol (version 5): client messages between a source and the window under the pointer, and the XdndSelection to hand the data over. It is spoken on the clipboard's connection, by the clipboard's thread.

As a destination. GLFW's window already answers XDND, for files and at the drop alone, on a connection this class cannot read. Each window is therefore given an XdndProxy: sources send what was meant for it to the clipboard's own hidden window, where it is answered here for every kind of data and while the pointer hovers. The answer is asked of the UI thread and sent when it comes; nothing waits on anything. A source that goes round the proxy after its first position, to talk to GLFW's window itself, is followed by reading the pointer (X11DragFollow); while a drag is over a window of ours the thread turns sixty times a second for it.

As a source. X has no drag of its own to hand a session to: the source follows the pointer itself. While a drag of ours lasts the thread asks the server where the pointer is sixty times a second, finds the window under it that speaks XDND, and tells it; the button let go is the drop, and Escape calls it off. Our own windows are told the same way as any other program's, through the server.

  • Method Details

    • register

      public WindowDrag register(long xwindow, Supplier<WindowInput> input, DoubleUnaryOperator toLogical, Runnable ownPointer)
      Makes a window a source and a destination of the system's drags. UI thread.
      Parameters:
      xwindow - the window's X id
      input - the window's input, as it is at the time of each call; may answer null
      toLogical - from the server's pixels to the window's logical points
      ownPointer - puts the window's own pointer shape back, on the UI thread, after a drag that began in it changed the shape to say what a target answered
      Returns:
      the window's drag