stop waiting for events in queue

This commit is contained in:
Julien Danjou 2008-01-24 19:14:49 +01:00
parent 2ac27fdac4
commit a57d81237a
1 changed files with 25 additions and 16 deletions

View File

@ -389,7 +389,15 @@ main(int argc, char *argv[])
buf[r] = '\0'; buf[r] = '\0';
parse_control(buf); parse_control(buf);
} }
/* two level XPending:
* we need to first check we have XEvent to handle
* and if so, we handle them all in a round.
* Then when we have refresh()'ed stuff so maybe new XEvent
* are available and select() won't tell us, so let's check
* with XPending() again.
*/
while(XPending(dpy))
{
while(XPending(dpy)) while(XPending(dpy))
{ {
XNextEvent(dpy, &ev); XNextEvent(dpy, &ev);
@ -415,6 +423,7 @@ main(int argc, char *argv[])
/* need to resync */ /* need to resync */
XSync(dpy, False); XSync(dpy, False);
} }
}
if(csfd > 0 && close(csfd)) if(csfd > 0 && close(csfd))
perror("error closing UNIX domain socket"); perror("error closing UNIX domain socket");