]> git.sur5r.net Git - i3/i3/commitdiff
add decoration_border color for the actual client borders 2136/head
authorLauri Tirkkonen <lotheac@iki.fi>
Mon, 28 Dec 2015 12:37:42 +0000 (14:37 +0200)
committerLauri Tirkkonen <lotheac@iki.fi>
Tue, 5 Jan 2016 10:17:48 +0000 (12:17 +0200)
see https://github.com/i3/i3/pull/2136

docs/userguide
include/config.h
include/config_directives.h
parser-specs/config.spec
src/config.c
src/config_directives.c
src/x.c
testcases/t/201-config-parser.t

index 59833ed5e3535e6adc71a4668ac9204c8216d71f..9bcabaa75f7f5d66349f54147040f22d541a21ad 100644 (file)
@@ -836,9 +836,9 @@ workspace "2: vim" output VGA1
 You can change all colors which i3 uses to draw the window decorations.
 
 *Syntax*:
-------------------------------------------------------
-<colorclass> <border> <background> <text> <indicator>
-------------------------------------------------------
+-------------------------------------------------------------------------
+<colorclass> <border> <background> <text> <indicator> <decoration_border>
+-------------------------------------------------------------------------
 
 Where colorclass can be one of:
 
@@ -864,19 +864,19 @@ Colors are in HTML hex format (#rrggbb), see the following example:
 
 *Examples (default colors)*:
 ---------------------------------------------------------
-# class                 border  backgr. text    indicator
-client.focused          #4c7899 #285577 #ffffff #2e9ef4
-client.focused_inactive #333333 #5f676a #ffffff #484e50
-client.unfocused        #333333 #222222 #888888 #292d2e
-client.urgent           #2f343a #900000 #ffffff #900000
-client.placeholder      #000000 #0c0c0c #ffffff #000000
+# class                 border  backgr. text    indicator decoration_border
+client.focused          #4c7899 #285577 #ffffff #2e9ef4   #285577
+client.focused_inactive #333333 #5f676a #ffffff #484e50   #5f676a
+client.unfocused        #333333 #222222 #888888 #292d2e   #222222
+client.urgent           #2f343a #900000 #ffffff #900000   #900000
+client.placeholder      #000000 #0c0c0c #ffffff #000000   #0c0c0c
 
 client.background       #ffffff
 ---------------------------------------------------------
 
 Note that for the window decorations, the color around the child window is the
-background color, and the border color is only the two thin lines at the top of
-the window.
+"decoration_border", and "border" color is only the two thin lines around the
+titlebar.
 
 The indicator color is used for indicating where a new window will be opened.
 For horizontal split containers, the right border will be painted in indicator
index f9badf10a224d7879a989a5d987996181fe5f765..f4b1efd5ed1aacd992760782918379b70b80bcbe 100644 (file)
@@ -54,6 +54,7 @@ struct Colortriple {
     color_t background;
     color_t text;
     color_t indicator;
+    color_t decoration_border;
 };
 
 /**
index 97b8b424840f3c80abfec8f9f5933db9b54ed9c9..fd8a4208f0fbbc2ab677f7f00c48a94895f53eb7 100644 (file)
@@ -59,7 +59,7 @@ CFGFUN(no_focus);
 CFGFUN(ipc_socket, const char *path);
 CFGFUN(restart_state, const char *path);
 CFGFUN(popup_during_fullscreen, const char *value);
-CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator);
+CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *decoration_border);
 CFGFUN(color_single, const char *colorclass, const char *color);
 CFGFUN(floating_modifier, const char *modifiers);
 CFGFUN(new_window, const char *windowtype, const char *border, const long width);
index 9dad79c02dd522877fe1283764ffb418a0913ebb..1e1b52e24c19727c8fb8feba4d3efdcc3156be04 100644 (file)
@@ -282,9 +282,15 @@ state COLOR_TEXT:
 
 state COLOR_INDICATOR:
   indicator = word
-      -> call cfg_color($colorclass, $border, $background, $text, $indicator)
+      -> COLOR_DECORATION_BORDER
   end
-      -> call cfg_color($colorclass, $border, $background, $text, NULL)
+      -> call cfg_color($colorclass, $border, $background, $text, NULL, NULL)
+
+state COLOR_DECORATION_BORDER:
+  decoration_border = word
+      -> call cfg_color($colorclass, $border, $background, $text, $indicator, $decoration_border)
+  end
+      -> call cfg_color($colorclass, $border, $background, $text, $indicator, NULL)
 
 # <exec|exec_always> [--no-startup-id] command
 state EXEC:
index 833ea6b638d5bb9be23e14525fb999e2b31a65c6..ef632128bbbae1383a090de3fb6d9f4a2aa18b34 100644 (file)
@@ -189,12 +189,13 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
     memset(&config, 0, sizeof(config));
 
 /* Initialize default colors */
-#define INIT_COLOR(x, cborder, cbackground, ctext, cindicator) \
-    do {                                                       \
-        x.border = draw_util_hex_to_color(cborder);            \
-        x.background = draw_util_hex_to_color(cbackground);    \
-        x.text = draw_util_hex_to_color(ctext);                \
-        x.indicator = draw_util_hex_to_color(cindicator);      \
+#define INIT_COLOR(x, cborder, cbackground, ctext, cindicator)     \
+    do {                                                           \
+        x.border = draw_util_hex_to_color(cborder);                \
+        x.background = draw_util_hex_to_color(cbackground);        \
+        x.text = draw_util_hex_to_color(ctext);                    \
+        x.indicator = draw_util_hex_to_color(cindicator);          \
+        x.decoration_border = draw_util_hex_to_color(cbackground); \
     } while (0)
 
     config.client.background = draw_util_hex_to_color("#000000");
index 0d32f0085c0cc279799b2295f5c794d827d8fad8..fcc480945efc33cf2ade27dab37007bfbd548b14 100644 (file)
@@ -335,17 +335,20 @@ CFGFUN(color_single, const char *colorclass, const char *color) {
     config.client.background = draw_util_hex_to_color(color);
 }
 
-CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator) {
-#define APPLY_COLORS(classname)                                                        \
-    do {                                                                               \
-        if (strcmp(colorclass, "client." #classname) == 0) {                           \
-            config.client.classname.border = draw_util_hex_to_color(border);           \
-            config.client.classname.background = draw_util_hex_to_color(background);   \
-            config.client.classname.text = draw_util_hex_to_color(text);               \
-            if (indicator != NULL) {                                                   \
-                config.client.classname.indicator = draw_util_hex_to_color(indicator); \
-            }                                                                          \
-        }                                                                              \
+CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *decoration_border) {
+#define APPLY_COLORS(classname)                                                                        \
+    do {                                                                                               \
+        if (strcmp(colorclass, "client." #classname) == 0) {                                           \
+            config.client.classname.border = draw_util_hex_to_color(border);                           \
+            config.client.classname.background = draw_util_hex_to_color(background);                   \
+            config.client.classname.text = draw_util_hex_to_color(text);                               \
+            if (indicator != NULL) {                                                                   \
+                config.client.classname.indicator = draw_util_hex_to_color(indicator);                 \
+            }                                                                                          \
+            if (decoration_border != NULL) {                                                           \
+                config.client.classname.decoration_border = draw_util_hex_to_color(decoration_border); \
+            }                                                                                          \
+        }                                                                                              \
     } while (0)
 
     APPLY_COLORS(focused_inactive);
diff --git a/src/x.c b/src/x.c
index 51b66c5dd207110c402e95a0dc31df6596f42872..bef0e22ac14a4a1b1fce598d42becabcc274007d 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -299,7 +299,7 @@ void x_window_kill(xcb_window_t window, kill_window_t kill_window) {
     free(event);
 }
 
-static void x_draw_decoration_border(Con *con, struct deco_render_params *p) {
+static void x_draw_title_border(Con *con, struct deco_render_params *p) {
     assert(con->parent != NULL);
 
     Rect *dr = &(con->deco_rect);
@@ -344,7 +344,7 @@ static void x_draw_decoration_after_title(Con *con, struct deco_render_params *p
     }
 
     /* Redraw the border. */
-    x_draw_decoration_border(con, p);
+    x_draw_title_border(con, p);
 }
 
 /*
@@ -464,21 +464,24 @@ void x_draw_decoration(Con *con) {
          * rectangle because some childs are not freely resizable and we want
          * their background color to "shine through". */
         if (!(borders_to_hide & ADJ_LEFT_SCREEN_EDGE)) {
-            draw_util_rectangle(conn, &(con->frame_buffer), p->color->background,
-                                0, 0, br.x, r->height);
+            draw_util_rectangle(conn, &(con->frame_buffer), p->color->decoration_border, 0, 0, br.x, r->height);
         }
         if (!(borders_to_hide & ADJ_RIGHT_SCREEN_EDGE)) {
-            draw_util_rectangle(conn, &(con->frame_buffer), p->color->background,
-                                r->width + (br.width + br.x), 0, -(br.width + br.x), r->height);
+            draw_util_rectangle(conn, &(con->frame_buffer),
+                                p->color->decoration_border, r->width + (br.width + br.x), 0,
+                                -(br.width + br.x), r->height);
         }
         if (!(borders_to_hide & ADJ_LOWER_SCREEN_EDGE)) {
-            draw_util_rectangle(conn, &(con->frame_buffer), p->color->background,
-                                br.x, r->height + (br.height + br.y), r->width + br.width, -(br.height + br.y));
+            draw_util_rectangle(conn, &(con->frame_buffer),
+                                p->color->decoration_border, br.x, r->height + (br.height +
+                                                                                br.y),
+                                r->width + br.width, -(br.height + br.y));
         }
         /* pixel border needs an additional line at the top */
         if (p->border_style == BS_PIXEL && !(borders_to_hide & ADJ_UPPER_SCREEN_EDGE)) {
-            draw_util_rectangle(conn, &(con->frame_buffer), p->color->background,
-                                br.x, 0, r->width + br.width, br.y);
+            draw_util_rectangle(conn, &(con->frame_buffer),
+                                p->color->decoration_border, br.x, 0, r->width + br.width,
+                                br.y);
         }
 
         /* Highlight the side of the border at which the next window will be
@@ -521,7 +524,7 @@ void x_draw_decoration(Con *con) {
                         con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height);
 
     /* 5: draw two unconnected horizontal lines in border color */
-    x_draw_decoration_border(con, p);
+    x_draw_title_border(con, p);
 
     /* 6: draw the title */
     int text_offset_y = (con->deco_rect.height - config.font.height) / 2;
index 7b3a181e2ed0439fe5ee2b1519662dd610ba53b5..e8835005821d99ed06275f787e445e037a7d28f0 100644 (file)
@@ -412,19 +412,19 @@ is(parser_calls($config),
 ################################################################################
 
 $config = <<'EOT';
-client.focused          #4c7899 #285577 #ffffff #2e9ef4
+client.focused          #4c7899 #285577 #ffffff #2e9ef4 #b34d4c
 client.focused_inactive #333333 #5f676a #ffffff #484e50
 client.unfocused        #333333 #222222 #888888 #292d2e
-client.urgent           #2f343a #900000 #ffffff #900000
+client.urgent           #2f343a #900000 #ffffff #900000 #c00000
 client.placeholder      #000000 #0c0c0c #ffffff #000000
 EOT
 
 $expected = <<'EOT';
-cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4)
-cfg_color(client.focused_inactive, #333333, #5f676a, #ffffff, #484e50)
-cfg_color(client.unfocused, #333333, #222222, #888888, #292d2e)
-cfg_color(client.urgent, #2f343a, #900000, #ffffff, #900000)
-cfg_color(client.placeholder, #000000, #0c0c0c, #ffffff, #000000)
+cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4, #b34d4c)
+cfg_color(client.focused_inactive, #333333, #5f676a, #ffffff, #484e50, NULL)
+cfg_color(client.unfocused, #333333, #222222, #888888, #292d2e, NULL)
+cfg_color(client.urgent, #2f343a, #900000, #ffffff, #900000, #c00000)
+cfg_color(client.placeholder, #000000, #0c0c0c, #ffffff, #000000, NULL)
 EOT
 
 is(parser_calls($config),
@@ -449,7 +449,7 @@ ERROR: CONFIG: (in file <stdin>)
 ERROR: CONFIG: Line   1: hide_edge_border both
 ERROR: CONFIG:           ^^^^^^^^^^^^^^^^^^^^^
 ERROR: CONFIG: Line   2: client.focused          #4c7899 #285577 #ffffff #2e9ef4
-cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4)
+cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4, NULL)
 EOT
 
 $expected = $expected_all_tokens . $expected_end;
@@ -469,7 +469,7 @@ ERROR: CONFIG: (in file <stdin>)
 ERROR: CONFIG: Line   1: hide_edge_borders FOOBAR
 ERROR: CONFIG:                             ^^^^^^
 ERROR: CONFIG: Line   2: client.focused          #4c7899 #285577 #ffffff #2e9ef4
-cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4)
+cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4, NULL)
 EOT
 
 is(parser_calls($config),