next_event/[2,3]

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

Return the next event from the given Displayable event queue. If Displayable is omitted, the next event on any ProXL display is returned. Type is unified to the type of event, and the event is removed from the head of the queue.

If there are no events in the queue, next_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 next_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, next_event/[2,3] will unify XEvent with a private, local structure, which the user cannot hang on to, but is guaranteed not to change its value until the next call to an event getting routine.