Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfcda!garfinke From: garfinke@hpfcda.HP.COM (Dan Garfinkel) Newsgroups: comp.windows.x Subject: Re: --- fundamental Xlib problem --- Message-ID: <1250003@hpfcdan.HP.COM> Date: 11 Feb 90 17:10:11 GMT References: <2312@uwm.edu> Organization: Hewlett-Packard, Fort Collins, CO Lines: 27 > I have an Event Gathering Loop which handles the events KeyPress > as well as ButtonPress. I have an application where the user presses > a particular key ( say 'B' ) which starts off execution of a loop. I need > this loop to be executed continuosly untill the user hits another > particular key ( say 'S' ). > > when i hit a 'B' the program starts executing something. > i want this to be continued until i hit 'S' > How do I sense that 'S' was pressed when I am within > the loop ? Here are three options: 1) Put an XPending() call in your Execute loop and break out of your loop to process the events. 2) If you don't want your output to flush (for performance reasons), you could use a combination of the QLength macro and select() yourself to see if there is input pending. 3) Use 2 clients, one which handles input and the other which does output, and send signals (or some other ipc) between them. Hope this helps, Dan Garfinkel, HP