Con *result = con;
while (result != NULL && result->type != CT_WORKSPACE)
result = result->parent;
- assert(result != NULL);
return result;
}
* 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);
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;
}
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;
}
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;
- }
}