diff options
author | okan | 2009-05-17 23:40:57 +0000 |
---|---|---|
committer | okan | 2009-05-17 23:40:57 +0000 |
commit | a83ec02263f57eac22f091d37c7e678aed7b8d38 (patch) | |
tree | 4b34676783c097eb00c55658b30e6c56c0fc8267 /parse.y | |
parent | 915104a67e5e6fc2c55c6a44b9360c290ea2e61d (diff) | |
download | cwm-a83ec02263f57eac22f091d37c7e678aed7b8d38.tar.gz |
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 '')
-rw-r--r-- | parse.y | 36 |
1 files changed, 35 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.19 2009/02/07 21:07:00 martynas Exp $ */ +/* $OpenBSD: parse.y,v 1.20 2009/05/17 23:40:57 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -67,6 +67,9 @@ typedef struct { %token FONTNAME STICKY GAP MOUSEBIND %token AUTOGROUP BIND COMMAND IGNORE %token YES NO BORDERWIDTH MOVEAMOUNT +%token COLOR +%token ACTIVEBORDER INACTIVEBORDER +%token GROUPBORDER UNGROUPBORDER %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -77,6 +80,7 @@ typedef struct { grammar : /* empty */ | grammar '\n' | grammar main '\n' + | grammar color '\n' | grammar error '\n' { file->errors++; } ; @@ -170,6 +174,27 @@ main : FONTNAME STRING { free($3); } ; + +color : COLOR colors + ; + +colors : ACTIVEBORDER STRING { + free(conf->color[CWM_COLOR_BORDOR_ACTIVE].name); + conf->color[CWM_COLOR_BORDOR_ACTIVE].name = $2; + } + | INACTIVEBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_INACTIVE].name); + conf->color[CWM_COLOR_BORDER_INACTIVE].name = $2; + } + | GROUPBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_GROUP].name); + conf->color[CWM_COLOR_BORDER_GROUP].name = $2; + } + | UNGROUPBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_UNGROUP].name); + conf->color[CWM_COLOR_BORDER_UNGROUP].name = $2; + } + ; %% struct keywords { @@ -202,17 +227,22 @@ lookup(char *s) { /* this has to be sorted always */ static const struct keywords keywords[] = { + { "activeborder", ACTIVEBORDER}, { "autogroup", AUTOGROUP}, { "bind", BIND}, { "borderwidth", BORDERWIDTH}, + { "color", COLOR}, { "command", COMMAND}, { "fontname", FONTNAME}, { "gap", GAP}, + { "groupborder", GROUPBORDER}, { "ignore", IGNORE}, + { "inactiveborder", INACTIVEBORDER}, { "mousebind", MOUSEBIND}, { "moveamount", MOVEAMOUNT}, { "no", NO}, { "sticky", STICKY}, + { "ungroupborder", UNGROUPBORDER}, { "yes", YES} }; const struct keywords *p; @@ -498,6 +528,7 @@ parse_config(const char *filename, struct conf *xconf) struct winmatch *wm; struct cmd *cmd; struct mousebinding *mb; + int i; conf_clear(xconf); @@ -535,6 +566,9 @@ parse_config(const char *filename, struct conf *xconf) strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath)); + for (i = 0; i < CWM_COLOR_MAX; i++) + xconf->color[i].name = conf->color[i].name; + xconf->DefaultFontName = conf->DefaultFontName; bcopy(&(conf->gap_top), &(xconf->gap_top), sizeof(int) * 4); |