From: NeilBrown Date: Mon, 11 Sep 2023 08:59:15 +0000 (+1000) Subject: display-x11: don't draw both cursors. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=004ff26215c7d93564ee1cde7e68bec8a1238d48;p=edlib.git display-x11: don't draw both cursors. We were always drawing the outline cursor, and sometimes the block cursor. This is pointless. Signed-off-by: NeilBrown --- diff --git a/display-x11-xcb.c b/display-x11-xcb.c index fc8c732e..e768e935 100644 --- a/display-x11-xcb.c +++ b/display-x11-xcb.c @@ -758,26 +758,27 @@ DEF_CMD(xcb_draw_text) curs.width = log.width; } - /* Add half to x,y as stroke is either side of the line */ - cx = x * PANGO_SCALE + curs.x + PANGO_SCALE/2; - cy = (y - baseline) * PANGO_SCALE + curs.y + PANGO_SCALE/2; - ch = curs.height - PANGO_SCALE; - cw = curs.width - PANGO_SCALE; - cairo_rectangle(ctx, cx/PANGO_SCALE, cy/PANGO_SCALE, - cw/PANGO_SCALE, ch/PANGO_SCALE); - cairo_set_line_width(ctx, 1.0); - cairo_stroke(ctx); - while (in_focus && f->parent->parent != f && f->parent != ci->home) { if (f->parent->focus != f && f->z >= 0) in_focus = False; f = f->parent; } - if (in_focus) { - if (fg.g >= 0) - cairo_set_source_rgb(ctx, fg.r, fg.g, fg.b); - cairo_rectangle(ctx, x+curs.x/PANGO_SCALE, + if (!in_focus) { + /* Just an fg:rectangle around the fg:text */ + /* Add half to x,y as stroke is either side of the line */ + cx = x * PANGO_SCALE + curs.x + PANGO_SCALE/2; + cy = (y - baseline) * PANGO_SCALE + curs.y + PANGO_SCALE/2; + ch = curs.height - PANGO_SCALE; + cw = curs.width - PANGO_SCALE; + cairo_rectangle(ctx, cx/PANGO_SCALE, cy/PANGO_SCALE, + cw/PANGO_SCALE, ch/PANGO_SCALE); + cairo_set_line_width(ctx, 1.0); + cairo_stroke(ctx); + } else { + /* solid fd:block with txt in bg color */ + cairo_rectangle(ctx, + x+curs.x/PANGO_SCALE, y-baseline+curs.y/PANGO_SCALE, curs.width / PANGO_SCALE, curs.height / PANGO_SCALE);