From 17b477d25d0acad41bde5ac8c23abc849da815c8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 22 Apr 2012 20:53:01 +0200 Subject: [PATCH] i3bar: when kicking tray clients, remove them immediately This should fix empty spaces showing up instead of tray icons sometimes. --- i3bar/src/xcb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index 67572480..c2cf6879 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -1110,7 +1110,8 @@ void get_atoms() { */ void kick_tray_clients(i3_output *output) { trayclient *trayclient; - TAILQ_FOREACH(trayclient, output->trayclients, tailq) { + while (!TAILQ_EMPTY(output->trayclients)) { + trayclient = TAILQ_FIRST(output->trayclients); /* Unmap, then reparent (to root) the tray client windows */ xcb_unmap_window(xcb_connection, trayclient->win); xcb_reparent_window(xcb_connection, @@ -1118,7 +1119,14 @@ void kick_tray_clients(i3_output *output) { xcb_root, 0, 0); + + /* We remove the trayclient right here. We might receive an UnmapNotify + * event afterwards, but better safe than sorry. */ + TAILQ_REMOVE(output->trayclients, trayclient, tailq); } + + /* Trigger an update, we now have more space for the statusline */ + draw_bars(); } /* -- 2.39.5