Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!EXPO.LCS.MIT.EDU!rws From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler) Newsgroups: comp.windows.x Subject: Re: Browsing Event Queue Message-ID: <9009132329.AA27408@expire.lcs.mit.edu> Date: 13 Sep 90 23:29:50 GMT References: <142429@sun.Eng.Sun.COM> Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 18 This seems like another of those frequently asked questions. All it takes is a little imagination. 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. Use XCheckIfEvent. Have your predicate *always* return False. Maintain the *real* boolean result (or whatever other result you want) in the private data argument that you pass in. If you're sensible, write a nice wrapper function that hides this trick, so that the wrapper function has a reasonable interface. Call the function Xmu, and send it back to us. :-) Call it ugly, call it a kludge, but it works and it's portable. Yes, it means you always walk all the way through the event queue, but the queue shouldn't normally be that long, and quick return from your predicate once you've found an event of interest shouldn't cost very much.