*/
bool con_is_leaf(Con *con);
+/*
+ * Returns true if a container should be considered split.
+ *
+ */
+bool con_is_split(Con *con);
+
/**
* Returns true if this node accepts a window (if the node swallows windows,
* it might already have swallowed enough and cannot hold any more).
*/
struct Con {
bool mapped;
- /** whether this is a split container or not */
- bool split;
enum {
CT_ROOT = 0,
CT_OUTPUT = 1,
Con *parent = con;
while (parent && parent->type != CT_WORKSPACE && parent->type != CT_DOCKAREA) {
- if (parent->split)
+ if (!con_is_leaf(parent))
FREE(parent->deco_render_params);
parent = parent->parent;
}
return TAILQ_EMPTY(&(con->nodes_head));
}
+/*
+ * Returns true if a container should be considered split.
+ *
+ */
+bool con_is_split(Con *con) {
+ if (con_is_leaf(con))
+ return false;
+
+ switch (con->layout) {
+ case L_DOCKAREA:
+ case L_OUTPUT:
+ return false;
+
+ default:
+ return true;
+ }
+}
+
/*
* Returns true if this node accepts a window (if the node swallows windows,
* it might already have swallowed enough and cannot hold any more).
if (con->type == CT_WORKSPACE)
return false;
- if (con->split) {
+ if (con_is_split(con)) {
DLOG("container %p does not accept windows, it is a split container.\n", con);
return false;
}
* split. */
new->layout = layout;
new->last_split_layout = con->last_split_layout;
- new->split = true;
Con *old_focused = TAILQ_FIRST(&(con->focus_head));
if (old_focused == TAILQ_END(&(con->focus_head)))
/* For horizontal/vertical split containers we sum up the width (h-split)
* or height (v-split) and use the maximum of the height (h-split) or width
* (v-split) as minimum size. */
- if (con->split) {
+ if (con_is_split(con)) {
uint32_t width = 0, height = 0;
Con *child;
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
}
ELOG("Unhandled case, type = %d, layout = %d, split = %d\n",
- con->type, con->layout, con->split);
+ con->type, con->layout, con_is_split(con));
assert(false);
}
* otherwise. */
Con *ws = con_get_workspace(con);
nc->parent = ws;
- nc->split = true;
nc->type = CT_FLOATING_CON;
nc->layout = L_SPLITH;
/* We insert nc already, even though its rect is not yet calculated. This
/* provided for backwards compatibility only. */
ystr("orientation");
- if (!con->split)
+ if (!con_is_split(con))
ystr("none");
else {
if (con_orientation(con) == HORIZ)
ystr("focused");
y(bool, (con == focused));
- ystr("split");
- y(bool, con->split);
-
ystr("layout");
switch (con->layout) {
case L_DEFAULT:
else if (strcasecmp(buf, "vertical") == 0)
json_node->last_split_layout = L_SPLITV;
else LOG("Unhandled orientation: %s\n", buf);
-
- /* What used to be an implicit check whether orientation !=
- * NO_ORIENTATION is now a proper separate flag. */
- if (strcasecmp(buf, "none") != 0)
- json_node->split = true;
free(buf);
} else if (strcasecmp(last_key, "border") == 0) {
char *buf = NULL;
json_node->layout = L_STACKED;
else if (strcasecmp(buf, "tabbed") == 0)
json_node->layout = L_TABBED;
- else if (strcasecmp(buf, "dockarea") == 0) {
+ else if (strcasecmp(buf, "dockarea") == 0)
json_node->layout = L_DOCKAREA;
- /* Necessary for migrating from older versions of i3. */
- json_node->split = false;
- } else if (strcasecmp(buf, "output") == 0)
+ else if (strcasecmp(buf, "output") == 0)
json_node->layout = L_OUTPUT;
else if (strcasecmp(buf, "splith") == 0)
json_node->layout = L_SPLITH;
to_focus = json_node;
}
- if (strcasecmp(last_key, "split") == 0)
- json_node->split = val;
-
if (parsing_swallows) {
if (strcasecmp(last_key, "restart_mode") == 0)
current_swallow->restart_mode = val;
TAILQ_REPLACE(&(parent->focus_head), con, new, focused);
new->parent = parent;
new->layout = (orientation == HORIZ) ? L_SPLITH : L_SPLITV;
- new->split = true;
/* 3: swap 'percent' (resize factor) */
new->percent = con->percent;
/* The child must have a different orientation than the con but the same as
* the con’s parent to be redundant */
- if (!con->split ||
- !child->split ||
+ if (!con_is_split(con) ||
+ !con_is_split(child) ||
con_orientation(con) == con_orientation(child) ||
con_orientation(child) != con_orientation(parent))
goto recurse;
/* 1: create a new split container */
Con *split = con_new(NULL, NULL);
split->parent = ws;
- split->split = true;
/* 2: copy layout from workspace */
split->layout = ws->layout;
/* 1: create a new split container */
Con *new = con_new(NULL, NULL);
new->parent = ws;
- new->split = true;
/* 2: set the requested layout on the split con */
new->layout = ws->workspace_layout;
name => 'root',
orientation => $ignore,
type => 0,
- split => JSON::XS::false,
id => $ignore,
rect => $ignore,
window_rect => $ignore,