From a952ae74f4d31b5ce0b0a0e04252d44416b6d86e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ingo=20B=C3=BCrk?= Date: Fri, 3 Apr 2015 22:54:59 +0200 Subject: [PATCH] Use a reasonable default sep_block_width if a separator_symbol is given --- docs/userguide | 3 +-- i3bar/include/xcb.h | 3 +++ i3bar/src/child.c | 5 ++++- i3bar/src/xcb.c | 3 --- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/userguide b/docs/userguide index 547c7ba7..687dff10 100644 --- a/docs/userguide +++ b/docs/userguide @@ -1319,8 +1319,7 @@ bar { === Custom separator symbol Specifies a custom symbol to be used for the separator as opposed to the vertical, -one pixel thick separator. Note that you may have to adjust the +sep_block_width+ -property. +one pixel thick separator. *Syntax*: ------------------------- diff --git a/i3bar/include/xcb.h b/i3bar/include/xcb.h index 8e48c0c1..bb37e7d5 100644 --- a/i3bar/include/xcb.h +++ b/i3bar/include/xcb.h @@ -44,6 +44,9 @@ struct xcb_color_strings_t { typedef struct xcb_colors_t xcb_colors_t; +/* Cached width of the custom separator if one was set */ +int separator_symbol_width; + /* * Early initialization of the connection to X11: Everything which does not * depend on 'config'. diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 9cc50f2a..41f8880d 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -162,7 +162,10 @@ static int stdin_start_map(void *context) { memset(&(ctx->block), '\0', sizeof(struct status_block)); /* Default width of the separator block. */ - ctx->block.sep_block_width = logical_px(9); + if (config.separator_symbol == NULL) + ctx->block.sep_block_width = logical_px(9); + else + ctx->block.sep_block_width = logical_px(8) + separator_symbol_width; return 1; } diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index e53b9226..ba57b9fa 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -63,9 +63,6 @@ static i3Font font; /* Overall height of the bar (based on font size) */ int bar_height; -/* Cached width of the custom separator if one was set */ -int separator_symbol_width; - /* These are only relevant for XKB, which we only need for grabbing modifiers */ int xkb_base; int mod_pressed = 0; -- 2.39.2