dwm-meillo

changeset 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 9a0a351dd910
files event.c main.c
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/event.c	Mon Aug 14 11:38:43 2006 +0200
     1.2 +++ b/event.c	Mon Aug 14 15:11:02 2006 +0200
     1.3 @@ -254,13 +254,15 @@
     1.4  	XKeyEvent *ev = &e->xkey;
     1.5  
     1.6  	keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
     1.7 -	for(i = 0; i < len; i++)
     1.8 +	for(i = 0; i < len; i++) {
     1.9  		if(keysym == key[i].keysym &&
    1.10 -				CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) {
    1.11 +				CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
    1.12 +		{
    1.13  			if(key[i].func)
    1.14  				key[i].func(&key[i].arg);
    1.15  			return;
    1.16  		}
    1.17 +	}
    1.18  }
    1.19  
    1.20  static void
     2.1 --- a/main.c	Mon Aug 14 11:38:43 2006 +0200
     2.2 +++ b/main.c	Mon Aug 14 15:11:02 2006 +0200
     2.3 @@ -196,6 +196,7 @@
     2.4  
     2.5  	XSetErrorHandler(NULL);
     2.6  	xerrorxlib = XSetErrorHandler(xerror);
     2.7 +	XSync(dpy, False);
     2.8  
     2.9  	/* init atoms */
    2.10  	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
    2.11 @@ -269,13 +270,6 @@
    2.12  		if(i < 0)
    2.13  			eprint("select failed\n");
    2.14  		else if(i > 0) {
    2.15 -			if(FD_ISSET(xfd, &rd)) {
    2.16 -				while(XPending(dpy)) {
    2.17 -					XNextEvent(dpy, &ev);
    2.18 -					if(handler[ev.type])
    2.19 -						(handler[ev.type])(&ev); /* call handler */
    2.20 -				}
    2.21 -			}
    2.22  			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
    2.23  				readin = NULL != fgets(stext, sizeof(stext), stdin);
    2.24  				if(readin)
    2.25 @@ -284,9 +278,15 @@
    2.26  					strcpy(stext, "broken pipe");
    2.27  				drawstatus();
    2.28  			}
    2.29 +			if(FD_ISSET(xfd, &rd)) {
    2.30 +				while(XPending(dpy)) {
    2.31 +					XNextEvent(dpy, &ev);
    2.32 +					if(handler[ev.type])
    2.33 +						(handler[ev.type])(&ev); /* call handler */
    2.34 +				}
    2.35 +			}
    2.36  		}
    2.37  	}
    2.38 -
    2.39  	cleanup();
    2.40  	XCloseDisplay(dpy);
    2.41