From b7b8362175db111456c776eef6f905c25d76f2b6 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 27 Nov 2017 02:25:59 +0100 Subject: [PATCH] Remove timeout_cnt The structure is not needed, as next_timeout gets invalidated via current time and not the amount of all timeouts. --- src/dunst.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/dunst.c b/src/dunst.c index 05ede85..933f7f8 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -53,13 +53,8 @@ gboolean run(void *data) queues_check_timeouts(x_is_idle()); queues_update(); - static int timeout_cnt = 0; static gint64 next_timeout = 0; - if (data && timeout_cnt > 0) { - timeout_cnt--; - } - if (!xctx.visible && queues_length_displayed() > 0) { x_win_show(); } @@ -78,10 +73,9 @@ gboolean run(void *data) gint64 timeout_at = now + sleep; if (sleep >= 0) { - if (timeout_cnt == 0 || next_timeout < now || timeout_at < next_timeout) { - g_timeout_add(sleep/1000, run, mainloop); + if (next_timeout < now || timeout_at < next_timeout) { + g_timeout_add(sleep/1000, run, NULL); next_timeout = timeout_at; - timeout_cnt++; } } }