XPutBackEvent() - put events back on the queue
XPutBackEvent (Display *display, XEvent *event)
The XPutBackEvent(3) function pushes an event back onto the head of the display's event queue by copying the event into the queue. This can be useful if you read an event and then decide that you would rather deal with it later. There is no limit to the number of times in succession that you can call XPutBackEvent(3).
XIfEvent()
Xlib