Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Browsing Event Queue Message-ID: <9009130930.AA10566@Larry.McRCIM.McGill.EDU> Date: 13 Sep 90 09:30:18 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 41 > In one of my applications, a refresh procedure takes a long time to > execute (drawing thousands of segments in a window). While it is > going on, it is possible to resize, or reexpose the window in which > it is drawing, thus making the current state out of date. The > problem is I still have to wait a long time before the refresh > procedure stops and starts again with the new parameters. > I would like to be able to browse through the entire event queue in > my refresh loop and interrupt the refresh loop if an expose or resize > event is in the queue. > - Is there an official way to do what I need (like getting a pointer > to the event queue) ? Have a look at the Xlib functions XCheckMaskEvent, XCheckTypedEvent, XCheckTypedWindowEvent, or XCheckWindowEvent. One or more of those can probably do what you want. If not, there's XCheckIfEvent, which seems like a bit of a sledgehammer but which surely can do it. However, there's another problem: once you have the event, what do you do with it? As far as I can tell there is no way to look for a certain type of event without blocking or removing it from the queue. There are functions to look for events without blocking, and functions to look for events without dequeueing them, but as far as I can see none that do both. This means that since you don't want to block, you're forced to dequeue the event. But then you are stuck with an event that you don't want to process out of sequence, but you can't just drop. Another possibility would be to write your own event dispatch loop (I gather this is fairly straightforward) and then manage your own event queue. It's a bit ugly but it seems to be the cleanest solution available, until/unless Xlib provides some function combining the non-blocking property of the XCheck* calls with the non-dequeueing property of the XPeek* calls. It might be possible to kludge something together with XPutBackEvent, but it would, I fear, be just that: kludged together. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu