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@
This commit is contained in:
33
conf.c
33
conf.c
@@ -61,6 +61,21 @@ conf_font(struct conf *c)
|
||||
c->FontHeight = font_ascent() + font_descent() + 1;
|
||||
}
|
||||
|
||||
void
|
||||
conf_color(struct conf *c)
|
||||
{
|
||||
struct screen_ctx *sc;
|
||||
int i;
|
||||
|
||||
sc = screen_current();
|
||||
|
||||
|
||||
for (i = 0; i < CWM_COLOR_MAX; i++) {
|
||||
xu_freecolor(sc, sc->color[i].pixel);
|
||||
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conf_reload(struct conf *c)
|
||||
{
|
||||
@@ -69,6 +84,7 @@ conf_reload(struct conf *c)
|
||||
return;
|
||||
}
|
||||
|
||||
conf_color(c);
|
||||
conf_font(c);
|
||||
}
|
||||
|
||||
@@ -157,6 +173,19 @@ conf_init(struct conf *c)
|
||||
strlcpy(c->termpath, "xterm", sizeof(c->termpath));
|
||||
strlcpy(c->lockpath, "xlock", sizeof(c->lockpath));
|
||||
|
||||
c->color[CWM_COLOR_BORDOR_ACTIVE].name =
|
||||
xstrdup(CONF_COLOR_ACTIVEBORDER);
|
||||
c->color[CWM_COLOR_BORDER_INACTIVE].name =
|
||||
xstrdup(CONF_COLOR_INACTIVEBORDER);
|
||||
c->color[CWM_COLOR_BORDER_GROUP].name =
|
||||
xstrdup(CONF_COLOR_GROUPBORDER);
|
||||
c->color[CWM_COLOR_BORDER_UNGROUP].name =
|
||||
xstrdup(CONF_COLOR_UNGROUPBORDER);
|
||||
c->color[CWM_COLOR_FG_MENU].name =
|
||||
xstrdup(CONF_COLOR_MENUFG);
|
||||
c->color[CWM_COLOR_BG_MENU].name =
|
||||
xstrdup(CONF_COLOR_MENUBG);
|
||||
|
||||
c->DefaultFontName = xstrdup(DEFAULTFONTNAME);
|
||||
}
|
||||
|
||||
@@ -168,6 +197,7 @@ conf_clear(struct conf *c)
|
||||
struct winmatch *wm;
|
||||
struct cmd *cmd;
|
||||
struct mousebinding *mb;
|
||||
int i;
|
||||
|
||||
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||
@@ -198,6 +228,9 @@ conf_clear(struct conf *c)
|
||||
xfree(mb);
|
||||
}
|
||||
|
||||
for (i = 0; i < CWM_COLOR_MAX; i++)
|
||||
xfree(c->color[i].name);
|
||||
|
||||
xfree(c->DefaultFontName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user