Jonathan Walther <[EMAIL PROTECTED]> writes:

> For reasons to do with a user interface element I'm working on,
> I need something like select.  Do the XCheck*Event() functions
> block?  I'm really reluctant to use pthreads, as this isn't portable
> enough for what I'm trying to do.
> 
> Specifically, if the app is in a certain state, I want to update the
> window every 1/32 of a second, but I need to keep processing events too.
> If XCheckWindowEvent() doesn't block, and is reasonably quick, it will
> do perfectly.  Does it?

The standard way of doing a non-blocking check is

 if (XPending (display))
   {
     XNextEvent (display, &event);
   }

Using any of the XCheck*Event functions can be relatively slow, since
they need to search the entire queue. (If you had to use one, I'd
suggest using XCheckIfEvent with an appropriate predicate. But XPending()
should be as good or better.)

Of course, what real toolkits do is select() on ConnectionNumber(display)
to know when they need to call XPending() without having to poll 
continuously.

Regards,
                                        Owen
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to