XWindowEvent(display, w, event_mask, event_return)
|| Specifies the connection to the X server.
|| Specifies the window whose events you are interested in.
|| Specifies the event mask.
|| Returns the matched event's associated structure.
function searches the event queue for an event that matches both the specified
window and event mask.
When it finds a match,
removes that event from the queue and copies it into the specified
The other events stored in the queue are not discarded.
If a matching event is not in the queue,
flushes the output buffer and blocks until one is received.
"Selecting Events Using a Window or Event Mask
Christophe Tronche, [email protected]