In Xlib, there is XSync
, which, to my understanding, will (among other effects) discard all events currently in the client's event queue if the discard
argument is True
.
Is there an equivalent function in XCB?
I've found xcb_aux_sync
mentioned as such an equivalent, but I'm not sure how accurate this is and whether it applies to all events: Its definition seems to corroborate that it's "equivalent to calling XGetInputFocus()
and throwing away the reply" as mentioned in the previous source, but XGetInputFocus
's manpage only mentions discarding keyboard events, not all events in the queue across the board.
CodePudding user response:
discard all events currently in the client's event queue
You can ask libxcb for the next queued event and just delete that. Repeat in a loop until the queue is empty.
xcb_generic_event_t *event;
do {
event = xcb_poll_for_queued_event(c);
free(event);
} while (event != NULL);
I am not sure what exactly XSync
is doing, but the above at least should answer this one part of your question.