From: Michael Stapelberg Date: Sat, 13 Nov 2010 19:07:49 +0000 (+0100) Subject: port fernando’s custom background color patch X-Git-Tag: tree-pr1~111 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4cd6dd0303b07d921b304ac5136b169a2d0a2b26;p=i3%2Fi3 port fernando’s custom background color patch --- diff --git a/include/config.h b/include/config.h index 36011f45..a435cb5b 100644 --- a/include/config.h +++ b/include/config.h @@ -112,6 +112,7 @@ struct Config { /* Color codes are stored here */ struct config_client { + uint32_t background; struct Colortriple focused; struct Colortriple focused_inactive; struct Colortriple unfocused; diff --git a/src/cfgparse.l b/src/cfgparse.l index 7d583b94..eb9c25c7 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -102,6 +102,7 @@ stack-limit { return TOKSTACKLIMIT; } cols { /* yylval.number = STACK_LIMIT_COLS; */return TOKSTACKLIMIT; } rows { /* yylval.number = STACK_LIMIT_ROWS; */return TOKSTACKLIMIT; } exec { BEGIN(BIND_AWS_COND); return TOKEXEC; } +client.background { BEGIN(COLOR_COND); yylval.single_color = &config.client.background; return TOKSINGLECOLOR; } client.focused { BEGIN(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; } client.focused_inactive { BEGIN(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; } client.unfocused { BEGIN(COLOR_COND); yylval.color = &config.client.unfocused; return TOKCOLOR; } diff --git a/src/cfgparse.y b/src/cfgparse.y index 99367adb..5de08bde 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -182,6 +182,7 @@ void parse_file(const char *f) { %union { int number; char *string; + uint32_t *single_color; struct Colortriple *color; struct Assignment *assignment; struct Binding *binding; @@ -210,6 +211,7 @@ void parse_file(const char *f) { %token TOKSET %token TOKIPCSOCKET "ipc_socket" %token TOKEXEC "exec" +%token TOKSINGLECOLOR %token TOKCOLOR %token TOKARROW "→" %token TOKMODE "mode" @@ -240,6 +242,7 @@ line: | assign | ipcsocket | exec + | single_color | color | terminal | font @@ -569,6 +572,13 @@ font: } ; +single_color: + TOKSINGLECOLOR WHITESPACE colorpixel + { + uint32_t *dest = $1; + *dest = $3; + } + ; color: TOKCOLOR WHITESPACE colorpixel WHITESPACE colorpixel WHITESPACE colorpixel diff --git a/src/con.c b/src/con.c index beaf82ce..8121bf0e 100644 --- a/src/con.c +++ b/src/con.c @@ -41,14 +41,17 @@ Con *con_new(Con *parent) { /* TODO: remove window coloring after test-phase */ LOG("color %s\n", colors[cnt]); new->name = strdup(colors[cnt]); +#if 0 uint32_t cp = get_colorpixel(colors[cnt]); cnt++; if ((cnt % (sizeof(colors) / sizeof(char*))) == 0) cnt = 0; +#endif x_con_init(new); - xcb_change_window_attributes(conn, new->frame, XCB_CW_BACK_PIXEL, &cp); + // TODO: this needs to be integrated into src/x.c and updated on config file reloads + xcb_change_window_attributes(conn, new->frame, XCB_CW_BACK_PIXEL, &config.client.background); TAILQ_INIT(&(new->floating_head)); TAILQ_INIT(&(new->nodes_head)); diff --git a/src/config.c b/src/config.c index 2e611e95..b37f013c 100644 --- a/src/config.c +++ b/src/config.c @@ -348,6 +348,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, x.text = get_colorpixel(ctext); \ } while (0) + config.client.background = get_colorpixel("#000000"); INIT_COLOR(config.client.focused, "#4c7899", "#285577", "#ffffff"); INIT_COLOR(config.client.focused_inactive, "#333333", "#5f676a", "#ffffff"); INIT_COLOR(config.client.unfocused, "#333333", "#222222", "#888888");