From 1d969e6340d32d8f9341d1b2aa20d04e47246be7 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 4 Jan 2014 21:30:51 +0100 Subject: [PATCH] fix percentages when loading layouts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is more forgiving for users who delete containers from their layout file and don’t update the “percent” values. --- src/load_layout.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); -- 2.39.5