about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-06-23 17:57:50 +0000
committerokan <okan>2013-06-23 17:57:50 +0000
commitba9baaf671a4054524f62a5b90b21f603c369a5b (patch)
tree67c7fb134b8f31a193c94715026e20967e329023
parent9a12ca3520e1f8d5673755d0dbe73e9d94bdbc79 (diff)
parentfbcdce6be90df22da222192f4c54b170e945f36f (diff)
downloadcwm-ba9baaf671a4054524f62a5b90b21f603c369a5b.tar.gz
cwm-ba9baaf671a4054524f62a5b90b21f603c369a5b.tar.xz
cwm-ba9baaf671a4054524f62a5b90b21f603c369a5b.zip
cvsimport
-rw-r--r--conf.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/conf.c b/conf.c
index c6cc3bd..a3eff6d 100644
--- a/conf.c
+++ b/conf.c
@@ -84,7 +84,7 @@ conf_ignore(struct conf *c, char *val)
 	TAILQ_INSERT_TAIL(&c->ignoreq, wm, entry);
 }
 
-static char *color_binds[CWM_COLOR_MAX] = {
+static char *color_binds[] = {
 	"#CCCCCC",	/* CWM_COLOR_BORDER_ACTIVE */
 	"#666666",	/* CWM_COLOR_BORDER_INACTIVE */
 	"blue",		/* CWM_COLOR_BORDER_GROUP */
@@ -107,9 +107,16 @@ conf_screen(struct screen_ctx *sc)
 	if (sc->xftfont == NULL)
 		errx(1, "XftFontOpenName");
 
-	for (i = 0; i < CWM_COLOR_MAX; i++) {
-		if (*Conf.color[i] == '\0')
+	for (i = 0; i < nitems(color_binds); i++) {
+		if (i == CWM_COLOR_MENU_FONT_SEL && *Conf.color[i] == '\0') {
+			xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG],
+			    sc->xftcolor[CWM_COLOR_MENU_FG], &xc);
+			xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT], xc, &xc);
+			if (!XftColorAllocValue(X_Dpy, sc->visual, sc->colormap,
+			    &xc.color, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
+				warnx("XftColorAllocValue: '%s'", Conf.color[i]);
 			break;
+		}
 		if (XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
 		    Conf.color[i], &xc)) {
 			sc->xftcolor[i] = xc;
@@ -120,16 +127,7 @@ conf_screen(struct screen_ctx *sc)
 			    color_binds[i], &sc->xftcolor[i]);
 		}
 	}
-	if (i == CWM_COLOR_MAX)
-		goto out;
-
-	xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG],
-		    sc->xftcolor[CWM_COLOR_MENU_FG], &xc);
-	xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT], xc, &xc);
-	if (!XftColorAllocValue(X_Dpy, sc->visual, sc->colormap,
-	    &xc.color, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
-		warnx("XftColorAllocValue: '%s'", Conf.color[i]);
-out:
+
 	sc->menuwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0, 1, 1,
 	    Conf.bwidth,
 	    sc->xftcolor[CWM_COLOR_MENU_FG].pixel,