From: Michael Stapelberg Date: Wed, 9 Nov 2011 23:22:44 +0000 (+0000) Subject: i3bar: correctly handle unmapped tray clients, reconfigure tray icons after mapping... X-Git-Tag: 4.1~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e85a352fcf13c342de75c56c73fac0f95c1d822b;p=i3%2Fi3 i3bar: correctly handle unmapped tray clients, reconfigure tray icons after mapping/unmapping (Thanks IsoLnCHiP) Fixes #550 --- diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index d1fcac7c..b4af10ba 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -373,6 +373,8 @@ static void configure_trayclients() { int clients = 0; TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) { + if (!trayclient->mapped) + continue; clients++; DLOG("Configuring tray window %08x to x=%d\n", @@ -595,8 +597,10 @@ static void handle_property_notify(xcb_property_notify_event_t *event) { xcb_get_property_reply_t *xembedr = xcb_get_property_reply(xcb_connection, xembedc, NULL); - if (xembedr == NULL || xembedr->length == 0) + if (xembedr == NULL || xembedr->length == 0) { + DLOG("xembed_info unset\n"); return; + } DLOG("xembed format = %d, len = %d\n", xembedr->format, xembedr->length); uint32_t *xembed = xcb_get_property_value(xembedr); @@ -608,11 +612,13 @@ static void handle_property_notify(xcb_property_notify_event_t *event) { /* need to unmap the window */ xcb_unmap_window(xcb_connection, trayclient->win); trayclient->mapped = map_it; + configure_trayclients(); draw_bars(); } else if (!trayclient->mapped && map_it) { /* need to map the window */ xcb_map_window(xcb_connection, trayclient->win); trayclient->mapped = map_it; + configure_trayclients(); draw_bars(); } free(xembedr); @@ -635,6 +641,8 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { int clients = 0; TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) { + if (!trayclient->mapped) + continue; clients++; if (trayclient->win != event->window)