From a08931d84dead1732115f43cd8693240ffca1ca0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Dec 2019 08:46:50 +0530 Subject: [PATCH] Fix window not being rendered for the first time until some input has been received from child process Fixes #2216 --- docs/changelog.rst | 4 ++++ kitty/child-monitor.c | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 3d3af663b..93f61d009 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,10 @@ To update |kitty|, :doc:`follow the instructions `. - Fix lines at the edge of the window at certain windows sizes when drawing images on a transparent window (:iss:`2079`) +- Fix window not being rendered for the first time until some input has been + received from child process (:iss:`2216`) + + 0.15.0 [2019-11-27] -------------------- diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index da51d98b5..c389bf47f 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -649,7 +649,7 @@ static inline void render(monotonic_t now, bool input_read) { EVDBG("input_read: %d", input_read); static monotonic_t last_render_at = MONOTONIC_T_MIN; - monotonic_t time_since_last_render = now - last_render_at; + monotonic_t time_since_last_render = last_render_at == MONOTONIC_T_MIN ? OPT(repaint_delay) : now - last_render_at; if (!input_read && time_since_last_render < OPT(repaint_delay)) { set_maximum_wait(OPT(repaint_delay) - time_since_last_render); return; @@ -916,10 +916,14 @@ process_global_state(void *data) { ChildMonitor *self = data; maximum_wait = -1; bool state_check_timer_enabled = false; + bool input_read = false; monotonic_t now = monotonic(); - if (global_state.has_pending_resizes) process_pending_resizes(now); - bool input_read = parse_input(self); + if (global_state.has_pending_resizes) { + process_pending_resizes(now); + input_read = true; + } + if (parse_input(self)) input_read = true; render(now, input_read); #ifdef __APPLE__ if (cocoa_pending_actions) {