Bugfix: store and properly load workspace order when restarting

This commit is contained in:
Michael Stapelberg 2010-12-27 22:28:59 +01:00
parent c88c3e3ab2
commit dc3c633ee4
2 changed files with 15 additions and 2 deletions

View File

@ -201,6 +201,11 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("name");
ystr(con->name);
if (con->type == CT_WORKSPACE) {
ystr("num");
y(integer, con->num);
}
ystr("window");
if (con->window)
y(integer, con->window->id);

View File

@ -34,7 +34,9 @@ static int json_start_map(void *ctx) {
TAILQ_INSERT_TAIL(&(ws->floating_head), json_node, floating_windows);
TAILQ_INSERT_TAIL(&(ws->focus_head), json_node, focused);
} else {
json_node = con_new(json_node);
Con *parent = json_node;
json_node = con_new(NULL);
json_node->parent = parent;
}
}
}
@ -43,8 +45,11 @@ static int json_start_map(void *ctx) {
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) {
LOG("attaching\n");
con_attach(json_node, json_node->parent, false);
json_node = json_node->parent;
}
if (parsing_rect)
parsing_rect = false;
if (parsing_window_rect)
@ -113,6 +118,9 @@ static int json_int(void *ctx, long val) {
to_focus = json_node;
}
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 (strcasecmp(last_key, "x") == 0)