- switch border colors to Xft

- merge border/menu color structures/functions since they now both use Xft
- switch xu_xorcolor to operating on XftColor instead of just
  XRenderColor (basically adding pixel)
- if color name allocation fails, revert back to default (this, along
  with font validation should occur during config parse, but we don't
  have screens setup yet - likely to change at some point)
This commit is contained in:
okan
2013-05-19 23:09:59 +00:00
parent c84145661e
commit dac00a232f
6 changed files with 61 additions and 90 deletions

22
font.c
View File

@@ -31,11 +31,8 @@
#include "calmwm.h"
void
font_init(struct screen_ctx *sc, const char *name, const char **color)
font_init(struct screen_ctx *sc, const char *name)
{
int i;
XRenderColor c;
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
sc->visual, sc->colormap);
if (sc->xftdraw == NULL)
@@ -44,23 +41,6 @@ font_init(struct screen_ctx *sc, const char *name, const char **color)
sc->xftfont = XftFontOpenName(X_Dpy, sc->which, name);
if (sc->xftfont == NULL)
errx(1, "XftFontOpenName");
for (i = 0; i < CWM_COLOR_MENU_MAX; i++) {
if (*color[i] == '\0')
break;
if (!XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
color[i], &sc->xftcolor[i]))
errx(1, "XftColorAllocName");
}
if (i == CWM_COLOR_MENU_MAX)
return;
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG].color,
sc->xftcolor[CWM_COLOR_MENU_FG].color, &c);
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT].color, c, &c);
if (!XftColorAllocValue(X_Dpy, sc->visual, sc->colormap,
&c, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
errx(1, "XftColorAllocValue");
}
int