dwm-meillo
diff event.c @ 160:c8db0a825775
applied Sanders patches (numlock2)
author | arg@10ksloc.org |
---|---|
date | Wed, 02 Aug 2006 11:13:32 +0200 |
parents | a5eab6aaf859 |
children | f381e34158d9 |
line diff
1.1 --- a/event.c Wed Aug 02 10:48:58 2006 +0200 1.2 +++ b/event.c Wed Aug 02 11:13:32 2006 +0200 1.3 @@ -19,7 +19,7 @@ 1.4 1.5 KEYS 1.6 1.7 -static unsigned int valid_mask = 255 & ~(NUMLOCKMASK | LockMask); 1.8 +#define CLEANMASK(mask) (mask & ~(NUMLOCKMASK | LockMask)) 1.9 1.10 static void 1.11 movemouse(Client *c) 1.12 @@ -229,11 +229,11 @@ 1.13 unsigned int i; 1.14 KeySym keysym; 1.15 XKeyEvent *ev = &e->xkey; 1.16 - ev->state &= valid_mask; 1.17 1.18 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); 1.19 for(i = 0; i < len; i++) 1.20 - if((keysym == key[i].keysym) && ((key[i].mod & valid_mask) == ev->state)) { 1.21 + if(keysym == key[i].keysym && 1.22 + CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) { 1.23 if(key[i].func) 1.24 key[i].func(&key[i].arg); 1.25 return; 1.26 @@ -335,13 +335,20 @@ 1.27 1.28 for(i = 0; i < len; i++) { 1.29 code = XKeysymToKeycode(dpy, key[i].keysym); 1.30 + /* normal */ 1.31 XUngrabKey(dpy, code, key[i].mod, root); 1.32 - XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root); 1.33 - XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root); 1.34 XGrabKey(dpy, code, key[i].mod, root, True, 1.35 GrabModeAsync, GrabModeAsync); 1.36 + /* capslock */ 1.37 + XUngrabKey(dpy, code, key[i].mod | LockMask, root); 1.38 + XGrabKey(dpy, code, key[i].mod | LockMask, root, True, 1.39 + GrabModeAsync, GrabModeAsync); 1.40 + /* numlock */ 1.41 + XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root); 1.42 XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root, True, 1.43 GrabModeAsync, GrabModeAsync); 1.44 + /* capslock & numlock */ 1.45 + XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root); 1.46 XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True, 1.47 GrabModeAsync, GrabModeAsync); 1.48 }