i3bar: rename a variable

Give it a more meaningful name.
This commit is contained in:
shdown 2015-03-21 19:17:05 +03:00
parent b28bb20caa
commit 4d3867f178
1 changed files with 13 additions and 12 deletions

View File

@ -1736,7 +1736,7 @@ void reconfig_windows(bool redraw_bars) {
*/
void draw_bars(bool unhide) {
DLOG("Drawing Bars...\n");
int i = 0;
int workspace_width = 0;
refresh_statusline();
@ -1767,7 +1767,7 @@ void draw_bars(bool unhide) {
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;
@ -1795,7 +1795,7 @@ void draw_bars(bool unhide) {
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)};
@ -1809,7 +1809,7 @@ void draw_bars(bool unhide) {
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)};
@ -1820,8 +1820,8 @@ void draw_bars(bool unhide) {
&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);
}
}
@ -1835,7 +1835,7 @@ void draw_bars(bool unhide) {
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,
@ -1847,7 +1847,7 @@ void draw_bars(bool unhide) {
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,
@ -1855,10 +1855,10 @@ void draw_bars(bool unhide) {
&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)) {
@ -1882,7 +1882,8 @@ void draw_bars(bool unhide) {
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,
@ -1893,7 +1894,7 @@ void draw_bars(bool unhide) {
(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 */