summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/main.c b/main.c
index 5c0ef0d..a1cf245 100644
--- a/main.c
+++ b/main.c
@@ -46,7 +46,7 @@ Client *sel = NULL;
46static Bool other_wm_running; 46static Bool other_wm_running;
47static const char version[] = 47static const char version[] =
48 "dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; 48 "dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
49static int (*x_error_handler) (Display *, XErrorEvent *); 49static int (*x_xerror) (Display *, XErrorEvent *);
50 50
51static void 51static void
52usage() { error("usage: dwm [-v]\n"); } 52usage() { error("usage: dwm [-v]\n"); }
@@ -94,7 +94,7 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
94} 94}
95 95
96int 96int
97win_proto(Window w) 97proto(Window w)
98{ 98{
99 unsigned char *protocols; 99 unsigned char *protocols;
100 long res; 100 long res;
@@ -114,7 +114,7 @@ win_proto(Window w)
114} 114}
115 115
116void 116void
117send_message(Window w, Atom a, long value) 117sendevent(Window w, Atom a, long value)
118{ 118{
119 XEvent e; 119 XEvent e;
120 120
@@ -135,7 +135,7 @@ send_message(Window w, Atom a, long value)
135 * calls exit(). 135 * calls exit().
136 */ 136 */
137int 137int
138error_handler(Display *dpy, XErrorEvent *error) 138xerror(Display *dpy, XErrorEvent *error)
139{ 139{
140 if(error->error_code == BadWindow 140 if(error->error_code == BadWindow
141 || (error->request_code == X_SetInputFocus 141 || (error->request_code == X_SetInputFocus
@@ -153,7 +153,7 @@ error_handler(Display *dpy, XErrorEvent *error)
153 return 0; 153 return 0;
154 fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", 154 fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
155 error->request_code, error->error_code); 155 error->request_code, error->error_code);
156 return x_error_handler(dpy, error); /* may call exit() */ 156 return x_xerror(dpy, error); /* may call exit() */
157} 157}
158 158
159/* 159/*
@@ -161,7 +161,7 @@ error_handler(Display *dpy, XErrorEvent *error)
161 * is already running. 161 * is already running.
162 */ 162 */
163static int 163static int
164startup_error_handler(Display *dpy, XErrorEvent *error) 164startup_xerror(Display *dpy, XErrorEvent *error)
165{ 165{
166 other_wm_running = True; 166 other_wm_running = True;
167 return -1; 167 return -1;
@@ -215,7 +215,7 @@ main(int argc, char *argv[])
215 215
216 /* check if another WM is already running */ 216 /* check if another WM is already running */
217 other_wm_running = False; 217 other_wm_running = False;
218 XSetErrorHandler(startup_error_handler); 218 XSetErrorHandler(startup_xerror);
219 /* this causes an error if some other WM is running */ 219 /* this causes an error if some other WM is running */
220 XSelectInput(dpy, root, SubstructureRedirectMask); 220 XSelectInput(dpy, root, SubstructureRedirectMask);
221 XFlush(dpy); 221 XFlush(dpy);
@@ -224,7 +224,7 @@ main(int argc, char *argv[])
224 error("dwm: another window manager is already running\n"); 224 error("dwm: another window manager is already running\n");
225 225
226 XSetErrorHandler(0); 226 XSetErrorHandler(0);
227 x_error_handler = XSetErrorHandler(error_handler); 227 x_xerror = XSetErrorHandler(xerror);
228 228
229 /* init atoms */ 229 /* init atoms */
230 wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 230 wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -242,10 +242,10 @@ main(int argc, char *argv[])
242 grabkeys(); 242 grabkeys();
243 243
244 /* style */ 244 /* style */
245 dc.bg = initcolor(BGCOLOR); 245 dc.bg = getcolor(BGCOLOR);
246 dc.fg = initcolor(FGCOLOR); 246 dc.fg = getcolor(FGCOLOR);
247 dc.border = initcolor(BORDERCOLOR); 247 dc.border = getcolor(BORDERCOLOR);
248 initfont(FONT); 248 setfont(FONT);
249 249
250 sx = sy = 0; 250 sx = sy = 0;
251 sw = DisplayWidth(dpy, screen); 251 sw = DisplayWidth(dpy, screen);
@@ -267,7 +267,7 @@ main(int argc, char *argv[])
267 267
268 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); 268 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
269 dc.gc = XCreateGC(dpy, root, 0, 0); 269 dc.gc = XCreateGC(dpy, root, 0, 0);
270 draw_bar(); 270 drawstatus();
271 271
272 issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); 272 issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
273 273
@@ -315,7 +315,7 @@ Mainloop:
315 stext[n++] = i; 315 stext[n++] = i;
316 } 316 }
317 stext[n] = 0; 317 stext[n] = 0;
318 draw_bar(); 318 drawstatus();
319 } 319 }
320 } 320 }
321 } 321 }