*/
void draw_bars(bool unhide) {
DLOG("Drawing Bars...\n");
- int i = 0;
+ int workspace_width = 0;
refresh_statusline();
i3_ws *ws_walk;
TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
DLOG("Drawing Button for WS %s at x = %d, len = %d\n",
- i3string_as_utf8(ws_walk->name), i, ws_walk->name_width);
+ i3string_as_utf8(ws_walk->name), workspace_width, ws_walk->name_width);
uint32_t fg_color = colors.inactive_ws_fg;
uint32_t bg_color = colors.inactive_ws_bg;
uint32_t border_color = colors.inactive_ws_border;
outputs_walk->bargc,
mask,
vals_border);
- xcb_rectangle_t rect_border = {i,
+ xcb_rectangle_t rect_border = {workspace_width,
logical_px(1),
ws_walk->name_width + logical_px(10),
font.height + logical_px(4)};
outputs_walk->bargc,
mask,
vals);
- xcb_rectangle_t rect = {i + logical_px(1),
+ xcb_rectangle_t rect = {workspace_width + logical_px(1),
2 * logical_px(1),
ws_walk->name_width + logical_px(8),
font.height + logical_px(2)};
&rect);
set_font_colors(outputs_walk->bargc, fg_color, bg_color);
draw_text(ws_walk->name, outputs_walk->buffer, outputs_walk->bargc,
- i + logical_px(5), 3 * logical_px(1), ws_walk->name_width);
- i += logical_px(10) + ws_walk->name_width + logical_px(1);
+ workspace_width + logical_px(5), 3 * logical_px(1), ws_walk->name_width);
+ workspace_width += logical_px(10) + ws_walk->name_width + logical_px(1);
}
}
outputs_walk->bargc,
mask,
vals_border);
- xcb_rectangle_t rect_border = {i, 1, binding.width + 10, font.height + 4};
+ xcb_rectangle_t rect_border = {workspace_width, 1, binding.width + 10, font.height + 4};
xcb_poly_fill_rectangle(xcb_connection,
outputs_walk->buffer,
outputs_walk->bargc,
outputs_walk->bargc,
mask,
vals);
- xcb_rectangle_t rect = {i + 1, 2, binding.width + 8, font.height + 2};
+ xcb_rectangle_t rect = {workspace_width + 1, 2, binding.width + 8, font.height + 2};
xcb_poly_fill_rectangle(xcb_connection,
outputs_walk->buffer,
outputs_walk->bargc,
&rect);
set_font_colors(outputs_walk->bargc, fg_color, bg_color);
- draw_text(binding.name, outputs_walk->buffer, outputs_walk->bargc, i + 5, 3, binding.width);
+ draw_text(binding.name, outputs_walk->buffer, outputs_walk->bargc, workspace_width + 5, 3, binding.width);
unhide = true;
- i += logical_px(10) + binding.width + logical_px(1);
+ workspace_width += logical_px(10) + binding.width + logical_px(1);
}
if (!TAILQ_EMPTY(&statusline_head)) {
traypx += logical_px(2);
int edge_offset = logical_px(4);
- int visible_statusline_width = MIN(statusline_width, outputs_walk->rect.w - i - traypx - 2*edge_offset);
+ int visible_statusline_width = MIN(statusline_width,
+ outputs_walk->rect.w - workspace_width - traypx - 2*edge_offset);
xcb_copy_area(xcb_connection,
statusline_pm,
(int16_t)visible_statusline_width, (int16_t)bar_height);
}
- i = 0;
+ workspace_width = 0;
}
/* Assure the bar is hidden/unhidden according to the specified hidden_state and mode */