diff options
author | okan <okan> | 2009-05-17 23:40:57 +0000 |
---|---|---|
committer | okan <okan> | 2009-05-17 23:40:57 +0000 |
commit | 4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d (patch) | |
tree | 1981b9b6d512a7bfdf07dbe8c7e957de0e004d61 /conf.c | |
parent | 5d51c8e0e541449093913ff3b1f78989c82ed035 (diff) | |
download | cwm-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 'conf.c')
-rw-r--r-- | conf.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/conf.c b/conf.c index 7dba8b1..bd7deb1 100644 --- a/conf.c +++ b/conf.c @@ -62,6 +62,21 @@ conf_font(struct conf *c) } 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) { if (parse_config(c->conf_path, c) == -1) { @@ -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); } |