]> git.sur5r.net Git - i3/i3/blobdiff - src/render.c
Remove old code from randr.c and workspace.c
[i3/i3] / src / render.c
index c8ea318452f27f71213e2e20d91409886e0926af..a59d418b402b8f35e5afee1bc167c35b7c5023e9 100644 (file)
@@ -21,6 +21,37 @@ static void render_l_output(Con *con) {
     int height = con->rect.height;
     DLOG("Available height: %d\n", height);
 
+    /* Find the content container and ensure that there is exactly one. Also
+     * check for any non-CT_DOCKAREA clients. */
+    Con *content = NULL;
+    TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
+        if (child->type == CT_CON) {
+            if (content != NULL) {
+                DLOG("More than one CT_CON on output container\n");
+                assert(false);
+            }
+            content = child;
+        } else if (child->type != CT_DOCKAREA) {
+            DLOG("Child %p of type %d is inside the OUTPUT con\n", child, child->type);
+            assert(false);
+        }
+    }
+
+    assert(content != NULL);
+
+    /* We need to find out if there is a fullscreen con on the current workspace
+     * and take the short-cut to render it directly (the user does not want to
+     * see the dockareas in that case) */
+    Con *ws = con_get_fullscreen_con(content);
+    Con *fullscreen = con_get_fullscreen_con(ws);
+    if (fullscreen) {
+        DLOG("got fs node: %p\n", fullscreen);
+        fullscreen->rect = con->rect;
+        x_raise_con(fullscreen);
+        render_con(fullscreen, true);
+        return;
+    }
+
     /* First pass: determine the height of all CT_DOCKAREAs (the sum of their
      * children) and figure out how many pixels we have left for the rest */
     TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
@@ -40,20 +71,10 @@ static void render_l_output(Con *con) {
     /* Second pass: Set the widths/heights */
     TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
         if (child->type == CT_CON) {
-            if (height == -1) {
-                DLOG("More than one CT_CON on output container\n");
-                assert(false);
-            }
             child->rect.x = x;
             child->rect.y = y;
             child->rect.width = con->rect.width;
             child->rect.height = height;
-            height = -1;
-        }
-
-        else if (child->type != CT_DOCKAREA) {
-            DLOG("Child %p of type %d is inside the OUTPUT con\n", child, child->type);
-            assert(false);
         }
 
         child->rect.x = x;
@@ -118,7 +139,9 @@ void render_con(Con *con, bool render_fullscreen) {
         if (!render_fullscreen)
             *inset = rect_add(*inset, con_border_style_rect(con));
 
+        DLOG("Starting with inset = (%d, %d) %d x %d\n", inset->x, inset->y, inset->width, inset->height);
         /* Obey x11 border */
+        DLOG("X11 border: %d\n", con->border_width);
         inset->width -= (2 * con->border_width);
         inset->height -= (2 * con->border_width);
 
@@ -172,12 +195,12 @@ void render_con(Con *con, bool render_fullscreen) {
     }
 
     /* find the height for the decorations */
-    i3Font *font = load_font(conn, config.font);
-    int deco_height = font->height + 5;
+    int deco_height = config.font.height + 5;
 
     /* precalculate the sizes to be able to correct rounding errors */
     int sizes[children];
     if (con->layout == L_DEFAULT && children > 0) {
+        assert(!TAILQ_EMPTY(&con->nodes_head));
         Con *child;
         int i = 0, assigned = 0;
         int total = con->orientation == HORIZ ? rect.width : rect.height;
@@ -204,6 +227,7 @@ void render_con(Con *con, bool render_fullscreen) {
         /* FIXME: refactor this into separate functions: */
     Con *child;
     TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
+        assert(children > 0);
 
         /* default layout */
         if (con->layout == L_DEFAULT) {
@@ -299,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);
         }
     }
     }