]> git.sur5r.net Git - i3/i3/commitdiff
rendering: bugfix: stack child windows of stacked/tabbed cons according to their...
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 6 Mar 2011 20:49:17 +0000 (21:49 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 6 Mar 2011 20:49:17 +0000 (21:49 +0100)
fixes focusing the wrong window after closing a con

src/render.c

index 499c62a30cea9665742723e2fbbfb771428ddb87..37ee6e47ae4a7eedd8b08a22819681683dad5b5f 100644 (file)
@@ -323,13 +323,17 @@ void render_con(Con *con, bool render_fullscreen) {
 
     /* in a stacking or tabbed container, we ensure the focused client is raised */
     if (con->layout == L_STACKED || con->layout == L_TABBED) {
-        Con *foc = TAILQ_FIRST(&(con->focus_head));
-        if (foc != TAILQ_END(&(con->focus_head))) {
-            DLOG("con %p is stacking, raising %p\n", con, foc);
-            x_raise_con(foc);
-            /* by rendering the stacked container again, we handle the case
-             * that we have a non-leaf-container inside the stack. */
-            render_con(foc, false);
+        DLOG("stacked/tabbed, raising focused reverse\n");
+        TAILQ_FOREACH_REVERSE(child, &(con->focus_head), focus_head, focused)
+            x_raise_con(child);
+        DLOG("done\n");
+        if ((child = TAILQ_FIRST(&(con->focus_head)))) {
+            DLOG("con %p is stacking, raising %p\n", con, child);
+            /* By rendering the stacked container again, we handle the case
+             * that we have a non-leaf-container inside the stack. In that
+             * case, the children of the non-leaf-container need to be raised
+             * aswell. */
+            render_con(child, false);
         }
     }
     }