summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2010-11-19 11:53:59 +0000
committerAnselm R Garbe <anselm@garbe.us>2010-11-19 11:53:59 +0000
commitb68528d85df68e681233609b38a137e3b6060775 (patch)
tree0f78f89797c924d97f5e09a1de103f1c60c0b13d /dwm.c
parentapplied Hiltjo's tiny cleanup fix (diff)
downloaddwm-b68528d85df68e681233609b38a137e3b6060775.tar.gz
dwm-b68528d85df68e681233609b38a137e3b6060775.zip
applied Hiltjo's cleanup patch
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/dwm.c b/dwm.c
index 0a23e5a..d171fe2 100644
--- a/dwm.c
+++ b/dwm.c
@@ -267,7 +267,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
267 [UnmapNotify] = unmapnotify 267 [UnmapNotify] = unmapnotify
268}; 268};
269static Atom wmatom[WMLast], netatom[NetLast]; 269static Atom wmatom[WMLast], netatom[NetLast];
270static Bool otherwm;
271static Bool running = True; 270static Bool running = True;
272static Cursor cursor[CurLast]; 271static Cursor cursor[CurLast];
273static Display *dpy; 272static Display *dpy;
@@ -458,13 +457,10 @@ buttonpress(XEvent *e) {
458 457
459void 458void
460checkotherwm(void) { 459checkotherwm(void) {
461 otherwm = False;
462 xerrorxlib = XSetErrorHandler(xerrorstart); 460 xerrorxlib = XSetErrorHandler(xerrorstart);
463 /* this causes an error if some other window manager is running */ 461 /* this causes an error if some other window manager is running */
464 XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); 462 XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
465 XSync(dpy, False); 463 XSync(dpy, False);
466 if(otherwm)
467 die("dwm: another window manager is already running\n");
468 XSetErrorHandler(xerror); 464 XSetErrorHandler(xerror);
469 XSync(dpy, False); 465 XSync(dpy, False);
470} 466}
@@ -994,12 +990,11 @@ initfont(const char *fontstr) {
994 XFreeStringList(missing); 990 XFreeStringList(missing);
995 } 991 }
996 if(dc.font.set) { 992 if(dc.font.set) {
997 XFontSetExtents *font_extents;
998 XFontStruct **xfonts; 993 XFontStruct **xfonts;
999 char **font_names; 994 char **font_names;
1000 995
1001 dc.font.ascent = dc.font.descent = 0; 996 dc.font.ascent = dc.font.descent = 0;
1002 font_extents = XExtentsOfFontSet(dc.font.set); 997 XExtentsOfFontSet(dc.font.set);
1003 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); 998 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
1004 for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { 999 for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
1005 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); 1000 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
@@ -1088,14 +1083,12 @@ killclient(const Arg *arg) {
1088 1083
1089void 1084void
1090manage(Window w, XWindowAttributes *wa) { 1085manage(Window w, XWindowAttributes *wa) {
1091 static Client cz;
1092 Client *c, *t = NULL; 1086 Client *c, *t = NULL;
1093 Window trans = None; 1087 Window trans = None;
1094 XWindowChanges wc; 1088 XWindowChanges wc;
1095 1089
1096 if(!(c = malloc(sizeof(Client)))) 1090 if(!(c = calloc(1, sizeof(Client))))
1097 die("fatal: could not malloc() %u bytes\n", sizeof(Client)); 1091 die("fatal: could not malloc() %u bytes\n", sizeof(Client));
1098 *c = cz;
1099 c->win = w; 1092 c->win = w;
1100 updatetitle(c); 1093 updatetitle(c);
1101 if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { 1094 if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
@@ -1579,7 +1572,6 @@ showhide(Client *c) {
1579 } 1572 }
1580} 1573}
1581 1574
1582
1583void 1575void
1584sigchld(int unused) { 1576sigchld(int unused) {
1585 if(signal(SIGCHLD, sigchld) == SIG_ERR) 1577 if(signal(SIGCHLD, sigchld) == SIG_ERR)
@@ -2015,7 +2007,7 @@ xerrordummy(Display *dpy, XErrorEvent *ee) {
2015 * is already running. */ 2007 * is already running. */
2016int 2008int
2017xerrorstart(Display *dpy, XErrorEvent *ee) { 2009xerrorstart(Display *dpy, XErrorEvent *ee) {
2018 otherwm = True; 2010 die("dwm: another window manager is already running\n");
2019 return -1; 2011 return -1;
2020} 2012}
2021 2013