window_event(+Window, +EventMask, -Type, ?XEvent)
Searches the event queue for the Window's Display, and removes the first event that is intended for Window and is selected by the given EventMask. Unifies Type with the type of event removed. Other events in the queue are not discarded.
If there is no qualifying event in the queue,
flushes the output queue and blocks until one is received. If events
for which callbacks are registered arrive on other displays, they will
be handled, and
window_event/4 will continue to wait for an
event on Window's display.
The user can pass an existing XEvent X11 structure, which is
then destructively filled with the received event's contents, or an
unbound variable. In the latter case,
unify XEvent with a private, local structure, which the user can
not hang on to, but is guaranteed not to change its value until the
next call to an event getting routine.
EventMask is an integer bitmask, that specifies the selected
events. The predicate
event_list_mask/2 is useful to
translate between X11 event mask names and bitmasks.