dwm-meillo

diff event.c @ 586:c2ddd15b199e

changing Key.func into Key.func[NFUNCS], this allows sequences execution of functions per keypress (avoids implementing useless masterfunctions which call atomic ones)
author arg@mig29
date Mon, 27 Nov 2006 13:21:38 +0100
parents 601842ee4484
children 732c58a3d92d
line diff
     1.1 --- a/event.c	Mon Nov 27 11:05:47 2006 +0100
     1.2 +++ b/event.c	Mon Nov 27 13:21:38 2006 +0100
     1.3 @@ -11,7 +11,7 @@
     1.4  typedef struct {
     1.5  	unsigned long mod;
     1.6  	KeySym keysym;
     1.7 -	void (*func)(Arg *arg);
     1.8 +	void (*func[NFUNCS])(Arg *arg);
     1.9  	Arg arg;
    1.10  } Key;
    1.11  
    1.12 @@ -245,7 +245,7 @@
    1.13  static void
    1.14  keypress(XEvent *e) {
    1.15  	static unsigned int len = sizeof key / sizeof key[0];
    1.16 -	unsigned int i;
    1.17 +	unsigned int i, j;
    1.18  	KeySym keysym;
    1.19  	XKeyEvent *ev = &e->xkey;
    1.20  
    1.21 @@ -254,8 +254,9 @@
    1.22  		if(keysym == key[i].keysym
    1.23  			&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
    1.24  		{
    1.25 -			if(key[i].func)
    1.26 -				key[i].func(&key[i].arg);
    1.27 +			for(j = 0; j < NFUNCS; j++)
    1.28 +				if(key[i].func[j])
    1.29 +					key[i].func[j](&key[i].arg);
    1.30  			return;
    1.31  		}
    1.32  	}