comparison main.c @ 461:9d23330a5268

removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 12 Sep 2006 10:57:28 +0200
parents 81fcd7ddafee
children 2d8af0d7920d
comparison
equal deleted inserted replaced
460:ab4b08d49d24 461:9d23330a5268
37 37
38 static int (*xerrorxlib)(Display *, XErrorEvent *); 38 static int (*xerrorxlib)(Display *, XErrorEvent *);
39 static Bool otherwm, readin; 39 static Bool otherwm, readin;
40 40
41 static void 41 static void
42 cleanup() 42 cleanup() {
43 {
44 close(STDIN_FILENO); 43 close(STDIN_FILENO);
45 while(sel) { 44 while(sel) {
46 resize(sel, True, TopLeft); 45 resize(sel, True, TopLeft);
47 unmanage(sel); 46 unmanage(sel);
48 } 47 }
58 XSync(dpy, False); 57 XSync(dpy, False);
59 free(seltag); 58 free(seltag);
60 } 59 }
61 60
62 static void 61 static void
63 scan() 62 scan() {
64 {
65 unsigned int i, num; 63 unsigned int i, num;
66 Window *wins, d1, d2; 64 Window *wins, d1, d2;
67 XWindowAttributes wa; 65 XWindowAttributes wa;
68 66
69 wins = NULL; 67 wins = NULL;
80 if(wins) 78 if(wins)
81 XFree(wins); 79 XFree(wins);
82 } 80 }
83 81
84 static void 82 static void
85 setup() 83 setup() {
86 {
87 int i, j; 84 int i, j;
88 unsigned int mask; 85 unsigned int mask;
89 Window w; 86 Window w;
90 XModifierKeymap *modmap; 87 XModifierKeymap *modmap;
91 XSetWindowAttributes wa; 88 XSetWindowAttributes wa;
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;
189 free(protocols); 185 free(protocols);
190 return protos; 186 return protos;
191 } 187 }
192 188
193 void 189 void
194 sendevent(Window w, Atom a, long value) 190 sendevent(Window w, Atom a, long value) {
195 {
196 XEvent e; 191 XEvent e;
197 192
198 e.type = ClientMessage; 193 e.type = ClientMessage;
199 e.xclient.window = w; 194 e.xclient.window = w;
200 e.xclient.message_type = a; 195 e.xclient.message_type = a;
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);