summary refs log tree commit diff
path: root/font.c
diff options
context:
space:
mode:
authorokan <okan>2009-05-17 23:40:57 +0000
committerokan <okan>2009-05-17 23:40:57 +0000
commit4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d (patch)
tree1981b9b6d512a7bfdf07dbe8c7e957de0e004d61 /font.c
parent5d51c8e0e541449093913ff3b1f78989c82ed035 (diff)
downloadcwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.tar.gz
cwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.tar.xz
cwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.zip
a long time coming - re-work the way we deal with colors: since we're
using Xft(3), use it to select the font color as well instead of trying
to build one; properly allocate and free colors at-will, e.g. we now
have configurable colors.

feedback and ok's todd@ and oga@
Diffstat (limited to 'font.c')
-rw-r--r--font.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/font.c b/font.c
index 622d17b..0322d50 100644
--- a/font.c
+++ b/font.c
@@ -22,22 +22,14 @@
 void
 font_init(struct screen_ctx *sc)
 {
-	XColor	 xcolor, tmp;
-
 	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 (!XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, sc->which),
-	    "black", &xcolor, &tmp))
-		errx(1, "XAllocNamedColor");
-
-	sc->xftcolor.color.red = xcolor.red;
-	sc->xftcolor.color.green = xcolor.green;
-	sc->xftcolor.color.blue = xcolor.blue;
-	sc->xftcolor.color.alpha = 0x00ff00;
-	sc->xftcolor.pixel = xcolor.pixel;
+	if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
+	    DefaultColormap(X_Dpy, sc->which), "black", &sc->xftcolor))
+		errx(1, "XftColorAllocName");
 }
 
 int