From 1784b3858d5b0180653ec29fdcebc34e8fbc94d4 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 21 Jan 2012 10:59:23 +0000 Subject: [PATCH] Bugfix: Redraw right border after rendering the window title (Thanks fernandotcl) Fixes #368 --- src/x.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/x.c b/src/x.c index 21356444..8eacd2b7 100644 --- a/src/x.c +++ b/src/x.c @@ -384,7 +384,7 @@ void x_draw_decoration(Con *con) { } } - /* if this is a borderless/1pixel window, we don’t * need to render the + /* if this is a borderless/1pixel window, we don’t need to render the * decoration. */ if (p->border_style != BS_NORMAL) goto copy_pixmaps; @@ -443,6 +443,22 @@ void x_draw_decoration(Con *con) { con->deco_rect.x + 2 + indent_px, con->deco_rect.y + text_offset_y, con->deco_rect.width - 2 - indent_px); + /* Since we don’t clip the text at all, it might in some cases be painted + * on the border pixels on the right side of a window. Therefore, we draw + * the right border again after rendering the text (and the unconnected + * lines in border color). */ + xcb_change_gc(conn, parent->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->background }); + xcb_poly_line(conn, XCB_COORD_MODE_ORIGIN, parent->pixmap, parent->pm_gc, 4, + (xcb_point_t[]){ + { dr->x + dr->width - 1, dr->y }, + { dr->x + dr->width - 1, dr->y + dr->height }, + { dr->x + dr->width - 2, dr->y }, + { dr->x + dr->width - 2, dr->y + dr->height } + }); + + xcb_change_gc(conn, parent->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->border }); + xcb_poly_segment(conn, parent->pixmap, parent->pm_gc, 2, segments); + copy_pixmaps: xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height); } -- 2.39.5