peek_event(-Type, ?XEvent)
     peek_event(+Displayable, -Type, ?XEvent)

Peek at the next event from the given Displayable event queue. If Displayable is omitted, the next event on any ProXL display is examined. Type is unified to the type of event. The event is not removed from the head of the queue.

If there are no events in the queue, peek_event/[2,3] flushes the output queue(s) and blocks until an event is received. If Displayable is specified, and events for which callbacks are registered arrive on other displays, they will be handled, and peek_event/3 will continue to wait for an event on the specified Displayable.

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, peek_event/[2,3] will unify XEvent with a prvate, local structure, which the user can not hang on to, but is guaranteed not to change its value until the next call to peek_event/[2,3].