简体   繁体   中英

XCB function to discard events from client queue (XSync(..., True) equivalent)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM