From a83ec02263f57eac22f091d37c7e678aed7b8d38 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 17 May 2009 23:40:57 +0000 Subject: 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@ --- calmwm.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'calmwm.c') diff --git a/calmwm.c b/calmwm.c index a23e726..efbbabe 100644 --- a/calmwm.c +++ b/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.36 2009/04/15 14:01:45 okan Exp $ + * $Id: calmwm.c,v 1.37 2009/05/17 23:40:57 okan Exp $ */ #include "headers.h" @@ -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); -- cgit v1.2.3-2-gb3c3