]> git.sur5r.net Git - i3/i3/blobdiff - src/manage.c
layout restore: remove remaining criteria when swallowing window
[i3/i3] / src / manage.c
index 002a7c78f5ab332a5def9974c76391a14dd7cefd..08e11b57fc73d2bf244806e8ef409a29249b56ef 100644 (file)
@@ -301,6 +301,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
     if (nc->window != NULL && nc->window != cwindow) {
         if (!restore_kill_placeholder(nc->window->id)) {
             DLOG("Uh?! Container without a placeholder, but with a window, has swallowed this to-be-managed window?!\n");
+        } else {
+            /* Remove remaining criteria, the first swallowed window wins. */
+            while (!TAILQ_EMPTY(&(nc->swallow_head))) {
+                Match *first = TAILQ_FIRST(&(nc->swallow_head));
+                TAILQ_REMOVE(&(nc->swallow_head), first, matches);
+                match_free(first);
+            }
         }
     }
     nc->window = cwindow;