From: Michael Stapelberg Date: Sat, 4 Jan 2014 20:30:51 +0000 (+0100) Subject: fix percentages when loading layouts X-Git-Tag: 4.8~161 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1d969e6340d32d8f9341d1b2aa20d04e47246be7;p=i3%2Fi3 fix percentages when loading layouts This is more forgiving for users who delete containers from their layout file and don’t update the “percent” values. --- diff --git a/src/load_layout.c b/src/load_layout.c index d0772aa3..fe21ee81 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -90,7 +90,12 @@ static int json_end_map(void *ctx) { static int json_end_array(void *ctx) { LOG("end of array\n"); - parsing_swallows = false; + if (!parsing_swallows && !parsing_focus) { + con_fix_percent(json_node); + } + if (parsing_swallows) { + parsing_swallows = false; + } if (parsing_focus) { /* Clear the list of focus mappings */ struct focus_mapping *mapping; @@ -380,7 +385,6 @@ static int json_double(void *ctx, double val) { } void tree_append_json(const char *filename) { - /* TODO: percent of other windows are not correctly fixed at the moment */ FILE *f; if ((f = fopen(filename, "r")) == NULL) { LOG("Cannot open file \"%s\"\n", filename);