]> git.sur5r.net Git - i3/i3/blobdiff - src/con.c
Merge pull request #1805 from lasers/next
[i3/i3] / src / con.c
index 622b7ad5f0d68e987d42ae8d755879d370d21f81..08c720015bd40b3099dc55fb55148fb4e7089214 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -4,7 +4,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  * con.c: Functions which deal with containers directly (creating containers,
  *        searching containers, getting specific properties from containers,
@@ -260,6 +260,29 @@ bool con_is_split(Con *con) {
     }
 }
 
+/*
+ * This will only return true for containers which have some parent with
+ * a tabbed / stacked parent of which they are not the currently focused child.
+ *
+ */
+bool con_is_hidden(Con *con) {
+    Con *current = con;
+
+    /* ascend to the workspace level and memorize the highest-up container
+     * which is stacked or tabbed. */
+    while (current != NULL && current->type != CT_WORKSPACE) {
+        Con *parent = current->parent;
+        if (parent != NULL && (parent->layout == L_TABBED || parent->layout == L_STACKED)) {
+            if (TAILQ_FIRST(&(parent->focus_head)) != current)
+                return true;
+        }
+
+        current = parent;
+    }
+
+    return false;
+}
+
 /*
  * Returns true if this node accepts a window (if the node swallows windows,
  * it might already have swallowed enough and cannot hold any more).
@@ -706,12 +729,12 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
     /* Prevent moving if this would violate the fullscreen focus restrictions. */
     Con *target_ws = con_get_workspace(target);
     if (!con_fullscreen_permits_focusing(target_ws)) {
-        LOG("Cannot move out of a fullscreen container");
+        LOG("Cannot move out of a fullscreen container.\n");
         return false;
     }
 
     if (con_is_floating(con)) {
-        DLOG("Using FLOATINGCON instead\n");
+        DLOG("Container is floating, using parent instead.\n");
         con = con->parent;
     }