From 4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 17 May 2009 23:40:57 +0000 Subject: 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@ --- parse.y | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 2554ed3..272b587 100644 --- a/parse.y +++ b/parse.y @@ -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 STRING %token 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); -- cgit 1.4.1