mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-10 08:20:59 -04:00
render: draw_cursor: use terminal's visual focus to determine cursor shape
This commit is contained in:
parent
0e40e1c711
commit
29483f936f
1 changed files with 3 additions and 5 deletions
8
render.c
8
render.c
|
|
@ -279,8 +279,6 @@ draw_cursor(const struct terminal *term, const struct cell *cell,
|
||||||
pixman_image_t *pix, pixman_color_t *fg, const pixman_color_t *bg,
|
pixman_image_t *pix, pixman_color_t *fg, const pixman_color_t *bg,
|
||||||
int x, int y, int cols)
|
int x, int y, int cols)
|
||||||
{
|
{
|
||||||
bool have_focus = term->wl->kbd_focus == term;
|
|
||||||
|
|
||||||
pixman_color_t cursor_color;
|
pixman_color_t cursor_color;
|
||||||
pixman_color_t text_color;
|
pixman_color_t text_color;
|
||||||
|
|
||||||
|
|
@ -307,7 +305,7 @@ draw_cursor(const struct terminal *term, const struct cell *cell,
|
||||||
|
|
||||||
switch (term->cursor_style) {
|
switch (term->cursor_style) {
|
||||||
case CURSOR_BLOCK:
|
case CURSOR_BLOCK:
|
||||||
if (!have_focus)
|
if (!term->visual_focus)
|
||||||
draw_unfocused_block(term, pix, &cursor_color, x, y, cols);
|
draw_unfocused_block(term, pix, &cursor_color, x, y, cols);
|
||||||
|
|
||||||
else if (term->cursor_blink.state == CURSOR_BLINK_ON) {
|
else if (term->cursor_blink.state == CURSOR_BLINK_ON) {
|
||||||
|
|
@ -319,12 +317,12 @@ draw_cursor(const struct terminal *term, const struct cell *cell,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_BAR:
|
case CURSOR_BAR:
|
||||||
if (term->cursor_blink.state == CURSOR_BLINK_ON || !have_focus)
|
if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->visual_focus)
|
||||||
draw_bar(term, pix, font, &cursor_color, x, y);
|
draw_bar(term, pix, font, &cursor_color, x, y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_UNDERLINE:
|
case CURSOR_UNDERLINE:
|
||||||
if (term->cursor_blink.state == CURSOR_BLINK_ON || !have_focus) {
|
if (term->cursor_blink.state == CURSOR_BLINK_ON || !term->visual_focus) {
|
||||||
draw_underline(
|
draw_underline(
|
||||||
term, pix, attrs_to_font(term, &cell->attrs), &cursor_color,
|
term, pix, attrs_to_font(term, &cell->attrs), &cursor_color,
|
||||||
x, y, cols);
|
x, y, cols);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue