Mercurial > aewl
changeset 64:46d44d185464
removed a bottleneck
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 13:27:01 +0200 (2006-07-14) |
parents | f14858218641 |
children | 4f7b232bd72d |
files | main.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Fri Jul 14 13:03:53 2006 +0200 +++ b/main.c Fri Jul 14 13:27:01 2006 +0200 @@ -283,7 +283,7 @@ Mainloop: while(running) { FD_ZERO(&rd); - FD_SET(0, &rd); + FD_SET(STDIN_FILENO, &rd); FD_SET(ConnectionNumber(dpy), &rd); i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); @@ -292,12 +292,14 @@ if(i < 0) error("select failed\n"); else if(i > 0) { - if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) { - XNextEvent(dpy, &ev); - if(handler[ev.type]) - (handler[ev.type])(&ev); /* call handler */ + if(FD_ISSET(ConnectionNumber(dpy), &rd)) { + while(XPending(dpy)) { + XNextEvent(dpy, &ev); + if(handler[ev.type]) + (handler[ev.type])(&ev); /* call handler */ + } } - if(FD_ISSET(0, &rd)) { + if(FD_ISSET(STDIN_FILENO, &rd)) { i = n = 0; for(;;) { if((i = getchar()) == EOF) {