]> git.sur5r.net Git - i3/i3/commitdiff
sanity check: drop swallows for split containers (Thanks xeen)
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 5 Jan 2014 19:25:47 +0000 (20:25 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 5 Jan 2014 19:25:47 +0000 (20:25 +0100)
fixes #1149

src/load_layout.c

index 7457d51296c8776265812ded4c8366daee12f4ba..3aa96322b4e4a2ad0d32a11b23d67a810712d9de 100644 (file)
@@ -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");