]> git.sur5r.net Git - i3/i3/commitdiff
bugfix: correctly focus follow up window when closing floating windows
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 30 Jun 2010 20:37:57 +0000 (22:37 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 30 Jun 2010 20:37:57 +0000 (22:37 +0200)
src/tree.c

index 2bcaeaae62659a5bf29058204846b7b4781ff682..ec8b0a83e1b881528f072a8d18908798a944e3a4 100644 (file)
@@ -140,7 +140,7 @@ void tree_close(Con *con, bool kill_window) {
     if (con->type == CT_FLOATING_CON) {
         next = TAILQ_NEXT(con, floating_windows);
         if (next == TAILQ_END(&(con->parent->floating_head)))
-            next = con->parent;
+            next = con_get_workspace(con);
     } else {
         next = TAILQ_NEXT(con, focused);
         if (next == TAILQ_END(&(con->parent->nodes_head)))
@@ -180,12 +180,19 @@ void tree_close(Con *con, bool kill_window) {
         TAILQ_REMOVE(&(con->parent->parent->floating_head), con->parent, floating_windows);
         TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused);
         tree_close(con->parent, false);
+        next = NULL;
     }
 
     free(con->name);
     TAILQ_REMOVE(&all_cons, con, all_cons);
     free(con);
 
+    /* in the case of floating windows, we already focused another container
+     * when closing the parent, so we can exit now. */
+    if (!next)
+        return;
+
+    DLOG("focusing %p / %s\n", next, next->name);
     /* TODO: check if the container (or one of its children) was focused */
     con_focus(next);
 }