From 93cfdcd4888eb95e0f86a4e50aaec9e2daf9af9c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 5 Jan 2014 20:25:47 +0100 Subject: [PATCH] sanity check: drop swallows for split containers (Thanks xeen) fixes #1149 --- src/load_layout.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/load_layout.c b/src/load_layout.c index 7457d512..3aa96322 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -73,6 +73,17 @@ static int json_end_map(void *ctx) { json_node->layout = L_SPLITH; } + /* Sanity check: swallow criteria don’t make any sense on a split + * container. */ + if (con_is_split(json_node) > 0 && !TAILQ_EMPTY(&(json_node->swallow_head))) { + DLOG("sanity check: removing swallows specification from split container\n"); + while (!TAILQ_EMPTY(&(json_node->swallow_head))) { + Match *match = TAILQ_FIRST(&(json_node->swallow_head)); + TAILQ_REMOVE(&(json_node->swallow_head), match, matches); + match_free(match); + } + } + LOG("attaching\n"); con_attach(json_node, json_node->parent, true); LOG("Creating window\n");