, cut buffers
, and drag-and-drop
are the mechanisms used in the X Window System
to allow a user
to transfer data from a window
to another. Selections
and cut buffer are typically used when a user selects text or some other data in a window and pastes in another one. Drag-and-drop is used when a user selects something in a window, then clicks on the selection and drags it into another window.
Since the two windows may be handled by two different applications, these mechanisms require two different clients connected with the same X server to exchange data. The X Window core protocol
includes some requests and events that are specific to selection exchange, but the transfer is mainly done using event sending and window properties, which are not specific to selection transfer.
Different types of data can be transferred: it is usually text, but can also be an image, a number, a list of objects, etc. In the following, only the case of text is considered.
Active and passive selections
The methods for transferring data can be classified into active and passive, depending on whether the client handling the selected data has to actively participate in the transfer to a client requesting it:
- Passive: when some data is selected, the client handling the window where this selection is done transfers it somewhere, and needs not to care about it any longer;
- Active: transfer of data to a client requires the client "holding" the selection to actively participate in the......