X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fewmh.c;h=f4bb049ae6c35c60ff3508bbed2b0fd126dd7681;hb=3b75be1334eab7a2c3513cb0e52969480b97199d;hp=05f4d3cd0229e891af3515fcac569bfe7a16fb86;hpb=328035fb7e98630862ae8b43088631f62b807c77;p=i3%2Fi3 diff --git a/src/ewmh.c b/src/ewmh.c index 05f4d3cd..f4bb049a 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -1,5 +1,3 @@ -#undef I3__FILE__ -#define I3__FILE__ "ewmh.c" /* * vim:ts=4:sw=4:expandtab * @@ -124,11 +122,13 @@ void ewmh_update_desktop_viewport(void) { } static void ewmh_update_wm_desktop_recursively(Con *con, const uint32_t desktop) { - /* Recursively call this to descend through the entire subtree. */ Con *child; + + /* Recursively call this to descend through the entire subtree. */ TAILQ_FOREACH(child, &(con->nodes_head), nodes) { ewmh_update_wm_desktop_recursively(child, desktop); } + /* If con is a workspace, we also need to go through the floating windows on it. */ if (con->type == CT_WORKSPACE) { TAILQ_FOREACH(child, &(con->floating_head), floating_windows) { @@ -139,8 +139,6 @@ static void ewmh_update_wm_desktop_recursively(Con *con, const uint32_t desktop) if (!con_has_managed_window(con)) return; - const xcb_window_t window = con->window->id; - uint32_t wm_desktop = desktop; /* Sticky windows are only actually sticky when they are floating or inside * a floating container. This is technically still slightly wrong, since @@ -151,11 +149,20 @@ static void ewmh_update_wm_desktop_recursively(Con *con, const uint32_t desktop) wm_desktop = NET_WM_DESKTOP_ALL; } + /* If the window is on the scratchpad we assign the sticky value to it + * since showing it works on any workspace. We cannot remove the property + * as per specification. */ + Con *ws = con_get_workspace(con); + if (ws != NULL && con_is_internal(ws)) { + wm_desktop = NET_WM_DESKTOP_ALL; + } + /* If this is the cached value, we don't need to do anything. */ if (con->window->wm_desktop == wm_desktop) return; con->window->wm_desktop = wm_desktop; + const xcb_window_t window = con->window->id; if (wm_desktop != NET_WM_DESKTOP_NONE) { DLOG("Setting _NET_WM_DESKTOP = %d for window 0x%08x.\n", wm_desktop, window); xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, A__NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &wm_desktop); @@ -179,11 +186,11 @@ void ewmh_update_wm_desktop(void) { TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { Con *workspace; TAILQ_FOREACH(workspace, &(output_get_content(output)->nodes_head), nodes) { - if (con_is_internal(workspace)) - continue; - ewmh_update_wm_desktop_recursively(workspace, desktop); - ++desktop; + + if (!con_is_internal(workspace)) { + ++desktop; + } } } } @@ -284,7 +291,7 @@ void ewmh_update_sticky(xcb_window_t window, bool sticky) { void ewmh_setup_hints(void) { xcb_atom_t supported_atoms[] = { #define xmacro(atom) A_##atom, -#include "atoms.xmacro" +#include "atoms_NET_SUPPORTED.xmacro" #undef xmacro }; @@ -313,8 +320,7 @@ 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 32 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, /* number of atoms */ 32, supported_atoms); + xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, /* number of atoms */ sizeof(supported_atoms) / sizeof(xcb_atom_t), supported_atoms); /* We need to map this window to be able to set the input focus to it if no other window is available to be focused. */ xcb_map_window(conn, ewmh_window);