]> git.sur5r.net Git - i3/i3/blobdiff - src/tree.c
Bugfix: Keep focus on the current workspace when moving containers, add testcase
[i3/i3] / src / tree.c
index 491548da56d55160b3931f37096decf57a518ce3..f695f944b4b79ffb9f1d9e46593259985d4b32ea 100644 (file)
@@ -138,20 +138,7 @@ void tree_close(Con *con, bool kill_window) {
     fix_floating_parent(croot, con);
 
     /* Get the container which is next focused */
-    Con *next;
-    if (con->type == CT_FLOATING_CON) {
-        next = TAILQ_NEXT(con, floating_windows);
-        if (next == TAILQ_END(&(parent->floating_head)))
-            next = con_get_workspace(con);
-    } else {
-        next = TAILQ_NEXT(con, focused);
-        if (next == TAILQ_END(&(parent->nodes_head))) {
-            next = parent;
-            while (!TAILQ_EMPTY(&(next->focus_head)) &&
-                   TAILQ_FIRST(&(next->focus_head)) != con)
-                next = TAILQ_FIRST(&(next->focus_head));
-        }
-    }
+    Con *next = con_next_focused(con);
 
     DLOG("closing %p, kill_window = %d\n", con, kill_window);
     Con *child;