Infrastructure to render the unfocused cursor in multiple windows

This commit is contained in:
Kovid Goyal 2021-11-12 20:42:37 +05:30
parent 2c4f616213
commit 4fb29e1b6b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 12 additions and 1 deletions

View File

@ -641,7 +641,14 @@ prepare_to_render_os_window(OSWindow *os_window, monotonic_t now, unsigned int *
if (collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window)) needs_render = true;
set_os_window_title_from_window(w, os_window);
*active_window_bg = window_bg;
} else WD.screen->cursor_render_info.is_visible = false;
} else {
if (WD.screen->render_unfocused_cursor) {
if (collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window)) needs_render = true;
WD.screen->cursor_render_info.is_focused = false;
} else {
WD.screen->cursor_render_info.is_visible = false;
}
}
if (scan_for_animated_images) {
monotonic_t min_gap;
if (scan_active_animations(WD.screen->grman, now, &min_gap, true)) needs_render = true;

View File

@ -1015,6 +1015,7 @@ class Screen:
disable_ligatures: int
cursor_key_mode: bool
auto_repeat_enabled: bool
render_unfocused_cursor: int
def __init__(
self,

View File

@ -154,6 +154,7 @@ void
screen_reset(Screen *self) {
if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self, true, true);
if (self->overlay_line.is_active) deactivate_overlay_line(self);
self->render_unfocused_cursor = false;
memset(self->main_key_encoding_flags, 0, sizeof(self->main_key_encoding_flags));
memset(self->alt_key_encoding_flags, 0, sizeof(self->alt_key_encoding_flags));
self->display_window_char = 0;
@ -3735,6 +3736,7 @@ static PyMemberDef members[] = {
{"margin_top", T_UINT, offsetof(Screen, margin_top), READONLY, "margin_top"},
{"margin_bottom", T_UINT, offsetof(Screen, margin_bottom), READONLY, "margin_bottom"},
{"history_line_added_count", T_UINT, offsetof(Screen, history_line_added_count), 0, "history_line_added_count"},
{"render_unfocused_cursor", T_UINT, offsetof(Screen, render_unfocused_cursor), 0, "render_unfocused_cursor"},
{NULL}
};

View File

@ -112,6 +112,7 @@ typedef struct {
pthread_mutex_t read_buf_lock, write_buf_lock;
CursorRenderInfo cursor_render_info;
unsigned int render_unfocused_cursor;
struct {
size_t capacity, used;