From 12a1688ce3c1b1e105917d95f5ba7c70c618dfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 11 Jul 2020 09:06:36 +0200 Subject: [PATCH] render: use kbd-focus instead of visual focus for hollow block cursor When determining whether we should render a hollow block cursor, i.e. to signal that we're unfocused, base the decision on the terminals current keyboard focus, not visual focus. --- render.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/render.c b/render.c index 670b9282..7f4596b0 100644 --- a/render.c +++ b/render.c @@ -328,7 +328,7 @@ draw_cursor(const struct terminal *term, const struct cell *cell, switch (term->cursor_style) { case CURSOR_BLOCK: - if (!term->visual_focus) + if (!term->kbd_focus) draw_unfocused_block(term, pix, &cursor_color, x, y, cols); else if (term->cursor_blink.state == CURSOR_BLINK_ON) { @@ -340,12 +340,12 @@ draw_cursor(const struct terminal *term, const struct cell *cell, break; case CURSOR_BAR: - if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->visual_focus) + if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->kbd_focus) draw_bar(term, pix, font, &cursor_color, x, y); break; case CURSOR_UNDERLINE: - if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->visual_focus) { + if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->kbd_focus) { draw_underline( term, pix, attrs_to_font(term, &cell->attrs), &cursor_color, x, y, cols); @@ -435,7 +435,7 @@ render_cell(struct terminal *term, pixman_image_t *pix, if (cell->attrs.blink) term_arm_blink_timer(term); - if (has_cursor && term->cursor_style == CURSOR_BLOCK && term->visual_focus) + if (has_cursor && term->cursor_style == CURSOR_BLOCK && term->kbd_focus) draw_cursor(term, cell, font, pix, &fg, &bg, x, y, cell_cols); if (cell->wc == 0 || cell->attrs.conceal) @@ -495,7 +495,7 @@ render_cell(struct terminal *term, pixman_image_t *pix, } draw_cursor: - if (has_cursor && (term->cursor_style != CURSOR_BLOCK || !term->visual_focus)) + if (has_cursor && (term->cursor_style != CURSOR_BLOCK || !term->kbd_focus)) draw_cursor(term, cell, font, pix, &fg, &bg, x, y, cell_cols); pixman_image_set_clip_region32(pix, NULL);