XNextEvent
XNextEvent is a function in the X Window System that retrieves the next event from a connection's event queue. It is a fundamental part of how X clients interact with the X server. When an X client wants to know if any events have occurred, such as a key press, mouse movement, or window exposure, it calls XNextEvent.
The function blocks until an event is available. Once an event is received, XNextEvent copies it into
Common event types include KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify, Expose, ConfigureNotify, and ClientMessage. Applications typically use
XNextEvent is a synchronous function, meaning the program will halt execution at this point until an event