summaryrefslogtreecommitdiff
path: root/app/cwm/conf.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2009-05-17 23:40:58 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2009-05-17 23:40:58 +0000
commit49c64852885aadb1bd54f8e5d2a1961363db7461 (patch)
tree8c29c10285b08cdd10854a7a7c94ec5e359519f1 /app/cwm/conf.c
parent643784d1e14fb8db12be54b8c9f89cc3bbc725f3 (diff)
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 'app/cwm/conf.c')
-rw-r--r--app/cwm/conf.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 6898515f5..4c17b0668 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.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: conf.c,v 1.60 2009/05/17 17:04:59 sthen Exp $
+ * $Id: conf.c,v 1.61 2009/05/17 23:40:57 okan Exp $
*/
#include "headers.h"
@@ -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);
}