all repos — dwm @ 57416beefec4db451a75a1d25434b69cf50badad

my dwm build

applied Cedric's NumLock patch
arg@10ksloc.org unknown
Tue, 01 Aug 2006 12:41:38 +0200
commit

57416beefec4db451a75a1d25434b69cf50badad

parent

1b63f832c528958042d72fddc318af5aefdcb68a

1 files changed, 17 insertions(+), 1 deletions(-)

jump to
M event.cevent.c

@@ -57,6 +57,9 @@ { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } },

{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, }; +#define NumLockMask Mod2Mask +unsigned int valid_mask = 255 & ~( NumLockMask | LockMask); + /* END CUSTOMIZE */ /* static */

@@ -271,10 +274,11 @@ static unsigned int len = sizeof(key) / sizeof(key[0]);

unsigned int i; KeySym keysym; XKeyEvent *ev = &e->xkey; + ev->state &= valid_mask; keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); for(i = 0; i < len; i++) - if((keysym == key[i].keysym) && (key[i].mod == ev->state)) { + if((keysym == key[i].keysym) && ((key[i].mod & valid_mask) == ev->state)) { if(key[i].func) key[i].func(&key[i].arg); return;

@@ -377,7 +381,19 @@

for(i = 0; i < len; i++) { code = XKeysymToKeycode(dpy, key[i].keysym); XUngrabKey(dpy, code, key[i].mod, root); + if (NumLockMask) + { + XUngrabKey(dpy, code, key[i].mod | NumLockMask, root); + XUngrabKey(dpy, code, key[i].mod | NumLockMask | LockMask, root); + } XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync); + if (NumLockMask) + { + XGrabKey(dpy, code, key[i].mod | NumLockMask, root, True, + GrabModeAsync, GrabModeAsync); + XGrabKey(dpy, code, key[i].mod | NumLockMask | LockMask, root, True, + GrabModeAsync, GrabModeAsync); + } } }