check_typed_window_event(+Window, +Type, ?XEvent)

Succeeds only if there is an event in the event queue for the Window's Display, that is intended for Window and is of the given Type. Other events in the queue are not discarded. If there is no matching event in the queue, it fails and does not block waiting for events. 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_typed_window_event/3 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.