From 81fae350c95f730eebefa2e92295b972072b1e18 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Thu, 13 Sep 2018 18:00:36 +0300 Subject: [PATCH] Fix draw being called twice when mapping the window --- src/dunst.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dunst.c b/src/dunst.c index 5abd86e..0e98055 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -51,8 +51,12 @@ static gboolean run(void *data) static gint64 next_timeout = 0; - if (!x_win_visible(win) && queues_length_displayed() > 0) { + // Call draw before showing the window to avoid flickering + if (queues_length_displayed() > 0) { draw(); + } + + if (!x_win_visible(win) && queues_length_displayed() > 0) { x_win_show(win); } @@ -60,10 +64,6 @@ static gboolean run(void *data) x_win_hide(win); } - if (x_win_visible(win)) { - draw(); - } - if (x_win_visible(win)) { gint64 now = time_monotonic_now(); gint64 sleep = queues_get_next_datachange(now);