]> git.sur5r.net Git - i3/i3/blobdiff - src/render.c
Allow the commands parser to use "number" arguments by making the stack typed.
[i3/i3] / src / render.c
index 2f39b08282e94d9df1fb50f9d88c1c63cf7d20ab..7ada19ebdc37d76546c4156eef839fe4a35e8919 100644 (file)
@@ -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)
  *
  * render.c: Renders (determines position/sizes) the layout tree, updating the
  *           various rects. Needs to be pushed to X11 (see x.c) to be visible.
@@ -41,7 +41,7 @@ static void render_l_output(Con *con) {
     /* 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) {
+    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");
@@ -77,19 +77,19 @@ static void render_l_output(Con *con) {
 
     /* 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) {
+    TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
         if (child->type != CT_DOCKAREA)
             continue;
 
         child->rect.height = 0;
-        TAILQ_FOREACH (dockchild, &(child->nodes_head), nodes)
-            child->rect.height += dockchild->geometry.height;
+        TAILQ_FOREACH(dockchild, &(child->nodes_head), nodes)
+        child->rect.height += dockchild->geometry.height;
 
         height -= child->rect.height;
     }
 
     /* Second pass: Set the widths/heights */
-    TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+    TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
         if (child->type == CT_CON) {
             child->rect.x = x;
             child->rect.y = y;
@@ -154,7 +154,7 @@ void render_con(Con *con, bool render_fullscreen) {
         /* depending on the border style, the rect of the child window
          * needs to be smaller */
         Rect *inset = &(con->window_rect);
-        *inset = (Rect) {0, 0, con->rect.width, con->rect.height};
+        *inset = (Rect){0, 0, con->rect.width, con->rect.height};
         if (!render_fullscreen)
             *inset = rect_add(*inset, con_border_style_rect(con));
 
@@ -172,14 +172,14 @@ void render_con(Con *con, bool render_fullscreen) {
          * Ignoring aspect ratio during fullscreen was necessary to fix MPlayer
          * subtitle rendering, see http://bugs.i3wm.org/594 */
         if (!render_fullscreen &&
-            con->aspect_ratio > 0.0) {
+            con->window->aspect_ratio > 0.0) {
             DLOG("aspect_ratio = %f, current width/height are %d/%d\n",
-                 con->aspect_ratio, inset->width, inset->height);
+                 con->window->aspect_ratio, inset->width, inset->height);
             double new_height = inset->height + 1;
             int new_width = inset->width;
 
             while (new_height > inset->height) {
-                new_height = (1.0 / con->aspect_ratio) * new_width;
+                new_height = (1.0 / con->window->aspect_ratio) * new_width;
 
                 if (new_height > inset->height)
                     new_width--;
@@ -232,7 +232,7 @@ void render_con(Con *con, bool render_fullscreen) {
         Con *child;
         int i = 0, assigned = 0;
         int total = con_orientation(con) == HORIZ ? rect.width : rect.height;
-        TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+        TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
             double percentage = child->percent > 0.0 ? child->percent : 1.0 / children;
             assigned += sizes[i++] = percentage * total;
         }
@@ -256,7 +256,7 @@ void render_con(Con *con, bool render_fullscreen) {
     } else if (con->type == CT_ROOT) {
         Con *output;
         if (!fullscreen) {
-            TAILQ_FOREACH (output, &(con->nodes_head), nodes) {
+            TAILQ_FOREACH(output, &(con->nodes_head), nodes) {
                 render_con(output, false);
             }
         }
@@ -266,7 +266,7 @@ void render_con(Con *con, bool render_fullscreen) {
          * all times. This is important when the user places floating
          * windows/containers so that they overlap on another output. */
         DLOG("Rendering floating windows:\n");
-        TAILQ_FOREACH (output, &(con->nodes_head), nodes) {
+        TAILQ_FOREACH(output, &(con->nodes_head), nodes) {
             if (con_is_internal(output))
                 continue;
             /* Get the active workspace of that output */
@@ -278,7 +278,7 @@ void render_con(Con *con, bool render_fullscreen) {
             Con *workspace = TAILQ_FIRST(&(content->focus_head));
             Con *fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT);
             Con *child;
-            TAILQ_FOREACH (child, &(workspace->floating_head), floating_windows) {
+            TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
                 /* Don’t render floating windows when there is a fullscreen window
                  * on that workspace. Necessary to make floating fullscreen work
                  * correctly (ticket #564). */
@@ -298,6 +298,8 @@ void render_con(Con *con, bool render_fullscreen) {
                     while (transient_con != NULL &&
                            transient_con->window != NULL &&
                            transient_con->window->transient_for != XCB_NONE) {
+                        DLOG("transient_con = 0x%08x, transient_con->window->transient_for = 0x%08x, fullscreen_id = 0x%08x\n",
+                             transient_con->window->id, transient_con->window->transient_for, fullscreen->window->id);
                         if (transient_con->window->transient_for == fullscreen->window->id) {
                             is_transient_for = true;
                             break;
@@ -331,7 +333,7 @@ void render_con(Con *con, bool render_fullscreen) {
     } else {
         /* FIXME: refactor this into separate functions: */
         Con *child;
-        TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+        TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
             assert(children > 0);
 
             /* default layout */
@@ -438,8 +440,8 @@ 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) {
-            TAILQ_FOREACH_REVERSE (child, &(con->focus_head), focus_head, focused)
-                x_raise_con(child);
+            TAILQ_FOREACH_REVERSE(child, &(con->focus_head), focus_head, focused)
+            x_raise_con(child);
             if ((child = TAILQ_FIRST(&(con->focus_head)))) {
                 /* By rendering the stacked container again, we handle the case
              * that we have a non-leaf-container inside the stack. In that