Path: utzoo!attcan!uunet!cme!durer!rowe From: rowe@cme.nist.gov (Walter Rowe) Newsgroups: comp.windows.x Subject: Re: --- fundamental Xlib problem --- Message-ID: Date: 13 Feb 90 14:30:44 GMT References: <2312@uwm.edu> <1250003@hpfcdan.HP.COM> Sender: news@cme.nist.gov Organization: National Institute of Standards and Technology Lines: 48 In-reply-to: garfinke@hpfcda.HP.COM's message of 11 Feb 90 17:10:11 GMT Here is another possible solution for processing until some event has occurred (ie. until the `S' key has been pressed): ====================================================================== SYNTAX Bool XCheckIfEvent(display, event_return, predicate, arg) Display *display; XEvent *event_return; Bool (*predicate)(); char *arg; ARGUMENTS arg Specifies the user-supplied argument that will be passed to the predicate procedure. display Specifies the connection to the X server. event_return Returns either a copy of or the matched event's associated structure. predicate Specifies the procedure that is to be called to determine if the next event in the queue matches what you want. DESCRIPTION When the predicate procedure finds a match, XCheckIfEvent copies the matched event into the client-supplied XEvent structure and returns True. (This event is removed from the queue.) If the predicate procedure finds no match, XCheckI- fEvent returns False, and the output buffer will have been flushed. All earlier events stored in the queue are not discarded. ====================================================================== So, inside your processing loop, add a call to XCheckIfEvent(): while (! XCheckIfEvent (...)) { what_ever_code_goes_here; } I used this for an X-based talk program so you can conference calls with multiple users on multiple displays. I wanted to poll various displays/windows in a round robin fashion looking for input from one user that needed to be distributed that as output to the other users (so they can see what you just typed). -Walter Rowe