aewl

diff main.c @ 275:425cd4490c1e

some other small fixes
author Anselm R.Garbe <arg@10ksloc.org>
date Mon, 14 Aug 2006 15:11:02 +0200
parents 97e8cb712fd9
children c1187ddcd7f7
line diff
     1.1 --- a/main.c	Mon Aug 14 11:38:43 2006 +0200
     1.2 +++ b/main.c	Mon Aug 14 15:11:02 2006 +0200
     1.3 @@ -196,6 +196,7 @@
     1.4  
     1.5  	XSetErrorHandler(NULL);
     1.6  	xerrorxlib = XSetErrorHandler(xerror);
     1.7 +	XSync(dpy, False);
     1.8  
     1.9  	/* init atoms */
    1.10  	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
    1.11 @@ -269,13 +270,6 @@
    1.12  		if(i < 0)
    1.13  			eprint("select failed\n");
    1.14  		else if(i > 0) {
    1.15 -			if(FD_ISSET(xfd, &rd)) {
    1.16 -				while(XPending(dpy)) {
    1.17 -					XNextEvent(dpy, &ev);
    1.18 -					if(handler[ev.type])
    1.19 -						(handler[ev.type])(&ev); /* call handler */
    1.20 -				}
    1.21 -			}
    1.22  			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
    1.23  				readin = NULL != fgets(stext, sizeof(stext), stdin);
    1.24  				if(readin)
    1.25 @@ -284,9 +278,15 @@
    1.26  					strcpy(stext, "broken pipe");
    1.27  				drawstatus();
    1.28  			}
    1.29 +			if(FD_ISSET(xfd, &rd)) {
    1.30 +				while(XPending(dpy)) {
    1.31 +					XNextEvent(dpy, &ev);
    1.32 +					if(handler[ev.type])
    1.33 +						(handler[ev.type])(&ev); /* call handler */
    1.34 +				}
    1.35 +			}
    1.36  		}
    1.37  	}
    1.38 -
    1.39  	cleanup();
    1.40  	XCloseDisplay(dpy);
    1.41