Is there a good book or something on practical programming in X11? I have the O'Reilly X window system book set. They don't seem to cover the nuances very well (at least for me). So far the only thing I find on the web is the text from these books.
Specifically, I'm looking for optimization techniques and internal differences in the event checking functions. I have an application drawing many bitmaps and want to allow the drawing to be interrupted. I've found that checking for the interrupts can increase display times by 30-50%. Moving the checks to a thread helps, but then I lose button events entirely, and configure events only come when the drawing is complete for some reason. I'll probably end up with moving the draw operations to a thread and just run event checking in the main thread. But I'd still like to really understand why things are happening the way they are.
I try and avoid threads with Xwindows programming.
One solution is to use XExposeEvents to accumulate invalidated rectangles into a region, then when the count hits zero, schedule a work proc to some some drawing. In the work proc do a small amount of drawing covering only the invalidated region, then remove what you have painted from that region. Then if the region is not empty, schedule another work proc.
Alternatively use one of the XtAppPending family of functions to see if there any any incoming messages, if not then continue with a small amout of drawing. As above, restrict yourself to only parts that have been indicated by an XExposeEvent.
Thanks for the pointers. The architecture isn't set up very good for expose events right now. But I've been thinking about somthing like this. (There can be 100's of millions of polygons to draw. Rearchitecting is coming...) The XtAppPending sounds interesting. I'll start there.