mask_event(+EventMask, -Type, ?XEvent)
     mask_event(+Displayable, +EventMask, -Type, ?XEvent)

Search the event queue for the given Displayable and remove the first event that is selected by the given EventMask. If Displayable is omitted, the queues for all ProXL displays are searched. 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, mask_event/[3,4] flushes the output queue and blocks until one is received. If Displayable is specified, and events for which callbacks are registered arrive on other displays, they will be handled, and mask_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, mask_event/[3,4] will 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.