Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!VAX1.CC.UAKRON.EDU!mcs.kent.edu!usenet.ins.cwru.edu!eagle!data.nas.nasa.gov!sun418!truesdel From: truesdel@nas.nasa.gov (David A. Truesdell) Newsgroups: comp.windows.x Subject: Re: How Do You Monitor Events For More Than 1 Display? Message-ID: Date: 3 Dec 90 10:44:02 GMT References: <9401@pasteur.Berkeley.EDU> Sender: news@nas.nasa.gov Organization: NAS Program, NASA Ames Research Center, Moffett Field, CA Lines: 30 achoi@cory.Berkeley.EDU (Andrew Choi) writes: >I am writing this program which is supposed to wait for KeyPress >events from more than 1 display, however, after thinking about >it for a long long time, I don't really know how to do it. >Please enlighten me. >To be more concrete, here's what I will do if I only have 1 >display: > for (;;) { > XNextEvent(display, &event); > } >However, how do you achieve the same thing for multiple displays? >I don't want to do a wait on all the displays, I want it to return >when there is at least 1 display which has the event available. If you are running on a system which supports select(2), you can use it and ConnectionNumber() to monitor multiple displays. An example of how to do this is in "Introduction to the X Window System" by Oliver Jones. (Not an endorsement, I just happen to have it laying on my desk.) -- T.T.F.N., dave truesdell (truesdel@prandtl.nas.nasa.gov) "Courage is the willingness of a person to stand up for his beliefs in the face of great odds. Chutzpah is doing the same thing wearing a Mickey Mouse hat."