events_queued/[2,3]

     events_queued(+Mode, -Number)
     events_queued(+Displayable, +Mode, -Number)
     

Unify Number with an integer giving the number of events queued for the given Displayable, which if omitted, is the default Display.

If there are currently any events in Xlib's queue, the predicate returns immediately, unifying Number, regardless of the value of Mode. Otherwise, it behaves according to the value of Mode:


already
Binds Number to 0 and succeeds.
after_reading
Attempts to read more events from the Display connection to the X server, without flushing the output buffer, and unifies Number to the number of events read.
after_flushing
Like after_reading, but also flushes the output buffer.