16.6 Using Cut Buffers

Xlib provides functions to manipulate cut buffers, a very simple form of cut and paste inter-client communication. Selections are a much more powerful and useful mechanism for interchanging data between clients (see "Selections"), and generally should be used instead of cut buffers.

Cut buffers are implemented as properties on the first root window of the display. The buffers can only contain text, in the STRING encoding. The text encoding is not changed by Xlib when fetching or storing. Eight buffers are provided and can be accessed as a ring or as explicit buffers (numbered 0 through 7).

To store data in cut buffer 0, use XStoreBytes().

To store data in a specified cut buffer, use XStoreBuffer().

To return data from cut buffer 0, use XFetchBytes().

To return data from a specified cut buffer, use XFetchBuffer().

To rotate the cut buffers, use XRotateBuffers().

Next: Determining the Appropriate Visual Type

Christophe Tronche, ch@tronche.com