12.4.5 Giving Up Selection Ownership
When some other client becomes the owner of a particular selection, the previous owner receives a SelectionClear event. The XSelectionClearEvent structure is shown in Example 12-11.
Example 12-11. The XSelectionClearEvent structure
typedef struct { int type; unsigned long serial; /* # of last request processed by
* server */
Bool send_event; /* True if from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom selection; ; Time time; } XSelectionClearEvent;
The time member is the time at which the ownership changed hands, and the owner member is the window the new owner specified in its XSetSelectionOwner ( ) request.
If an owner loses ownership while it has a transfer in progress, that is to say before it receives notification that the requestor has received all the data, it must continue to service the ongoing transfer to completion.
To relinquish ownership of a selection voluntarily, a client should execute a XSet-Selection0wner( ) call for that selection atom, with owner specified as None and time specified as CurrentTime. Alternatively, the client may destroy the window used as the owner argument of the XSetSelectionOwner() call, or it may exit. In both cases, the ownership of the selection involved will revert to None.
12.4.6 Requesting a Selection
A client wishing to obtain the value of a selection in a particular form issues an XConvertSelection( ) call. The arguments of the call are three atoms, a window, and the time. The first atom is the selection, usually xa_primary. the second atom is the target type, the type in which the requestor wants the data. The conventions will specify a standard list of target type atoms. The third atom specifies the property that the owner should set to the converted data. The window argument is the window on which the property containing the data is to be set. The time member should be set to the timestamp on the event triggering the request for the selection value. Note that the requestor of a selection does not need to know the owner of the selection or the window it specified in the XSetSelection-Owner( ) call.
The client that calls XConvertSelection( ) call will get a SelectionNotify event sent to it from the selection owner. The requestor, selection, time, and target arguments of this event will be the same as those on the XConvert-Selection( ) request.
Interclient Communication