Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Dec 24, 2024
2 parents 5994a0b + b8568f6 commit 8ff7a01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 13 additions & 5 deletions kitty/child-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions kitty/cursor_trail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 8ff7a01

Please sign in to comment.