about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-08-02 11:13:32 +0200
committerarg@10ksloc.org <unknown>2006-08-02 11:13:32 +0200
commit3af6434085aee75bd90e22aee95419dc0ae0b969 (patch)
treecb95e7ab70992fe6c3eb43bc1bf3a53261d6cb99 /event.c
parent57871415c16664cce494b68dd3e985bcb32942c5 (diff)
downloaddwm-3af6434085aee75bd90e22aee95419dc0ae0b969.tar.gz
applied Sanders patches (numlock2)
Diffstat (limited to 'event.c')
-rw-r--r--event.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/event.c b/event.c
index 1aed904..0359971 100644
--- a/event.c
+++ b/event.c
@@ -19,7 +19,7 @@ typedef struct {
 
 KEYS
 
-static unsigned int valid_mask =  255 &  ~(NUMLOCKMASK | LockMask);
+#define CLEANMASK(mask) (mask & ~(NUMLOCKMASK | LockMask))
 
 static void
 movemouse(Client *c)
@@ -229,11 +229,11 @@ keypress(XEvent *e)
 	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 & valid_mask) == ev->state)) {
+		if(keysym == key[i].keysym &&
+				CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) {
 			if(key[i].func)
 				key[i].func(&key[i].arg);
 			return;
@@ -335,13 +335,20 @@ grabkeys()
 
 	for(i = 0; i < len; i++) {
 		code = XKeysymToKeycode(dpy, key[i].keysym);
+		/* normal */
 		XUngrabKey(dpy, code, key[i].mod, root);
-		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);
+		/* capslock */
+		XUngrabKey(dpy, code, key[i].mod | LockMask, root);
+		XGrabKey(dpy, code, key[i].mod | LockMask, root, True,
+				GrabModeAsync, GrabModeAsync);
+		/* numlock */
+		XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root);
 		XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root, True,
 				GrabModeAsync, GrabModeAsync);
+		/* capslock & numlock */
+		XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root);
 		XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True,
 				GrabModeAsync, GrabModeAsync);
 	}
>4d6c426f ^
5e449699 ^
4d6c426f ^

a66c4a26 ^
3de15ddd ^
a66c4a26 ^


f027adc0 ^
5c210a96 ^

3de15ddd ^

5c210a96 ^
fb275079 ^

5c210a96 ^
3d566884 ^
a1d7ed6e ^
3d566884 ^
f8e96a97 ^
465bff73 ^





f027adc0 ^
f8e96a97 ^

0b5c4cbe ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67