]> git.sur5r.net Git - i3/i3/blobdiff - src/con.c
refactor some places to use con_descend_focused instead of duplicating code
[i3/i3] / src / con.c
index 2f02bfcd8a4a9a7613c5160c465d96679fb8ae87..50e303ca6a3b5fa19de7fdf2dd7629b638e248b7 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -483,12 +483,8 @@ void con_move_to_workspace(Con *con, Con *workspace) {
      * container is moved away */
     Con *focus_next = con_next_focused(con);
 
-    /* 2: get the focused container of this workspace by going down as far as
-     * possible */
-    Con *next = workspace;
-
-    while (!TAILQ_EMPTY(&(next->focus_head)))
-        next = TAILQ_FIRST(&(next->focus_head));
+    /* 2: get the focused container of this workspace */
+    Con *next = con_descend_focused(workspace);
 
     /* 3: we go up one level, but only when next is a normal container */
     if (next->type != CT_WORKSPACE)