check_window_event(+Window, +EventMask, -Type, ?XEvent)

Is like, window_event/4, but fails if there is no matching event in the queue, and does not block waiting for one. The output buffer is flushed only on failure.

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, check_window_event/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.