realloc_sl_buffer();
/* Clear the statusline pixmap. */
- xcb_rectangle_t rect = {0, 0, root_screen->width_in_pixels, bar_height};
+ xcb_rectangle_t rect = {0, 0, MAX(root_screen->width_in_pixels, statusline_width), bar_height};
xcb_poly_fill_rectangle(xcb_connection, statusline_pm, statusline_clear, 1, &rect);
/* Draw the text of each block. */
/* Draw the background */
uint32_t bg_color = colors.urgent_ws_bg;
- uint32_t bg_values[] = { bg_color, bg_color };
+ uint32_t bg_values[] = {bg_color, bg_color};
xcb_change_gc(xcb_connection, statusline_ctx, mask, bg_values);
/* The urgent background “overshoots” by 2 px so that the text that
* is printed onto it will not be look so cut off. */
- xcb_rectangle_t bg_rect = { x - logical_px(2), logical_px(1), block->width + logical_px(4), bar_height - logical_px(2) };
+ xcb_rectangle_t bg_rect = {x - logical_px(2), logical_px(1), block->width + logical_px(4), bar_height - logical_px(2)};
xcb_poly_fill_rectangle(xcb_connection, statusline_pm, statusline_ctx, 1, &bg_rect);
} else {
fg_color = (block->color ? get_colorpixel(block->color) : colors.bar_fg);
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[]) { { x - sep_offset, logical_px(4) },
- { x - sep_offset, bar_height - logical_px(4) } });
+ (xcb_point_t[]){{x - sep_offset, logical_px(4)},
+ {x - sep_offset, bar_height - logical_px(4)}});
}
}
}
struct status_block *block;
int sep_offset_remainder = 0;
- TAILQ_FOREACH (block, &statusline_head, blocks) {
+ TAILQ_FOREACH(block, &statusline_head, blocks) {
if (i3string_get_num_bytes(block->full_text) == 0)
continue;
last_block_x = block_x;
- block_x += block->width + block->x_offset + block->x_append
- + get_sep_offset(block) + sep_offset_remainder;
+ block_x += block->width + block->x_offset + block->x_append + get_sep_offset(block) + sep_offset_remainder;
if (x <= block_x && x >= last_block_x) {
send_block_clicked(event->detail, block->name, block->instance, event->root_x, event->root_y);
}
/* TODO: Move this to extern get_ws_for_output() */
- TAILQ_FOREACH (cur_ws, walk->workspaces, tailq) {
+ TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
if (cur_ws->visible) {
break;
}
int num_visible = 0;
i3_output *output;
- SLIST_FOREACH (output, outputs, slist) {
+ SLIST_FOREACH(output, outputs, slist) {
if (!output->active) {
continue;
}
1,
&rect);
- if (!TAILQ_EMPTY(&statusline_head)) {
- DLOG("Printing statusline!\n");
-
- /* Luckily we already prepared a seperate pixmap containing the rendered
- * statusline, we just have to copy the relevant parts to the relevant
- * position */
- trayclient *trayclient;
- int traypx = 0;
- TAILQ_FOREACH(trayclient, outputs_walk->trayclients, tailq) {
- if (!trayclient->mapped)
- continue;
- /* We assume the tray icons are quadratic (we use the font
- * *height* as *width* of the icons) because we configured them
- * like this. */
- traypx += font.height + logical_px(2);
- }
- /* Add 2px of padding if there are any tray icons */
- if (traypx > 0)
- traypx += logical_px(2);
- xcb_copy_area(xcb_connection,
- statusline_pm,
- outputs_walk->buffer,
- outputs_walk->bargc,
- MAX(0, (int16_t)(statusline_width - outputs_walk->rect.w + logical_px(4))), 0,
- MAX(0, (int16_t)(outputs_walk->rect.w - statusline_width - traypx - logical_px(4))), 0,
- MIN(outputs_walk->rect.w - traypx - logical_px(4), (int)statusline_width), bar_height);
- }
-
if (!config.disable_ws) {
i3_ws *ws_walk;
TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
draw_text(binding.name, outputs_walk->buffer, outputs_walk->bargc, i + 5, 3, binding.width);
unhide = true;
+ i += logical_px(10) + binding.width + logical_px(1);
+ }
+
+ if (!TAILQ_EMPTY(&statusline_head)) {
+ DLOG("Printing statusline!\n");
+
+ /* Luckily we already prepared a seperate pixmap containing the rendered
+ * statusline, we just have to copy the relevant parts to the relevant
+ * position */
+ trayclient *trayclient;
+ int traypx = 0;
+ TAILQ_FOREACH(trayclient, outputs_walk->trayclients, tailq) {
+ if (!trayclient->mapped)
+ continue;
+ /* We assume the tray icons are quadratic (we use the font
+ * *height* as *width* of the icons) because we configured them
+ * like this. */
+ traypx += font.height + logical_px(2);
+ }
+ /* Add 2px of padding if there are any tray icons */
+ if (traypx > 0)
+ 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);
+
+ xcb_copy_area(xcb_connection,
+ statusline_pm,
+ outputs_walk->buffer,
+ outputs_walk->bargc,
+ (int16_t)(statusline_width - visible_statusline_width), 0,
+ (int16_t)(outputs_walk->rect.w - traypx - edge_offset - visible_statusline_width), 0,
+ (int16_t)visible_statusline_width, (int16_t)bar_height);
}
i = 0;