XFlush(3)
XFlush(3) π
okay bestie, welcome to the XLIB FUNCTIONS page for XFlush, XSync, XEventsQueued, and XPending β the little crew that handles your output buffer and event queue. no cap, they're lowkey important. π«Ά
πΈ NAME πΈ
XFlush, XSync, XEventsQueued, XPending β handle output buffer or event queue. that's the whole vibe. β¨
β¨ SYNTAX β¨
int XFlush(Display *display);
int XSync(Display *display, Bool discard);
int XEventsQueued(Display *display, int mode);
int XPending(Display *display);
π ARGUMENTS π
discardβ a Boolean value that tellsXSyncwhether it should discard all events on the event queue. yes, all of them. πdisplayβ the connection to the X server. your main character link. πmodeβ the mode. you can passQueuedAlready,QueuedAfterFlush, orQueuedAfterReading. choose wisely, bestie. π
π DESCRIPTION π
okay so first up, XFlush flushes the output buffer. most client applications do not need to call this function, because the output buffer gets 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. cute, right? π¦
XSync 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. so far so good. β¨
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. noted. π
now for XEventsQueued, it's giving mode-dependent behavior:
- if
modeisQueuedAlready,XEventsQueuedreturns the number of events already in the event queue β and it never performs a system call. periodt. - if
modeisQueuedAfterFlush,XEventsQueuedreturns the number of events already in the queue if that number is nonzero. if there are no events in the queue,XEventsQueuedflushes the output buffer, attempts to read more events out of the application's connection, and returns the number read. - if
modeisQueuedAfterReading,XEventsQueuedreturns the number of events already in the queue if that number is nonzero. if there are no events in the queue,XEventsQueuedattempts 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. iykyk. π
and XPending 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. slay. π
π¦ SEE ALSO π¦
AllPlanes(3)XIfEvent(3)XNextEvent(3)XPutBackEvent(3)Xlib - C Language X Interface
that's the whole page, bestie π it's rockin' X Version 11 / libX11 1.8.14 energy, and we're out. π«Άβ¨
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms