dump_rect(gen, "rect", con->rect);
dump_rect(gen, "window_rect", con->window_rect);
+ dump_rect(gen, "geometry", con->geometry);
ystr("name");
ystr(con->name);
ystr("nodes");
y(array_open);
Con *node;
- TAILQ_FOREACH(node, &(con->nodes_head), nodes) {
- dump_node(gen, node, inplace_restart);
+ if (con->type != CT_DOCKAREA || !inplace_restart) {
+ TAILQ_FOREACH(node, &(con->nodes_head), nodes) {
+ dump_node(gen, node, inplace_restart);
+ }
}
y(array_close);
ystr("fullscreen_mode");
y(integer, con->fullscreen_mode);
+ ystr("swallows");
+ y(array_open);
+ Match *match;
+ TAILQ_FOREACH(match, &(con->swallow_head), matches) {
+ if (match->dock != -1) {
+ y(map_open);
+ ystr("dock");
+ y(integer, match->dock);
+ ystr("insert_where");
+ y(integer, match->insert_where);
+ y(map_close);
+ }
+
+ /* TODO: the other swallow keys */
+ }
+
if (inplace_restart) {
if (con->window != NULL) {
- ystr("swallows");
- y(array_open);
y(map_open);
ystr("id");
y(integer, con->window->id);
y(map_close);
- y(array_close);
}
}
+ y(array_close);
y(map_close);
}
static bool parsing_swallows;
static bool parsing_rect;
static bool parsing_window_rect;
+static bool parsing_geometry;
struct Match *current_swallow;
static int json_start_map(void *ctx) {
match_init(current_swallow);
TAILQ_INSERT_TAIL(&(json_node->swallow_head), current_swallow, matches);
} else {
- if (!parsing_rect && !parsing_window_rect) {
+ if (!parsing_rect && !parsing_window_rect && !parsing_geometry) {
if (last_key && strcasecmp(last_key, "floating_nodes") == 0) {
Con *ws = con_get_workspace(json_node);
json_node = con_new(NULL);
static int json_end_map(void *ctx) {
LOG("end of map\n");
- if (!parsing_swallows && !parsing_rect && !parsing_window_rect) {
+ if (!parsing_swallows && !parsing_rect && !parsing_window_rect && !parsing_geometry) {
LOG("attaching\n");
con_attach(json_node, json_node->parent, false);
json_node = json_node->parent;
parsing_rect = false;
if (parsing_window_rect)
parsing_window_rect = false;
+ if (parsing_geometry)
+ parsing_geometry = false;
return 1;
}
parsing_rect = true;
if (strcasecmp(last_key, "window_rect") == 0)
parsing_window_rect = true;
+ if (strcasecmp(last_key, "geometry") == 0)
+ parsing_geometry = true;
return 1;
}
if (strcasecmp(last_key, "num") == 0)
json_node->num = val;
- if (parsing_rect || parsing_window_rect) {
- Rect *r = (parsing_rect ? &(json_node->rect) : &(json_node->window_rect));
+ if (parsing_rect || parsing_window_rect || parsing_geometry) {
+ Rect *r;
+ if (parsing_rect)
+ r = &(json_node->rect);
+ else if (parsing_window_rect)
+ r = &(json_node->window_rect);
+ else r = &(json_node->geometry);
if (strcasecmp(last_key, "x") == 0)
r->x = val;
else if (strcasecmp(last_key, "y") == 0)
current_swallow->id = val;
}
if (strcasecmp(last_key, "dock") == 0) {
- current_swallow->dock = true;
+ current_swallow->dock = val;
+ }
+ if (strcasecmp(last_key, "insert_where") == 0) {
+ current_swallow->insert_where = val;
}
}
to_focus = NULL;
parsing_rect = false;
parsing_window_rect = false;
+ parsing_geometry = false;
setlocale(LC_NUMERIC, "C");
stat = yajl_parse(hand, (const unsigned char*)buf, n);
if (stat != yajl_status_ok &&