Dont include dock clients in ewmh lists

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.
This commit is contained in:
Tony Crisci 2014-05-02 16:54:34 -04:00 committed by Michael Stapelberg
parent ff94d28b85
commit 4126c87daf
4 changed files with 29 additions and 3 deletions

View File

@ -37,6 +37,12 @@ void con_focus(Con *con);
*/ */
bool con_is_leaf(Con *con); bool con_is_leaf(Con *con);
/**
* Returns true when this con is a leaf node with a managed X11 window (e.g.,
* excluding dock containers)
*/
bool con_has_managed_window(Con *con);
/* /*
* Returns true if a container should be considered split. * Returns true if a container should be considered split.
* *

View File

@ -241,6 +241,17 @@ bool con_is_leaf(Con *con) {
return TAILQ_EMPTY(&(con->nodes_head)); return TAILQ_EMPTY(&(con->nodes_head));
} }
/*
* Returns true when this con is a leaf node with a managed X11 window (e.g.,
* excluding dock containers)
*/
bool con_has_managed_window(Con *con) {
return (con != NULL
&& con->window != NULL
&& con->window->id != XCB_WINDOW_NONE
&& con_get_workspace(con) != NULL);
}
/** /**
* Returns true if this node has regular or floating children. * Returns true if this node has regular or floating children.
* *

View File

@ -908,7 +908,7 @@ void x_push_changes(Con *con) {
* stack afterwards */ * stack afterwards */
int cnt = 0; int cnt = 0;
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) CIRCLEQ_FOREACH_REVERSE(state, &state_head, state)
if (state->con && state->con->window) if (con_has_managed_window(state->con))
cnt++; cnt++;
/* The bottom-to-top window stack of all windows which are managed by i3. /* The bottom-to-top window stack of all windows which are managed by i3.
@ -925,7 +925,7 @@ void x_push_changes(Con *con) {
/* X11 correctly represents the stack if we push it from bottom to top */ /* X11 correctly represents the stack if we push it from bottom to top */
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) { CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (state->con && state->con->window) if (con_has_managed_window(state->con))
memcpy(walk++, &(state->con->window->id), sizeof(xcb_window_t)); memcpy(walk++, &(state->con->window->id), sizeof(xcb_window_t));
//DLOG("stack: 0x%08x\n", state->id); //DLOG("stack: 0x%08x\n", state->id);
@ -956,7 +956,7 @@ void x_push_changes(Con *con) {
/* reorder by initial mapping */ /* reorder by initial mapping */
TAILQ_FOREACH(state, &initial_mapping_head, initial_mapping_order) { TAILQ_FOREACH(state, &initial_mapping_head, initial_mapping_order) {
if (state->con && state->con->window) if (con_has_managed_window(state->con))
*walk++ = state->con->window->id; *walk++ = state->con->window->id;
} }

View File

@ -96,4 +96,13 @@ wait_for_unmap($win3);
@clients = get_client_list; @clients = get_client_list;
is(@clients, 0, 'Removed unmapped client from list (0)'); is(@clients, 0, 'Removed unmapped client from list (0)');
# Dock clients should not be included in this list
my $dock_win = open_window({
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
});
@clients = get_client_list;
is(@clients, 0, 'Dock clients are not included in the list');
done_testing; done_testing;