i3 - improved tiling WM


Dont include dock clients in ewmh lists

Patch status: needinfo

Patch by Tony Crisci

Long description:

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368149456

The _NET_CLIENT_LIST property of the root window:

> These arrays contain all X Windows managed by the Window Manager.

Dock clients are not managed windows, so they should not be included in
_NET_CLIENT_LIST or _NET_CLIENT_LIST_STACKING.

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

b/include/con.h

24
@@ -37,6 +37,12 @@ void con_focus(Con *con);
25
  */
26
 bool con_is_leaf(Con *con);
27
 
28
+/**
29
+ * Returns true when this is an attached container that hosts a managed client
30
+ * window (accepts null).
31
+ */
32
+bool con_is_top_level(Con *con);
33
+
34
 /*
35
  * Returns true if a container should be considered split.
36
  *

b/src/con.c

41
@@ -241,6 +241,17 @@ bool con_is_leaf(Con *con) {
42
     return TAILQ_EMPTY(&(con->nodes_head));
43
 }
44
 
45
+/*
46
+ * Returns true when this is an attached container that hosts a managed client
47
+ * window (accepts null).
48
+ */
49
+bool con_is_top_level(Con *con) {
50
+    return (con != NULL
51
+            && con->window != NULL
52
+            && con->window->id != XCB_WINDOW_NONE
53
+            && con_get_workspace(con) != NULL);
54
+}
55
+
56
 /**
57
  * Returns true if this node has regular or floating children.
58
  *

b/src/x.c

63
@@ -908,7 +908,7 @@ void x_push_changes(Con *con) {
64
      * stack afterwards */
65
     int cnt = 0;
66
     CIRCLEQ_FOREACH_REVERSE(state, &state_head, state)
67
-        if (state->con && state->con->window)
68
+        if (con_is_top_level(state->con))
69
             cnt++;
70
 
71
     /* The bottom-to-top window stack of all windows which are managed by i3.
72
@@ -925,7 +925,7 @@ void x_push_changes(Con *con) {
73
 
74
     /* X11 correctly represents the stack if we push it from bottom to top */
75
     CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
76
-        if (state->con && state->con->window)
77
+        if (con_is_top_level(state->con))
78
             memcpy(walk++, &(state->con->window->id), sizeof(xcb_window_t));
79
 
80
         //DLOG("stack: 0x%08x\n", state->id);
81
@@ -956,7 +956,7 @@ void x_push_changes(Con *con) {
82
 
83
         /* reorder by initial mapping */
84
         TAILQ_FOREACH(state, &initial_mapping_head, initial_mapping_order) {
85
-            if (state->con && state->con->window)
86
+            if (con_is_top_level(state->con))
87
                 *walk++ = state->con->window->id;
88
         }
89
 

b/testcases/t/223-net-client-list.t

94
@@ -96,4 +96,13 @@ wait_for_unmap($win3);
95
 @clients = get_client_list;
96
 is(@clients, 0, 'Removed unmapped client from list (0)');
97
 
98
+# Dock clients should not be included in this list
99
+
100
+my $dock_win = open_window({
101
+        window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
102
+    });
103
+
104
+@clients = get_client_list;
105
+is(@clients, 0, 'Dock clients are not included in the list');
106
+
107
 done_testing;