+/*
+ * Draws a separator for the given block if necessary.
+ *
+ */
+static void draw_separator(uint32_t x, struct status_block *block) {
+ uint32_t sep_offset = get_sep_offset(block);
+ if (TAILQ_NEXT(block, blocks) == NULL || sep_offset == 0)
+ return;
+
+ uint32_t center_x = x - sep_offset;
+ if (config.separator_symbol == NULL) {
+ /* Draw a classic one pixel, vertical separator. */
+ uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_LINE_WIDTH;
+ uint32_t values[] = {colors.sep_fg, colors.bar_bg, logical_px(1)};
+ xcb_change_gc(xcb_connection, statusline_ctx, mask, values);
+ xcb_poly_line(xcb_connection, XCB_COORD_MODE_ORIGIN, statusline_pm, statusline_ctx, 2,
+ (xcb_point_t[]){{center_x, logical_px(sep_voff_px)},
+ {center_x, bar_height - logical_px(sep_voff_px)}});
+ } else {
+ /* Draw a custom separator. */
+ uint32_t separator_x = MAX(x - block->sep_block_width, center_x - separator_symbol_width / 2);
+ set_font_colors(statusline_ctx, colors.sep_fg, colors.bar_bg);
+ draw_text(config.separator_symbol, statusline_pm, statusline_ctx,
+ separator_x, logical_px(ws_voff_px), x - separator_x);
+ }
+}
+