From c3db74a1f8cdcd5d7df263878f208bc9aa00f320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Wed, 13 Apr 2016 19:48:53 +0200 Subject: [PATCH 1/3] Only redraw right-hand side border if a non-pango font is used. relates to #2247 --- src/x.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/x.c b/src/x.c index 43db952d..5e50b4cd 100644 --- a/src/x.c +++ b/src/x.c @@ -332,8 +332,10 @@ static void x_draw_decoration_after_title(Con *con, struct deco_render_params *p /* Redraw the right border to cut off any text that went past it. * This is necessary when the text was drawn using XCB since cutting text off * automatically does not work there. For pango rendering, this isn't necessary. */ - draw_util_rectangle(conn, &(con->parent->frame_buffer), p->color->background, - dr->x + dr->width + br.width, dr->y, -br.width, dr->height); + if (!font_is_pango()) { + draw_util_rectangle(conn, &(con->parent->frame_buffer), p->color->background, + dr->x + dr->width + br.width, dr->y, -br.width, dr->height); + } /* Draw a 1px separator line before and after every tab, so that tabs can * be easily distinguished. */ From 057517b80935a39e1fde594001a3926b4f28d2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Wed, 13 Apr 2016 19:51:26 +0200 Subject: [PATCH 2/3] Redraw right-hand side border correctly. Since we don't actually stop drawing a title (or marks) with the distance of the border width on the right side, but instead with a hard-coded two pixel distance, we can only redraw that much of the border without potentiall cutting off text. relates to #2247 --- src/x.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/x.c b/src/x.c index 5e50b4cd..a6e3bde9 100644 --- a/src/x.c +++ b/src/x.c @@ -327,14 +327,19 @@ static void x_draw_decoration_after_title(Con *con, struct deco_render_params *p assert(con->parent != NULL); Rect *dr = &(con->deco_rect); - Rect br = con_border_style_rect(con); /* Redraw the right border to cut off any text that went past it. * This is necessary when the text was drawn using XCB since cutting text off * automatically does not work there. For pango rendering, this isn't necessary. */ if (!font_is_pango()) { + /* We actually only redraw the far right two pixels as that is the + * distance we keep from the edge (not the entire border width). + * Redrawing the entire border would cause text to be cut off. */ draw_util_rectangle(conn, &(con->parent->frame_buffer), p->color->background, - dr->x + dr->width + br.width, dr->y, -br.width, dr->height); + dr->x + dr->width - 2 * logical_px(1), + dr->y, + 2 * logical_px(1), + dr->height); } /* Draw a 1px separator line before and after every tab, so that tabs can From e9798b7e3ee5d15c0ca62169b9f976fb15dedd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Wed, 13 Apr 2016 19:55:59 +0200 Subject: [PATCH 3/3] Use logical_px() and fix indentation. relates to #2247 --- src/x.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/x.c b/src/x.c index a6e3bde9..0fbc4d1c 100644 --- a/src/x.c +++ b/src/x.c @@ -555,8 +555,9 @@ void x_draw_decoration(Con *con) { draw_util_text(title, &(parent->frame_buffer), p->color->text, p->color->background, - con->deco_rect.x + 2, con->deco_rect.y + text_offset_y, - con->deco_rect.width - 2); + con->deco_rect.x + logical_px(2), + con->deco_rect.y + text_offset_y, + con->deco_rect.width - 2 * logical_px(2)); I3STRING_FREE(title); goto after_title; @@ -617,8 +618,9 @@ void x_draw_decoration(Con *con) { i3String *title = con->title_format == NULL ? win->name : con_parse_title_format(con); draw_util_text(title, &(parent->frame_buffer), p->color->text, p->color->background, - con->deco_rect.x + logical_px(2) + indent_px, con->deco_rect.y + text_offset_y, - con->deco_rect.width - logical_px(2) - indent_px - mark_width - logical_px(2)); + con->deco_rect.x + logical_px(2) + indent_px, + con->deco_rect.y + text_offset_y, + con->deco_rect.width - indent_px - mark_width - 2 * logical_px(2)); if (con->title_format != NULL) I3STRING_FREE(title);