Re: [i3] [PATCH 4/5] Alignment fixes for i3bar

  • From: Fernando Lemos <fernandotcl@xxxxxxxx>
  • To: "Discussions/Questions about the i3 window manager" <i3-discuss@xxxxxxxxxxxxx>
  • Date: Tue, 20 Nov 2012 15:25:36 -0200

On Tue, Nov 20, 2012 at 6:30 AM, Michael Stapelberg <michael@xxxxxxxx>wrote:

@@ -130,7 +130,7 @@ void refresh_statusline(void) {
block->width = predict_text_width(block->full_text);
/* If this is not the last block, add some pixels for a
separator. */
if (TAILQ_NEXT(block, blocks) != NULL)
- block->width += 9;
+ block->width += 10;
statusline_width += block->width;
}


I don't use JSON input, so I can't really tell whether or not this the
separator was visually misaligned. This looks correct to me, though, since
we're using a 5px padding before the separator, and this means the
separator should be placed in the middle.



@@ -141,7 +141,7 @@ void refresh_statusline(void) {
realloc_sl_buffer();

/* Clear the statusline pixmap. */
- xcb_rectangle_t rect = { 0, 0, root_screen->width_in_pixels,
font.height };
+ xcb_rectangle_t rect = { 0, 0, root_screen->width_in_pixels,
font.height + 4 };
xcb_poly_fill_rectangle(xcb_connection, statusline_pm,
statusline_clear, 1, &rect);


Not sure why that's needed, since we shouldn't be drawing past font.height.
Am I missing something?



/* Draw the text of each block. */
@@ -1576,7 +1576,7 @@ void draw_bars(bool unhide) {
outputs_walk->buffer,
outputs_walk->bargc,
MAX(0, (int16_t)(statusline_width -
outputs_walk->rect.w + 4)), 0,
- MAX(0, (int16_t)(outputs_walk->rect.w -
statusline_width - traypx - 4)), 3,
+ MAX(0, (int16_t)(outputs_walk->rect.w -
statusline_width - traypx - 4)), 2,
MIN(outputs_walk->rect.w - traypx - 4,
statusline_width), font.height);
}


I didn't try this patch, but this makes sense to me. The status line
alignment seems to be off-by-one, I believe this would fix that. What I'd
like to see is the workspace buttons text being aligned with the status
text as well. It seems to be off by one or two pixels at the moment.

Regards,

Other related posts: