i3 - improved tiling WM


i3bar: Set `mapped` flag on trayclient creation

Patch status: merged

Patch by Tony Crisci

Long description:

When a trayclient is first created as a structure in memory, explicitly
set the `mapped` flag to false. Otherwise it may initialize to `true` in
some circumstances without actually being mapped, causing a request to
be mapped from the client to be ignored.

Create the trayclient in memory before handling a request to be mapped
immediately.

fixes #1138

To apply this patch, use:
curl http://cr.i3wm.org/patch/354/raw.patch | git am

b/i3bar/src/xcb.c

22
@@ -603,17 +603,18 @@ static void handle_client_message(xcb_client_message_event_t* event) {
23
              * exits/crashes. */
24
             xcb_change_save_set(xcb_connection, XCB_SET_MODE_INSERT, client);
25
 
26
+            trayclient *tc = smalloc(sizeof(trayclient));
27
+            tc->win = client;
28
+            tc->xe_version = xe_version;
29
+            tc->mapped = false;
30
+            TAILQ_INSERT_TAIL(output->trayclients, tc, tailq);
31
+
32
             if (map_it) {
33
                 DLOG("Mapping dock client\n");
34
                 xcb_map_window(xcb_connection, client);
35
             } else {
36
                 DLOG("Not mapping dock client yet\n");
37
             }
38
-            trayclient *tc = smalloc(sizeof(trayclient));
39
-            tc->win = client;
40
-            tc->xe_version = xe_version;
41
-            TAILQ_INSERT_TAIL(output->trayclients, tc, tailq);
42
-
43
             /* Trigger an update to copy the statusline text to the appropriate
44
              * position */
45
             configure_trayclients();