check_typed_event(+Type, ?XEvent)
     check_typed_event(+Displayable, +Type, ?XEvent)

Succeed only if there is an event of the given Type in the event queue for the given Displayable, which if omitted, is the default Display. Other events in the queue are not discarded. If there is no matching event in the queue, they fail, and do 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_event/[2,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.