summary refs log tree commit diff
path: root/calmwm.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 /calmwm.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 'calmwm.c')
-rw-r--r--calmwm.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/calmwm.c b/calmwm.c
index 36aa533..3c61a3e 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -162,8 +162,6 @@ x_teardown(void)
 void
 x_setupscreen(struct screen_ctx *sc, u_int which)
 {
-	XColor			 tmp;
-	XGCValues		 gv;
 	Window			*wins, w0, w1;
 	XWindowAttributes	 winattr;
 	XSetWindowAttributes	 rootattr;
@@ -173,41 +171,11 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	Curscreen = sc;
 
 	sc->which = which;
-	sc->rootwin = RootWindow(X_Dpy, which);
-
+	sc->rootwin = RootWindow(X_Dpy, sc->which);
 	sc->xmax = DisplayWidth(X_Dpy, sc->which);
 	sc->ymax = DisplayHeight(X_Dpy, sc->which);
 
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "black", &sc->fgcolor, &tmp);
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "#00cc00", &sc->bgcolor, &tmp);
-	XAllocNamedColor(X_Dpy,DefaultColormap(X_Dpy, which),
-	    "blue", &sc->fccolor, &tmp);
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "red", &sc->redcolor, &tmp);
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "#666666", &sc->graycolor, &tmp);
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "white", &sc->whitecolor, &tmp);
-	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
-	    "black", &sc->blackcolor, &tmp);
-
-	sc->blackpixl = BlackPixel(X_Dpy, sc->which);
-	sc->whitepixl = WhitePixel(X_Dpy, sc->which);
-	sc->bluepixl = sc->fccolor.pixel;
-	sc->redpixl = sc->redcolor.pixel;
-	sc->graypixl = sc->graycolor.pixel;
-
-	gv.foreground = sc->blackpixl^sc->whitepixl;
-	gv.background = sc->whitepixl;
-	gv.function = GXxor;
-	gv.line_width = 1;
-	gv.subwindow_mode = IncludeInferiors;
-
-	sc->gc = XCreateGC(X_Dpy, sc->rootwin,
-	    GCForeground|GCBackground|GCFunction|
-	    GCLineWidth|GCSubwindowMode, &gv);
+	conf_color(&Conf);
 
 	font_init(sc);
 	conf_font(&Conf);