/**
* Create a new container (and attach it to the given parent, if not NULL).
- * This function initializes the data structures and creates the appropriate
- * X11 IDs using x_con_init().
+ * This function only initializes the data structures.
+ *
+ */
+Con *con_new_skeleton(Con *parent, i3Window *window);
+
+
+/* A wrapper for con_new_skeleton, to retain the old con_new behaviour
*
*/
Con *con_new(Con *parent, i3Window *window);
/* The ID of this container before restarting. Necessary to correctly
* interpret back-references in the JSON (such as the focus stack). */
int old_id;
+
+ /* Depth of the container window */
+ uint16_t depth;
};
#endif
/*
* Create a new container (and attach it to the given parent, if not NULL).
- * This function initializes the data structures and creates the appropriate
- * X11 IDs using x_con_init().
+ * This function only initializes the data structures.
*
*/
-Con *con_new(Con *parent, i3Window *window) {
+Con *con_new_skeleton(Con *parent, i3Window *window) {
Con *new = scalloc(sizeof(Con));
new->on_remove_child = con_on_remove_child;
TAILQ_INSERT_TAIL(&all_cons, new, all_cons);
new->window = window;
new->border_style = config.default_border;
new->current_border_width = -1;
+ if (window)
+ new->depth = window->depth;
+ else
+ new->depth = XCB_COPY_FROM_PARENT;
static int cnt = 0;
DLOG("opening window %d\n", cnt);
cnt++;
if ((cnt % (sizeof(colors) / sizeof(char*))) == 0)
cnt = 0;
- if (window)
- x_con_init(new, window->depth);
- else
- x_con_init(new, XCB_COPY_FROM_PARENT);
TAILQ_INIT(&(new->floating_head));
TAILQ_INIT(&(new->nodes_head));
return new;
}
+/* A wrapper for con_new_skeleton, to retain the old con_new behaviour
+ *
+ */
+Con *con_new(Con *parent, i3Window *window) {
+ Con *new = con_new_skeleton(parent, window);
+ x_con_init(new, new->depth);
+ return new;
+}
+
/*
* Attaches the given container to the given parent. This happens when moving
* a container or when inserting a new container at a specific place in the
}
y(array_close);
+ if (inplace_restart && con->window != NULL) {
+ ystr("depth");
+ y(integer, con->depth);
+ }
+
y(map_close);
}
if (last_key && strcasecmp(last_key, "floating_nodes") == 0) {
DLOG("New floating_node\n");
Con *ws = con_get_workspace(json_node);
- json_node = con_new(NULL, NULL);
+ json_node = con_new_skeleton(NULL, NULL);
json_node->parent = ws;
DLOG("Parent is workspace = %p\n", ws);
} else {
Con *parent = json_node;
- json_node = con_new(NULL, NULL);
+ json_node = con_new_skeleton(NULL, NULL);
json_node->parent = parent;
}
}
if (!parsing_swallows && !parsing_rect && !parsing_window_rect && !parsing_geometry) {
LOG("attaching\n");
con_attach(json_node, json_node->parent, true);
+ LOG("Creating window\n");
+ x_con_init(json_node, json_node->depth);
json_node = json_node->parent;
}
if (parsing_rect)
if (strcasecmp(last_key, "current_border_width") == 0)
json_node->current_border_width = val;
+ if (strcasecmp(last_key, "depth") == 0)
+ json_node->depth = val;
+
if (!parsing_swallows && strcasecmp(last_key, "id") == 0)
json_node->old_id = val;