This commit is contained in:
Kovid Goyal 2024-12-24 07:13:44 +05:30
commit 8ff7a01ecb
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 7 deletions

View file

@ -751,12 +751,20 @@ prepare_to_render_os_window(OSWindow *os_window, monotonic_t now, unsigned int *
WD.screen->cursor_render_info.is_focused = os_window->is_focused;
set_os_window_title_from_window(w, os_window);
*active_window_bg = window_bg;
if (OPT(cursor_trail) && update_cursor_trail(&tab->cursor_trail, w, now, os_window)) {
needs_render = true;
// A max wait of zero causes key input processing to be
// slow so handle the case of OPT(repaint_delay) == 0, see https://github.com/kovidgoyal/kitty/pull/8066
set_maximum_wait(MAX(OPT(repaint_delay), ms_to_monotonic_t(1ll)));
if (OPT(cursor_trail)) {
if (update_cursor_trail(&tab->cursor_trail, w, now, os_window)) {
needs_render = true;
// A max wait of zero causes key input processing to be
// slow so handle the case of OPT(repaint_delay) == 0, see https://github.com/kovidgoyal/kitty/pull/8066
set_maximum_wait(MAX(OPT(repaint_delay), ms_to_monotonic_t(1ll)));
} else if (OPT(cursor_trail) > now - WD.screen->cursor->position_changed_by_client_at) {
// If update_cursor_trail failed due to time threshold, the trail animation
// should be evaluated again shortly. Schedule next update when enough time
// has passed since the cursor was last moved.
set_maximum_wait(OPT(cursor_trail) - now + WD.screen->cursor->position_changed_by_client_at);
}
}
} else {
if (WD.screen->cursor_render_info.render_even_when_unfocused) {
if (collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window)) needs_render = true;

View file

@ -156,8 +156,7 @@ update_cursor_trail_needs_render(CursorTrail *ct, Window *w) {
bool
update_cursor_trail(CursorTrail *ct, Window *w, monotonic_t now, OSWindow *os_window) {
if (!WD.screen->paused_rendering.expires_at && OPT(cursor_trail) < now - WD.screen->cursor->position_changed_by_client_at) {
if (!WD.screen->paused_rendering.expires_at && OPT(cursor_trail) <= now - WD.screen->cursor->position_changed_by_client_at) {
update_cursor_trail_target(ct, w);
}