From: Michael Stapelberg Date: Sun, 22 Apr 2012 18:53:01 +0000 (+0200) Subject: i3bar: when kicking tray clients, remove them immediately X-Git-Tag: 4.2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=17b477d25d0acad41bde5ac8c23abc849da815c8;p=i3%2Fi3 i3bar: when kicking tray clients, remove them immediately This should fix empty spaces showing up instead of tray icons sometimes. --- 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(); } /*