Set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible due to being in the non-focused tab of a stacked or tabbed container.

fixes #1648
This commit is contained in:
Ingo Bürk 2015-04-16 19:43:23 +02:00
parent d12482e5fd
commit ffe25d9e43
3 changed files with 33 additions and 2 deletions

View File

@ -5,6 +5,7 @@ xmacro(_NET_WM_MOVERESIZE)
xmacro(_NET_WM_STATE_FULLSCREEN) xmacro(_NET_WM_STATE_FULLSCREEN)
xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) xmacro(_NET_WM_STATE_DEMANDS_ATTENTION)
xmacro(_NET_WM_STATE_MODAL) xmacro(_NET_WM_STATE_MODAL)
xmacro(_NET_WM_STATE_HIDDEN)
xmacro(_NET_WM_STATE) xmacro(_NET_WM_STATE)
xmacro(_NET_WM_WINDOW_TYPE) xmacro(_NET_WM_WINDOW_TYPE)
xmacro(_NET_WM_WINDOW_TYPE_NORMAL) xmacro(_NET_WM_WINDOW_TYPE_NORMAL)

View File

@ -234,6 +234,6 @@ void ewmh_setup_hints(void) {
/* Im not entirely sure if we need to keep _NET_WM_NAME on root. */ /* Im not entirely sure if we need to keep _NET_WM_NAME on root. */
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3"); xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
/* only send the first 29 atoms (last one is _NET_CLOSE_WINDOW) increment that number when adding supported atoms */ /* only send the first 30 atoms (last one is _NET_CLOSE_WINDOW) increment that number when adding supported atoms */
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, 29, supported_atoms); xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, 30, supported_atoms);
} }

30
src/x.c
View File

@ -36,6 +36,7 @@ typedef struct con_state {
bool mapped; bool mapped;
bool unmap_now; bool unmap_now;
bool child_mapped; bool child_mapped;
bool is_hidden;
/** The con for which this state is. */ /** The con for which this state is. */
Con *con; Con *con;
@ -611,6 +612,33 @@ void x_deco_recurse(Con *con) {
x_draw_decoration(con); x_draw_decoration(con);
} }
/*
* Sets or removes the _NET_WM_STATE_HIDDEN property on con if necessary.
*
*/
static void set_hidden_state(Con *con) {
if (con->window == NULL) {
return;
}
con_state *state = state_for_frame(con->frame);
bool should_be_hidden = con_is_hidden(con);
if (should_be_hidden == state->is_hidden)
return;
unsigned int num = 0;
uint32_t values[1];
if (should_be_hidden) {
DLOG("setting _NET_WM_STATE_HIDDEN for con = %p\n", con);
values[num++] = A__NET_WM_STATE_HIDDEN;
} else {
DLOG("removing _NET_WM_STATE_HIDDEN for con = %p\n", con);
}
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, con->window->id, A__NET_WM_STATE, XCB_ATOM_ATOM, 32, num, values);
state->is_hidden = should_be_hidden;
}
/* /*
* This function pushes the properties of each node of the layout tree to * This function pushes the properties of each node of the layout tree to
* X11 if they have changed (like the map state, position of the window, ). * X11 if they have changed (like the map state, position of the window, ).
@ -814,6 +842,8 @@ void x_push_node(Con *con) {
fake_absolute_configure_notify(con); fake_absolute_configure_notify(con);
} }
set_hidden_state(con);
/* Handle all children and floating windows of this node. We recurse /* Handle all children and floating windows of this node. We recurse
* in focus order to display the focused client in a stack first when * in focus order to display the focused client in a stack first when
* switching workspaces (reduces flickering). */ * switching workspaces (reduces flickering). */