XFlush, XSync, XEventsQueued, XPending − handle output buffer or event queue


int XFlush(Display *display);

int XSync(Display *display, Bool discard);

int XEventsQueued(Display *display, int mode);

int XPending(Display *display);



Specifies a Boolean value that indicates whether XSync discards all events on the event queue.


Specifies the connection to the X server.


Specifies the mode. You can pass QueuedAlready, QueuedAfterFlush, or QueuedAfterReading.


The 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 XPending, XNextEvent, and XWindowEvent. Events generated by the server may be enqueued into the library’s event queue.

The 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, 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 False, XSync does not discard the events in the queue. If you passed True, XSync discards all events in the queue, including those events that were on the queue before XSync was called. Client applications seldom need to call XSync.

If mode is QueuedAlready, XEventsQueued returns the number of events already in the event queue (and never performs a system call). If mode is QueuedAfterFlush, XEventsQueued returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, XEventsQueued flushes the output buffer, attempts to read more events out of the application’s connection, and returns the number read. If mode is QueuedAfterReading, XEventsQueued returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, XEventsQueued attempts to read more events out of the application’s connection without flushing the output buffer and returns the number read.

XEventsQueued always returns immediately without I/O if there are events already in the queue. XEventsQueued with mode QueuedAfterFlush is identical in behavior to XPending. XEventsQueued with mode QueuedAlready is identical to the XQLength function.

The XPending function returns the number of events that have been received from the X server but have not been removed from the event queue. XPending is identical to XEventsQueued with the mode QueuedAfterFlush specified.


AllPlanes(3), XIfEvent(3), XNextEvent(3), XPutBackEvent(3)
Xlib − C Language X Interface

More Linux Commands

XcmsStoreColors(3) - set colors (Library - Linux man page)
The XcmsStoreColor function converts the color specified in the XcmsColor structure into RGB values. It then uses this RGB specification in an XColor structure,

url(7) - uniform resource identifier (URI), including a URL
A Uniform Resource Identifier (URI) is a short string of characters identifying an abstract or physical resource (for example, a web page). A Uniform Resource L

Tcl_GetPathType(3) - manipulate platform-dependent file path
These procedures have been superceded by the objectified procedures in the FileSystem man page, which are more efficient. These procedures may be used to disass

ldap_result2error(3) - LDAP protocol error handling routines
The ldap_err2string() routine provides short description of the various codes returned by routines in this library. The returned string is a pointer to a static

acl_error(3) - convert an ACL error code to a text message
The acl_error() function converts an ACL error code such as returned by the acl_check() function to a text message describing the error condition. In the POSIX

Mail::SpamAssassin::DnsResolver(3pm) - DNS resolution engine
This is a DNS resolution engine for SpamAssassin, implemented in order to reduce file descriptor usage by Net::DNS and avoid a response collision bug in that mo

updateinfoxml2solv(1) convert rpmmd's updateinfo.xml format
The updateinfoxml2solv tool reads rpm-mds updateinfo xml data from stdin, and writes it as solv file to standard output. Update elements are converted into spec

shutdown_mib(3) - netsnmp_mib_api functions - Linux man page
The functions dealing with MIB modules fall into four groups - those dealing with initialisation and shutdown, with reading in and parsing MIB files, with searc

git-filter-branch(1) - Rewrite branches - Linux manual page
Lets you rewrite Git revision history by rewriting the branches mentioned in the <rev-list options>, applying custom filters on each revision. Those filters can

amixer(1) - command-line mixer for ALSA soundcard driver....
amixer allows command-line control of the mixer for the ALSA soundcard driver. amixer supports multiple soundcards. amixer with no arguments will display the cu

XrmCombineFileDatabase(3) - merge resource databases........
Calling the XrmMergeDatabases function is equivalent to calling the XrmCombineDatabase function with an override argument of True. The XrmCombineDatabase functi

XRRSetScreenConfigAndRate(3) - X Resize, Rotate and Reflecti
Xrandr is a simple library designed to interface the X Resize and Rotate Extension. This allows clients to change the size and rotation of the root window of a

We can't live, work or learn in freedom unless the software we use is free.