dwm-meillo

changeset 64:46d44d185464

removed a bottleneck
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 13:27:01 +0200
parents f14858218641
children 4f7b232bd72d
files main.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/main.c	Fri Jul 14 13:03:53 2006 +0200
     1.2 +++ b/main.c	Fri Jul 14 13:27:01 2006 +0200
     1.3 @@ -283,7 +283,7 @@
     1.4  Mainloop:
     1.5  	while(running) {
     1.6  		FD_ZERO(&rd);
     1.7 -		FD_SET(0, &rd);
     1.8 +		FD_SET(STDIN_FILENO, &rd);
     1.9  		FD_SET(ConnectionNumber(dpy), &rd);
    1.10  
    1.11  		i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
    1.12 @@ -292,12 +292,14 @@
    1.13  		if(i < 0)
    1.14  			error("select failed\n");
    1.15  		else if(i > 0) {
    1.16 -			if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) {
    1.17 -				XNextEvent(dpy, &ev);
    1.18 -				if(handler[ev.type])
    1.19 -					(handler[ev.type])(&ev); /* call handler */
    1.20 +			if(FD_ISSET(ConnectionNumber(dpy), &rd)) {
    1.21 +				while(XPending(dpy)) {
    1.22 +					XNextEvent(dpy, &ev);
    1.23 +					if(handler[ev.type])
    1.24 +						(handler[ev.type])(&ev); /* call handler */
    1.25 +				}
    1.26  			}
    1.27 -			if(FD_ISSET(0, &rd)) {
    1.28 +			if(FD_ISSET(STDIN_FILENO, &rd)) {
    1.29  				i = n = 0;
    1.30  				for(;;) {
    1.31  					if((i = getchar()) == EOF) {