]> git.sur5r.net Git - i3/i3/blobdiff - src/render.c
Merge branch 'master' into next
[i3/i3] / src / render.c
index 16bfc55bb1f17c876b2a9582f181059b8a6cd9c7..0142ae9718f3fbd55771a222d9b08bab5d01ce42 100644 (file)
@@ -70,7 +70,7 @@ static void render_l_output(Con *con) {
     Con *fullscreen = con_get_fullscreen_con(ws, CF_OUTPUT);
     if (fullscreen) {
         fullscreen->rect = con->rect;
-        x_raise_con(fullscreen);
+        x_raise_con(fullscreen, true);
         render_con(fullscreen, true);
         return;
     }
@@ -110,7 +110,7 @@ static void render_l_output(Con *con) {
 
         DLOG("child at (%d, %d) with (%d x %d)\n",
                 child->rect.x, child->rect.y, child->rect.width, child->rect.height);
-        x_raise_con(child);
+        x_raise_con(child, false);
         render_con(child, false);
     }
 }
@@ -184,10 +184,10 @@ void render_con(Con *con, bool render_fullscreen) {
                     new_width--;
             }
             /* Center the window */
-            inset->y += ceil(inset->height / 2) - floor(new_height / 2);
+            inset->y += ceil(inset->height / 2) - floor((new_height + .5) / 2);
             inset->x += ceil(inset->width / 2) - floor(new_width / 2);
 
-            inset->height = new_height;
+            inset->height = new_height + .5;
             inset->width = new_width;
         }
 
@@ -207,7 +207,7 @@ void render_con(Con *con, bool render_fullscreen) {
     }
     if (fullscreen) {
         fullscreen->rect = rect;
-        x_raise_con(fullscreen);
+        x_raise_con(fullscreen, false);
         render_con(fullscreen, true);
         return;
     }
@@ -298,7 +298,7 @@ void render_con(Con *con, bool render_fullscreen) {
                 }
                 DLOG("floating child at (%d,%d) with %d x %d\n",
                      child->rect.x, child->rect.y, child->rect.width, child->rect.height);
-                x_raise_con(child);
+                x_raise_con(child, false);
                 render_con(child, false);
             }
         }
@@ -372,10 +372,16 @@ void render_con(Con *con, bool render_fullscreen) {
             child->rect.width = rect.width;
             child->rect.height = rect.height;
 
-            child->deco_rect.width = ceil((float)child->rect.width / children);
+            child->deco_rect.width = floor((float)child->rect.width / children);
             child->deco_rect.x = x - con->rect.x + i * child->deco_rect.width;
             child->deco_rect.y = y - con->rect.y;
 
+            /* Since the tab width may be something like 31,6 px per tab, we
+             * let the last tab have all the extra space (0,6 * children). */
+            if (i == (children-1)) {
+                child->deco_rect.width += (child->rect.width - (child->deco_rect.x + child->deco_rect.width));
+            }
+
             if (children > 1 || (child->border_style != BS_PIXEL && child->border_style != BS_NONE)) {
                 child->rect.y += deco_height;
                 child->rect.height -= deco_height;
@@ -401,7 +407,7 @@ void render_con(Con *con, bool render_fullscreen) {
 
         DLOG("child at (%d, %d) with (%d x %d)\n",
                 child->rect.x, child->rect.y, child->rect.width, child->rect.height);
-        x_raise_con(child);
+        x_raise_con(child, false);
         render_con(child, false);
         i++;
     }
@@ -409,7 +415,7 @@ 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);
+            x_raise_con(child, false);
         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
@@ -423,7 +429,7 @@ void render_con(Con *con, bool render_fullscreen) {
              * top of every stack window. That way, when a new window is opened in
              * the stack, the old window will not obscure part of the decoration
              * (it’s unmapped afterwards). */
-            x_raise_con(con);
+            x_raise_con(con, false);
     }
     }
 }