From: Michael Stapelberg Date: Mon, 27 Dec 2010 21:28:59 +0000 (+0100) Subject: Bugfix: store and properly load workspace order when restarting X-Git-Tag: tree-pr2~157 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dc3c633ee42e30f2f9ea29afa6394333cc7fb595;p=i3%2Fi3 Bugfix: store and properly load workspace order when restarting --- diff --git a/src/ipc.c b/src/ipc.c index 3954107f..f953f9ae 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -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); diff --git a/src/load_layout.c b/src/load_layout.c index 60a63313..8d532da4 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -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)