]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: correctly handle unmapped tray clients, reconfigure tray icons after mapping...
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 9 Nov 2011 23:22:44 +0000 (23:22 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 9 Nov 2011 23:22:44 +0000 (23:22 +0000)
Fixes #550

i3bar/src/xcb.c

index d1fcac7c60e2e7550c398b9e5bbd34ffc1e29c4c..b4af10ba77535ec9ee9556f186b6e956a1d4bee5 100644 (file)
@@ -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)