Remove timeout_cnt
The structure is not needed, as next_timeout gets invalidated via current time and not the amount of all timeouts.
This commit is contained in:
parent
2a823eb381
commit
b7b8362175
10
src/dunst.c
10
src/dunst.c
@ -53,13 +53,8 @@ gboolean run(void *data)
|
|||||||
queues_check_timeouts(x_is_idle());
|
queues_check_timeouts(x_is_idle());
|
||||||
queues_update();
|
queues_update();
|
||||||
|
|
||||||
static int timeout_cnt = 0;
|
|
||||||
static gint64 next_timeout = 0;
|
static gint64 next_timeout = 0;
|
||||||
|
|
||||||
if (data && timeout_cnt > 0) {
|
|
||||||
timeout_cnt--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xctx.visible && queues_length_displayed() > 0) {
|
if (!xctx.visible && queues_length_displayed() > 0) {
|
||||||
x_win_show();
|
x_win_show();
|
||||||
}
|
}
|
||||||
@ -78,10 +73,9 @@ gboolean run(void *data)
|
|||||||
gint64 timeout_at = now + sleep;
|
gint64 timeout_at = now + sleep;
|
||||||
|
|
||||||
if (sleep >= 0) {
|
if (sleep >= 0) {
|
||||||
if (timeout_cnt == 0 || next_timeout < now || timeout_at < next_timeout) {
|
if (next_timeout < now || timeout_at < next_timeout) {
|
||||||
g_timeout_add(sleep/1000, run, mainloop);
|
g_timeout_add(sleep/1000, run, NULL);
|
||||||
next_timeout = timeout_at;
|
next_timeout = timeout_at;
|
||||||
timeout_cnt++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user