1. NAME▲
XFlush, XSync, XEventsQueued, XPending - handle output buffer or event queue
2. SYNTAX ▲
int XFlush(Display *display); int XSync(Display *display, Bool discard); int XEventsQueued(Display *display, int mode); int XPending(Display *display);
3. ARGUMENTS ▲
discard 1i Specifies a Boolean value that indicates whether .ZN XSync discards all events on the event queue.
display 1i Specifies the connection to the X server.
mode 1i Specifies the mode. You can pass .ZN QueuedAlready , .ZN QueuedAfterFlush , or .ZN QueuedAfterReading .
4. DESCRIPTION ▲
The .ZN XFlush function flushes the output buffer. Most client applications need not use this function because the output buffer is automatically flushed as needed by calls to .ZN XPending , .ZN XNextEvent , and .ZN XWindowEvent . Events generated by the server may be enqueued into the library's event queue.
The .ZN XSync function flushes the output buffer and then waits until all requests have been received and processed by the X server. Any errors generated must be handled by the error handler. For each protocol error received by Xlib, .ZN XSync calls the client application's error handling routine (see section 11.8.2). Any events generated by the server are enqueued into the library's event queue.
Finally, if you passed .ZN False , .ZN XSync does not discard the events in the queue. If you passed .ZN True , .ZN XSync discards all events in the queue, including those events that were on the queue before .ZN XSync was called. Client applications seldom need to call .ZN XSync .
If mode is .ZN QueuedAlready , .ZN XEventsQueued returns the number of events already in the event queue (and never performs a system call). If mode is .ZN QueuedAfterFlush , .ZN XEventsQueued returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, .ZN XEventsQueued flushes the output buffer, attempts to read more events out of the application's connection, and returns the number read. If mode is .ZN QueuedAfterReading , .ZN XEventsQueued returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, .ZN XEventsQueued attempts to read more events out of the application's connection without flushing the output buffer and returns the number read.
.ZN XEventsQueued always returns immediately without I/O if there are events already in the queue. .ZN XEventsQueued with mode .ZN QueuedAfterFlush is identical in behavior to .ZN XPending . .ZN XEventsQueued with mode .ZN QueuedAlready is identical to the .ZN XQLength function.
The .ZN XPending function returns the number of events that have been received from the X server but have not been removed from the event queue. .ZN XPending is identical to .ZN XEventsQueued with the mode .ZN QueuedAfterFlush specified.
5. SEE ALSO ▲
AllPlanes(3), XIfEvent(3), XNextEvent(3), XPutBackEvent(3)
\*(xL