[comp.windows.x] XLib, XPeekIfEvent, etc.

bradley@grip.cis.upenn.edu (John Bradley) (07/07/90)

I've recently come across what would (at first, and for that matter, second
glance) seem to be an omission in XLib.

What I want to do is this:  When I get an ExposeEvent, I'd like to nose
around in the event queue to see if there's an ConfigureEvent's for that
window.  If there are, I don't want to draw anything, since it'll have to be
redrawn once the window changes shape ANYWAY.  

As far as I can tell, there's no good way to do this.  XPeekIfEvent() almost
does what I'd want, but if it doesn't find the event I'm looking for, it blocks
until one comes in.  Undesirable.

XCheckTypedWindowEvent() tells me whether the event is out there in the queue,
but it unfortunately removes it if it exists.  This is also undesirable, in
that the best I (think I) can do is XPutBackEvent().  Unfortunately, this puts
the (ConfigureNotify) event that was found back on the head of the queue, 
which doesn't help me get rid of the unwanted Expose events...

Any thoughts?  It seems like 'XPeekIfEventWithoutBlocking()' (or, alternately,
'XPeekTypedWindowEvent()') would be a perfectly reasonable thing to want to
do, and there doesn't seem to be a way of doing it without doing all sorts
of gruesome things.  (Such as manually reading in the entire event queue, 
manipulating it locally, and 'XPutBackEvent'-ing it back in reverse order, or
Some Damn Thing...)

John Bradley  -  Graphics Weenie  -  University of Pennsylvania