From: Ingo Bürk Date: Thu, 16 Apr 2015 17:43:23 +0000 (+0200) Subject: Set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible due to... X-Git-Tag: 4.11~122^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ffe25d9e4312f1c9b132bc650341a4fa95ec13ad;p=i3%2Fi3 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 --- diff --git a/include/atoms.xmacro b/include/atoms.xmacro index b9ee4eb7..00a346db 100644 --- a/include/atoms.xmacro +++ b/include/atoms.xmacro @@ -5,6 +5,7 @@ xmacro(_NET_WM_MOVERESIZE) xmacro(_NET_WM_STATE_FULLSCREEN) xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) xmacro(_NET_WM_STATE_MODAL) +xmacro(_NET_WM_STATE_HIDDEN) xmacro(_NET_WM_STATE) xmacro(_NET_WM_WINDOW_TYPE) xmacro(_NET_WM_WINDOW_TYPE_NORMAL) diff --git a/src/ewmh.c b/src/ewmh.c index 1a357f23..a1d2489e 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -234,6 +234,6 @@ void ewmh_setup_hints(void) { /* I’m 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"); - /* only send the first 29 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); + /* 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, 30, supported_atoms); } diff --git a/src/x.c b/src/x.c index 7fe70445..2dcffe6b 100644 --- a/src/x.c +++ b/src/x.c @@ -36,6 +36,7 @@ typedef struct con_state { bool mapped; bool unmap_now; bool child_mapped; + bool is_hidden; /** The con for which this state is. */ Con *con; @@ -611,6 +612,33 @@ void x_deco_recurse(Con *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 * 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); } + set_hidden_state(con); + /* Handle all children and floating windows of this node. We recurse * in focus order to display the focused client in a stack first when * switching workspaces (reduces flickering). */