]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Only change focus in tree_close() when the container was focused before
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 18 Sep 2011 16:43:02 +0000 (17:43 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 18 Sep 2011 16:43:02 +0000 (17:43 +0100)
Fixes: #441
I’m not sure if that’s really all there is to it. Seems a bit too simple :).
We’ll see if I missed some corner cases in the next few days…

src/tree.c

index 240c22a6551957b2c0fe2ccf162bfe80429d3342..0d0c2e9fa5ff644fc97d9239015241914a4afd6e 100644 (file)
@@ -220,12 +220,13 @@ bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent) {
     if (was_mapped || con == focused) {
         if ((kill_window != DONT_KILL_WINDOW) || !dont_kill_parent || con == focused) {
             DLOG("focusing %p / %s\n", next, next->name);
-            /* TODO: check if the container (or one of its children) was focused */
             if (next->type == CT_DOCKAREA) {
                 /* Instead of focusing the dockarea, we need to restore focus to the workspace */
                 con_focus(con_descend_focused(output_get_content(next->parent)));
             } else {
-                con_focus(next);
+                if (con != focused)
+                    DLOG("not changing focus, the container was not focused before\n");
+                else con_focus(next);
             }
         }
         else {