merged merge
authorarg@localhost.localdomain
Mon, 01 Sep 2008 08:22:11 +0000
changeset 1350 d95d9bae4dc3
parent 1346 2765f1a08494 (current diff)
parent 1349 56c2529afeab (diff)
child 1351 3f66d2d2cd6e
merged merge
--- a/dwm.c	Wed Aug 27 12:52:44 2008 +0100
+++ b/dwm.c	Mon Sep 01 08:22:11 2008 +0000
@@ -61,7 +61,7 @@
 enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
 enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
 enum { NetSupported, NetWMName, NetLast };              /* EWMH atoms */
-enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
+enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
 
@@ -233,7 +233,7 @@
 static Client *stack = NULL;
 static Cursor cursor[CurLast];
 static Display *dpy;
-static DC dc = {0};
+static DC dc;
 static Layout *lt[] = { NULL, NULL };
 static Window root, barwin;
 /* configuration, allows nested code to access above variables */
@@ -250,20 +250,21 @@
 	XClassHint ch = { 0 };
 
 	/* rule matching */
-	XGetClassHint(dpy, c->win, &ch);
-	for(i = 0; i < LENGTH(rules); i++) {
-		r = &rules[i];
-		if((!r->title || strstr(c->name, r->title))
-		&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
-		&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) {
-			c->isfloating = r->isfloating;
-			c->tags |= r->tags & TAGMASK;
+	if(XGetClassHint(dpy, c->win, &ch)) {
+		for(i = 0; i < LENGTH(rules); i++) {
+			r = &rules[i];
+			if((!r->title || strstr(c->name, r->title))
+			&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
+			&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) {
+				c->isfloating = r->isfloating;
+				c->tags |= r->tags & TAGMASK;
+			}
 		}
+		if(ch.res_class)
+			XFree(ch.res_class);
+		if(ch.res_name)
+			XFree(ch.res_name);
 	}
-	if(ch.res_class)
-		XFree(ch.res_class);
-	if(ch.res_name)
-		XFree(ch.res_name);
 	if(!c->tags)
 		c->tags = tagset[seltags];
 }
@@ -796,9 +797,6 @@
 		}
 	}
 	else {
-		if(dc.font.xfont)
-			XFreeFont(dpy, dc.font.xfont);
-		dc.font.xfont = NULL;
 		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
 		&& !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
 			die("error, cannot load font: '%s'\n", fontstr);
@@ -1326,7 +1324,6 @@
 	/* init atoms */
 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
-	wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False);
 	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
@@ -1634,7 +1631,7 @@
 void
 updatetitle(Client *c) {
 	if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
-		gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name);
+		gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
 }
 
 void