about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-08-23 09:26:11 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-08-23 09:26:11 +0100
commit2b4157eccd649682c200de837193dd0a24129dc7 (patch)
tree3b89acf53fa4b7010798fe8766641b91810fe8e4
parent0f26de991f742d548e024a2dadcbfa3a7db8d4b2 (diff)
downloaddwm-2b4157eccd649682c200de837193dd0a24129dc7.tar.gz
applied Peter Hartlich's initmodmap patch
-rw-r--r--LICENSE1
-rw-r--r--dwm.c31
2 files changed, 19 insertions, 13 deletions
diff --git a/LICENSE b/LICENSE
index 66c0f87..9138fe2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -7,6 +7,7 @@ MIT/X Consortium License
 © 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
 © 2007 Christof Musik <christof at sendfax dot de>
 © 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
+© 2007-2008 Peter Hartlich <sgkkr at hartlich dot com>
 © 2008 Martin Hurton <martin dot hurton at gmail dot com>
 
 Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/dwm.c b/dwm.c
index ec87228..fa8344a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -158,6 +158,7 @@ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
 static void grabbuttons(Client *c, Bool focused);
 static void grabkeys(void);
 static void initfont(const char *fontstr);
+static void initmodmap(void);
 static Bool isprotodel(Client *c);
 static void keypress(XEvent *e);
 static void killclient(const Arg *arg);
@@ -753,16 +754,6 @@ grabkeys(void) {
 	unsigned int i, j;
 	unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
 	KeyCode code;
-	XModifierKeymap *modmap;
-
-	/* init modifier map */
-	modmap = XGetModifierMapping(dpy);
-	for(i = 0; i < 8; i++)
-		for(j = 0; j < modmap->max_keypermod; j++) {
-			if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
-				numlockmask = (1 << i);
-		}
-	XFreeModifiermap(modmap);
 
 	XUngrabKey(dpy, AnyKey, AnyModifier, root);
 	for(i = 0; i < LENGTH(keys); i++) {
@@ -813,6 +804,19 @@ initfont(const char *fontstr) {
 	dc.font.height = dc.font.ascent + dc.font.descent;
 }
 
+void
+initmodmap(void) {
+	unsigned int i, j;
+	XModifierKeymap *modmap;
+
+	modmap = XGetModifierMapping(dpy);
+	for(i = 0; i < 8; i++)
+		for(j = 0; j < modmap->max_keypermod; j++)
+			if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
+				numlockmask = (1 << i);
+	XFreeModifiermap(modmap);
+}
+
 Bool
 isprotodel(Client *c) {
 	int i, n;
@@ -925,8 +929,10 @@ mappingnotify(XEvent *e) {
 	XMappingEvent *ev = &e->xmapping;
 
 	XRefreshKeyboardMapping(ev);
-	if(ev->request == MappingKeyboard)
+	if(ev->request == MappingKeyboard) {
+		initmodmap();
 		grabkeys();
+	}
 }
 
 void
@@ -1373,8 +1379,7 @@ setup(void) {
 	XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
 	XSelectInput(dpy, root, wa.event_mask);
 
-
-	/* grab keys */
+	initmodmap();
 	grabkeys();
 }
 
e'>^
5109e78f ^
514f0e34 ^
c442a5ad ^




77cdc6d0 ^
31401373 ^
9d670bb5 ^

6c96a437 ^
c442a5ad ^
f116818c ^
0487a30e ^
514f0e34 ^
1066660e ^
69f04c3f ^
8dacba82 ^
f116818c ^
1bc0bb7e ^

f116818c ^
1bc0bb7e ^
f116818c ^
1bc0bb7e ^
f116818c ^
6c96a437 ^
1bc0bb7e ^


636837e7 ^
1bc0bb7e ^
6c96a437 ^
f116818c ^

1bc0bb7e ^
f116818c ^
9dcbec39 ^
1bc0bb7e ^

6c96a437 ^
f116818c ^
3473c63a ^
5109e78f ^
a3f420b6 ^
f116818c ^
40278ae5 ^
f116818c ^
1bc0bb7e ^

f116818c ^
1bc0bb7e ^
6c96a437 ^
f116818c ^

af023b32 ^
2b250717 ^
f116818c ^
1bc0bb7e ^
b24eb476 ^
abc70216 ^
2b250717 ^
f116818c ^
abc70216 ^
4637d58f ^
2b250717 ^
4637d58f ^
1bc0bb7e ^

f116818c ^
1bc0bb7e ^



636837e7 ^



4a943d4e ^
















d135851e ^
9a81d746 ^
87cc473c ^
f116818c ^
9a81d746 ^


4071055a ^
4a943d4e ^















87cc473c ^
4a943d4e ^












7402ce32 ^
fca0ebbe ^
8dacba82 ^

ac0e9db5 ^
4082acd2 ^
8dacba82 ^


6c96a437 ^
8dacba82 ^
4082acd2 ^
8dacba82 ^



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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197