Fix event loop continuously ticking every input_delay seconds even when no input is available

This commit is contained in:
Kovid Goyal 2024-01-25 15:26:05 +05:30
parent fa11858a72
commit fd7d0f8787
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -441,9 +441,11 @@ do_parse(ChildMonitor *self, Screen *screen, monotonic_t now, bool flush) {
if (pd.input_read) {
if (pd.write_space_created) wakeup_io_loop(self, false);
}
if (pd.input_read && screen->paused_rendering.expires_at) {
set_maximum_wait(MAX(0, screen->paused_rendering.expires_at - now));
} else set_maximum_wait(OPT(input_delay) - pd.time_since_new_input);
if (pd.input_read) {
if (screen->paused_rendering.expires_at) {
set_maximum_wait(MAX(0, screen->paused_rendering.expires_at - now));
} else set_maximum_wait(OPT(input_delay) - pd.time_since_new_input);
}
return pd.input_read;
}