I have a program that has the following basic structure:
while( true )
{
// get any X11 events
while( XPending( display ) > 0 )
{
// get an event using XNextEvent and do stuff with it
}
// draw to the display
}
The program is rendering an opengl scene. The problem I am having is that when I click and start dragging on the window, the XPending
call get blocks until i finish the drag sequence, thus halting any animations that were in progress. I can solve this solution by having another thread send Expose
events and thus waking up the XPending
call, but ideally I would like to have an X function that checks for events but does not block at all.
If you just want to process received events without blocking to wait for more, use XEventsQueued(display, QueuedAlready)
instead of XPending(display)
.