about summary refs log tree commit diff
path: root/font.c
diff options
context:
space:
mode:
authorokan <okan>2011-09-08 12:35:33 +0000
committerokan <okan>2011-09-08 12:35:33 +0000
commit82d31aec1d380bc53a1ccfdabe81e37d9b7213c2 (patch)
treefc9397efe088ac08537cd645464ce6e94c74c4c4 /font.c
parenta262f8e80cb02238e7b01fde8faf4085115acd1c (diff)
downloadcwm-82d31aec1d380bc53a1ccfdabe81e37d9b7213c2.tar.gz
cwm-82d31aec1d380bc53a1ccfdabe81e37d9b7213c2.tar.xz
cwm-82d31aec1d380bc53a1ccfdabe81e37d9b7213c2.zip
allow configurable menu font color; from Alexander Polakov with a tweak
from me.

ok oga@
Diffstat (limited to 'font.c')
-rw-r--r--font.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/font.c b/font.c
index cc24eaf..54c878e 100644
--- a/font.c
+++ b/font.c
@@ -49,15 +49,20 @@ font_height(struct screen_ctx *sc)
 }
 
 void
-font_init(struct screen_ctx *sc)
+font_init(struct screen_ctx *sc, const char *color)
 {
+	if (sc->xftdraw)
+		XftDrawDestroy(sc->xftdraw);
 	sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
 	    DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
 	if (sc->xftdraw == NULL)
 		errx(1, "XftDrawCreate");
 
+	if (sc->xftcolor.pixel)
+		XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which),
+		    DefaultColormap(X_Dpy, sc->which), &sc->xftcolor);
 	if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
-	    DefaultColormap(X_Dpy, sc->which), "black", &sc->xftcolor))
+	    DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
 		errx(1, "XftColorAllocName");
 }