diff options
| -rw-r--r-- | main.c | 14 |
1 files changed, 8 insertions, 6 deletions
| @@ -283,7 +283,7 @@ main(int argc, char *argv[]) | |||
| 283 | Mainloop: | 283 | Mainloop: |
| 284 | while(running) { | 284 | while(running) { |
| 285 | FD_ZERO(&rd); | 285 | FD_ZERO(&rd); |
| 286 | FD_SET(0, &rd); | 286 | FD_SET(STDIN_FILENO, &rd); |
| 287 | FD_SET(ConnectionNumber(dpy), &rd); | 287 | FD_SET(ConnectionNumber(dpy), &rd); |
| 288 | 288 | ||
| 289 | i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); | 289 | i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); |
| @@ -292,12 +292,14 @@ Mainloop: | |||
| 292 | if(i < 0) | 292 | if(i < 0) |
| 293 | error("select failed\n"); | 293 | error("select failed\n"); |
| 294 | else if(i > 0) { | 294 | else if(i > 0) { |
| 295 | if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) { | 295 | if(FD_ISSET(ConnectionNumber(dpy), &rd)) { |
| 296 | XNextEvent(dpy, &ev); | 296 | while(XPending(dpy)) { |
| 297 | if(handler[ev.type]) | 297 | XNextEvent(dpy, &ev); |
| 298 | (handler[ev.type])(&ev); /* call handler */ | 298 | if(handler[ev.type]) |
| 299 | (handler[ev.type])(&ev); /* call handler */ | ||
| 300 | } | ||
| 299 | } | 301 | } |
| 300 | if(FD_ISSET(0, &rd)) { | 302 | if(FD_ISSET(STDIN_FILENO, &rd)) { |
| 301 | i = n = 0; | 303 | i = n = 0; |
| 302 | for(;;) { | 304 | for(;;) { |
| 303 | if((i = getchar()) == EOF) { | 305 | if((i = getchar()) == EOF) { |
