sanity check: drop swallows for split containers (Thanks xeen)

fixes #1149
next
Michael Stapelberg 2014-01-05 20:25:47 +01:00
parent bb482e2869
commit 93cfdcd488
1 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,17 @@ static int json_end_map(void *ctx) {
json_node->layout = L_SPLITH;
}
/* Sanity check: swallow criteria dont 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");