diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index cd16c49f6..92c9ea61c 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -517,7 +517,8 @@ collect_cursor_info(CursorRenderInfo *ans, Window *w, double now, OSWindow *os_w ColorProfile *cp = rd->screen->color_profile; ans->shape = cursor->shape ? cursor->shape : OPT(cursor_shape); ans->color = colorprofile_to_color(cp, cp->overridden.cursor_color, cp->configured.cursor_color); - if (ans->shape == CURSOR_BLOCK) return; + ans->is_focused = os_window->is_focused; + if (ans->shape == CURSOR_BLOCK && !ans->is_focused) return; double left = rd->xstart + cursor->x * rd->dx; double top = rd->ystart - cursor->y * rd->dy; unsigned long mult = MAX(1, screen_current_char_width(rd->screen)); @@ -577,7 +578,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int *active_window_id update_window_title(w, os_window); } else WD.screen->cursor_render_info.is_visible = false; draw_cells(WD.vao_idx, WD.gvao_idx, WD.xstart, WD.ystart, WD.dx, WD.dy, WD.screen, os_window); - if (is_active_window && WD.screen->cursor_render_info.is_visible && WD.screen->cursor_render_info.shape != CURSOR_BLOCK) { + if (is_active_window && WD.screen->cursor_render_info.is_visible && (!WD.screen->cursor_render_info.is_focused || WD.screen->cursor_render_info.shape != CURSOR_BLOCK)) { draw_cursor(&WD.screen->cursor_render_info, os_window->is_focused); } if (WD.screen->start_visual_bell_at != 0) { @@ -1029,4 +1030,3 @@ init_child_monitor(PyObject *module) { } // }}} - diff --git a/kitty/data-types.h b/kitty/data-types.h index 3d2b9a38c..7d981ee52 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -181,7 +181,7 @@ typedef struct { } Cursor; typedef struct { - bool is_visible; + bool is_visible, is_focused; CursorShape shape; unsigned int x, y; double left, right, top, bottom; diff --git a/kitty/shaders.c b/kitty/shaders.c index c2e69a04d..5514f8480 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -220,7 +220,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, G copy_color_table_to_buffer(screen->color_profile, (GLuint*)rd, cell_program_layouts[CELL_PROGRAM].color_table.offset / sizeof(GLuint), cell_program_layouts[CELL_PROGRAM].color_table.stride / sizeof(GLuint)); } // Cursor position - if (cursor->is_visible && cursor->shape == CURSOR_BLOCK) { + if (cursor->is_visible && cursor->shape == CURSOR_BLOCK && cursor->is_focused) { rd->cursor_x = screen->cursor->x, rd->cursor_y = screen->cursor->y; } else { rd->cursor_x = screen->columns, rd->cursor_y = screen->lines;