Xlib - Protocol and Events

Protocol and Events

The Xlib functions that send requests to the server usually do not send these requests immediately but store them in a buffer, called the request buffer. The term request in this case refers to the request from the client that is directed to the server: the request buffer can contain all kinds of requests to the server, not only those having a visible effect on the screen. The request buffer is guaranteed to be flushed (i.e., all requests done so far are sent to the server) after a call to the functions XSync or XFlush, after a call to a function that returns a value from the server (these functions block until the answer is received), and in some other conditions.

Xlib stores the received events in a queue. The client application can inspect and retrieve events from the queue. While the X server sends events asynchronously, applications using the Xlib library are required to explicitly call Xlib functions for accessing the events in the queue. Some of these functions may block; in this case, they also flush the request buffer.

Errors are instead received and treated asynchronously: the application can provide an error handler that will be called whenever an error message from the server is received.

The content of a window is not guaranteed to be preserved if the window or one of its parts are made not visible. In this case, the application are sent an Expose event when the window of one part of it is made visible again. The application is then supposed to draw the window content again.

Read more about this topic:  Xlib

Famous quotes containing the word events:

    I have no time to read newspapers. If you chance to live and move and have your being in that thin stratum in which the events which make the news transpire—thinner than the paper on which it is printed—then these things will fill the world for you; but if you soar above or dive below that plane, you cannot remember nor be reminded of them.
    Henry David Thoreau (1817–1862)