JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
changing Key.func into Key.func[NFUNCS], this allows sequences execution of functions...
[dwm.git] / event.c
diff --git a/event.c b/event.c
index 23dcf55..45a21a6 100644 (file)
--- a/event.c
+++ b/event.c
@@ -11,7 +11,7 @@
 typedef struct {
        unsigned long mod;
        KeySym keysym;
-       void (*func)(Arg *arg);
+       void (*func[NFUNCS])(Arg *arg);
        Arg arg;
 } Key;
 
@@ -244,8 +244,8 @@ expose(XEvent *e) {
 
 static void
 keypress(XEvent *e) {
-       static unsigned int len = sizeof(key) / sizeof(key[0]);
-       unsigned int i;
+       static unsigned int len = sizeof key / sizeof key[0];
+       unsigned int i, j;
        KeySym keysym;
        XKeyEvent *ev = &e->xkey;
 
@@ -254,8 +254,9 @@ keypress(XEvent *e) {
                if(keysym == key[i].keysym
                        && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
                {
-                       if(key[i].func)
-                               key[i].func(&key[i].arg);
+                       for(j = 0; j < NFUNCS; j++)
+                               if(key[i].func[j])
+                                       key[i].func[j](&key[i].arg);
                        return;
                }
        }
@@ -355,7 +356,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
 
 void
 grabkeys(void) {
-       static unsigned int len = sizeof(key) / sizeof(key[0]);
+       static unsigned int len = sizeof key / sizeof key[0];
        unsigned int i;
        KeyCode code;