]> git.sur5r.net Git - i3/i3/blobdiff - src/con.c
Implement dock mode, update testsuite
[i3/i3] / src / con.c
index 92b05fd7430f6dbc0a7f5a9093ee6000c76617b8..b1e652a28f8499616e5caf34f1a6b29d0df22224 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -226,7 +226,6 @@ Con *con_get_workspace(Con *con) {
     Con *result = con;
     while (result != NULL && result->type != CT_WORKSPACE)
         result = result->parent;
-    assert(result != NULL);
     return result;
 }
 
@@ -694,6 +693,8 @@ Rect con_border_style_rect(Con *con) {
  * borderless and the only element in the tabbed container, the border is not
  * rendered.
  *
+ * For children of a CT_DOCKAREA, the border style is always none.
+ *
  */
 int con_border_style(Con *con) {
     Con *fs = con_get_fullscreen_con(con->parent);
@@ -708,6 +709,9 @@ int con_border_style(Con *con) {
     if (con->parent->layout == L_TABBED && con->border_style != BS_NORMAL)
         return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
 
+    if (con->parent->type == CT_DOCKAREA)
+        return BS_NONE;
+
     return con->border_style;
 }
 
@@ -773,8 +777,12 @@ void con_set_layout(Con *con, int layout) {
 static void con_on_remove_child(Con *con) {
     DLOG("on_remove_child\n");
 
-    /* Nothing to do for workspaces */
-    if (con->type == CT_WORKSPACE || con->type == CT_OUTPUT || con->type == CT_ROOT) {
+    /* Every container 'above' (in the hierarchy) the workspace content should
+     * not be closed when the last child was removed */
+    if (con->type == CT_WORKSPACE ||
+        con->type == CT_OUTPUT ||
+        con->type == CT_ROOT ||
+        con->type == CT_DOCKAREA) {
         DLOG("not handling, type = %d\n", con->type);
         return;
     }
@@ -787,28 +795,4 @@ static void con_on_remove_child(Con *con) {
         tree_close(con, false, false);
         return;
     }
-
-    /* If we did not close the container, check if we have only a single child left */
-    if (children == 1) {
-        Con *child = TAILQ_FIRST(&(con->nodes_head));
-        Con *parent = con->parent;
-        DLOG("Container has only one child, replacing con %p with child %p\n", con, child);
-
-        /* TODO: refactor it into con_swap */
-        TAILQ_REPLACE(&(parent->nodes_head), con, child, nodes);
-        TAILQ_REPLACE(&(parent->focus_head), con, child, focused);
-        if (focused == con)
-            focused = child;
-        child->parent = parent;
-        child->percent = 0.0;
-        con_fix_percent(parent);
-
-        con->parent = NULL;
-        x_con_kill(con);
-        free(con->name);
-        TAILQ_REMOVE(&all_cons, con, all_cons);
-        free(con);
-
-        return;
-    }
 }