110 numlockmask = (1 << i); |
107 numlockmask = (1 << i); |
111 } |
108 } |
112 } |
109 } |
113 XFree(modmap); |
110 XFree(modmap); |
114 |
111 |
115 wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask; |
112 wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
|
113 | EnterWindowMask | LeaveWindowMask; |
116 wa.cursor = cursor[CurNormal]; |
114 wa.cursor = cursor[CurNormal]; |
117 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
115 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
118 |
116 |
119 grabkeys(); |
117 grabkeys(); |
120 initrregs(); |
118 initrregs(); |
161 /* |
159 /* |
162 * Startup Error handler to check if another window manager |
160 * Startup Error handler to check if another window manager |
163 * is already running. |
161 * is already running. |
164 */ |
162 */ |
165 static int |
163 static int |
166 xerrorstart(Display *dsply, XErrorEvent *ee) |
164 xerrorstart(Display *dsply, XErrorEvent *ee) { |
167 { |
|
168 otherwm = True; |
165 otherwm = True; |
169 return -1; |
166 return -1; |
170 } |
167 } |
171 |
168 |
172 /* extern */ |
169 /* extern */ |
173 |
170 |
174 int |
171 int |
175 getproto(Window w) |
172 getproto(Window w) { |
176 { |
|
177 int i, format, protos, status; |
173 int i, format, protos, status; |
178 unsigned long extra, res; |
174 unsigned long extra, res; |
179 Atom *protocols, real; |
175 Atom *protocols, real; |
180 |
176 |
181 protos = 0; |
177 protos = 0; |
204 XSendEvent(dpy, w, False, NoEventMask, &e); |
199 XSendEvent(dpy, w, False, NoEventMask, &e); |
205 XSync(dpy, False); |
200 XSync(dpy, False); |
206 } |
201 } |
207 |
202 |
208 void |
203 void |
209 quit(Arg *arg) |
204 quit(Arg *arg) { |
210 { |
|
211 readin = running = False; |
205 readin = running = False; |
212 } |
206 } |
213 |
207 |
214 /* |
208 /* |
215 * There's no way to check accesses to destroyed windows, thus those cases are |
209 * There's no way to check accesses to destroyed windows, thus those cases are |
216 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
210 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
217 * default error handler, which may call exit. |
211 * default error handler, which may call exit. |
218 */ |
212 */ |
219 int |
213 int |
220 xerror(Display *dpy, XErrorEvent *ee) |
214 xerror(Display *dpy, XErrorEvent *ee) { |
221 { |
|
222 if(ee->error_code == BadWindow |
215 if(ee->error_code == BadWindow |
223 || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
216 || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
224 || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
217 || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
225 || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) |
218 || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) |
226 || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) |
219 || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) |
232 ee->request_code, ee->error_code); |
225 ee->request_code, ee->error_code); |
233 return xerrorxlib(dpy, ee); /* may call exit */ |
226 return xerrorxlib(dpy, ee); /* may call exit */ |
234 } |
227 } |
235 |
228 |
236 int |
229 int |
237 main(int argc, char *argv[]) |
230 main(int argc, char *argv[]) { |
238 { |
|
239 int r, xfd; |
231 int r, xfd; |
240 fd_set rd; |
232 fd_set rd; |
241 |
233 |
242 if(argc == 2 && !strncmp("-v", argv[1], 3)) { |
234 if(argc == 2 && !strncmp("-v", argv[1], 3)) { |
243 fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); |
235 fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); |