Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!think!masscomp!black From: black@masscomp.ccur.com (Sam Black) Newsgroups: comp.windows.x Subject: Re: Folllowup question:MULTIPLE servers Message-ID: <6820@masscomp.ccur.com> Date: 15 Jan 90 21:30:46 GMT References: <287@dino.cs.iastate.edu> Reply-To: black@westford.ccur.com (Sam Black) Organization: Concurrent - Westford, Ma Lines: 84 > Basically, I can't get to call XGetNextEvent(display_1, &event) > for each of the windows (i.e displays) in PARALLEL. There are at least three ways to get around this. If your system supports select, and your server communications mechanism also does (such as sockets), you can do something like: for (;;) { unsigned long mask; mask = ((1 << ConnectionNumber(dpy1)) | (1 << ConnectionNumber(dpy2)) | (1 << ConnectionNumber(dpy3))); if (select(3, &mask, NULL, NULL, NULL) != -1) { if (mask & (1 << ConnectionNumber(dpy1))) { XNextEvent(dpy1, &event) /* process for connection 1 */ } if (mask & (1 << ConnectionNumber(dpy2))) { XNextEvent(dpy2, &event) /* process for connection 2 */ } if (mask & (1 << ConnectionNumber(dpy3))) { XNextEvent(dpy3, &event) /* process for connection 3 */ } } } To stay entirely within the realm of X, you can do something like: for (;;) { if (XPending(dpy1)) { XNextEvent(dpy1, &event) /* process for connection 1 */ } if (XPending(dpy2)) { XNextEvent(dpy2, &event) /* process for connection 2 */ } if (XPending(dpy3)) { XNextEvent(dpy3, &event) /* process for connection 3 */ } } or for (;;) { if (XCheckMaskEvent(dpy1, -1, &event)) { /* process for connection 1 */ } if (XCheckMaskEvent(dpy2, -1, &event)) { /* process for connection 2 */ } if (XCheckMaskEvent(dpy3, -1, &event)) { /* process for connection 3 */ } } -------------------------------------------------------------------------------- I'm pink, therefore I'm Spam. ___________ / ________/__ ...!{decvax,uunet}!masscomp!black /__/_______/ / black@westford.ccur.com Concurrent /__________/ Computer Corporation --------------------------------------------------------------------------------