Selections
The X Window System supports an arbitrary number of selections; every selection is identified by a string (more precisely, an atom
). The most used selection is the PRIMARY
selection.
The following requests are specific to selection transfer, although transfer also involves other requests:
- request to know which window owns the selection
- request to set the window that owns the selection
- request to convert the selection
The owner of the selection is typically the window in which the selected text is located, if any. When the user selects some text in a window, the client handling the window must tell the server that the window is the owner of the selection.
When the user tries to paste the selection into another window, that window's handler initiates a protocol for getting the selected text from the other client. This protocol involves the second and third requests of the list above, and is not specified by the X protocol but as a convention in the Inter-Client Communication Convention Manual (ICCCM).
In particular, the destination client begins by asking the server which window owns the selection. Then the two clients transfer the selection via the server. This exchange involves a property of a window, an arbitrary piece of data attached to the window. If the content of the selection is considered small enough to be transferred all at once, the steps that take place are:
- the recipient of the selection requests the selection to be converted, specifying a property of a window (this may be the window where the text has to be pasted)
- in response, the server sends to the current owner of the selection a
SelectionRequest
event; - the owner places the selected text in the property of the window that the requestor has specified by sending a
ChangeProperty
; request to the server - the owner sends a request to the server to send the requester a
SelectionNotify
to notify that the selection has been transferred - the requester can now read the selection in the property of the window by sending one or more
GetProperty
requests to the server; - the requester destroys the property; if the owner has requested to be informed of this, it is sent a
PropertyNotify
event.
If the content is large, it should be transferred in chunks. In this case, both clients express interest in PropertyNotify
events: this way, the selection owner knows when the selection has been read, and the requester knows when another chunk has been placed in the property.
Read more about this topic: X Window Selection
Famous quotes containing the word selections:
“For character, to prepare for the inevitable I recommend selections from [Ralph Waldo] Emerson. His writings have done for me far more than all other reading.”
—Rutherford Birchard Hayes (18221893)
“Artists, whatever their medium, make selections from the abounding materials of life, and organize these selections into works that are under the control of the artist.... In relation to the inclusiveness and literally endless intricacy of life, art is arbitrary, symbolic and abstracted. That is its value and the source of its own kind of order and coherence.”
—Jane Jacobs (b. 1916)
“Between ourselves and our real natures we interpose that wax figure of idealizations and selections which we call our character.”
—Walter Lippmann (18891974)