From cb587f942a8d56ef8dd03451acfeb71c7638e6f7 Mon Sep 17 00:00:00 2001 From: Vftdan Date: Wed, 1 Jan 2020 22:42:38 +0300 Subject: [PATCH] Do not sleep after the last iteration --- src/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 9db704f..7bf9f1e 100644 --- a/src/main.c +++ b/src/main.c @@ -306,17 +306,18 @@ int main(int argc, char ** argv) signal(SIGUSR1, sig_handler); signal(SIGUSR2, sig_handler); - running = 1; + if (max_iters != 0) + running = 1; unsigned long i = 0; while (running) { - if (max_iters != -1 && i++ >= max_iters) - break; if (grabk) check_keyboard(screen); if (grabp) check_pointer(screen); xcb_flush(conn); + if (max_iters != -1 && ++i >= max_iters) + break; if (running) sleep_ms(delay_ms); }