]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix stack-limit cols, handle stack-limit cols on tabbed containers (Thanks...
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 22 Nov 2009 21:48:08 +0000 (22:48 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 22 Nov 2009 21:48:43 +0000 (22:48 +0100)
src/layout.c

index 4e06c44bce0843a59678f69a8b7d60a317932541..f186bbae8c4b5a2737eb4950d1a45a4c1653b28e 100644 (file)
@@ -470,7 +470,7 @@ void render_container(xcb_connection_t *conn, Container *container) {
                 if (container->stack_limit == STACK_LIMIT_COLS) {
                         /* wrap stores the number of rows after which we will
                          * wrap to a new column. */
-                        wrap = ceil((float)num_clients / container->stack_limit_value);
+                        wrap = container->stack_limit_value;
                 } else if (container->stack_limit == STACK_LIMIT_ROWS) {
                         /* When limiting rows, the wrap variable serves a
                          * slightly different purpose: it holds the number of
@@ -501,14 +501,16 @@ void render_container(xcb_connection_t *conn, Container *container) {
 
                         int offset_x = 0;
                         int offset_y = 0;
-                        if (container->mode == MODE_STACK) {
+                        if (container->mode == MODE_STACK ||
+                            (container->mode == MODE_TABBED &&
+                             container->stack_limit == STACK_LIMIT_COLS)) {
                                 if (container->stack_limit == STACK_LIMIT_COLS) {
                                         offset_x = current_col * (stack_win->rect.width / container->stack_limit_value);
                                         offset_y = current_row * decoration_height;
-                                        current_row++;
-                                        if ((current_row % wrap) == 0) {
-                                                current_col++;
-                                                current_row = 0;
+                                        current_col++;
+                                        if ((current_col % wrap) == 0) {
+                                                current_row++;
+                                                current_col = 0;
                                         }
                                 } else if (container->stack_limit == STACK_LIMIT_ROWS) {
                                         offset_x = current_col * wrap;
@@ -522,8 +524,13 @@ void render_container(xcb_connection_t *conn, Container *container) {
                                         offset_y = current_client * decoration_height;
                                 }
                                 current_client++;
-                        } else if (container->mode == MODE_TABBED)
+                        } else if (container->mode == MODE_TABBED) {
+                                if (container->stack_limit == STACK_LIMIT_ROWS) {
+                                        LOG("You limited this container in its rows. "
+                                            "This makes no sense in tabbing mode.\n");
+                                }
                                 offset_x = current_client++ * size_each;
+                        }
                         decorate_window(conn, client, stack_win->pixmap.id, stack_win->pixmap.gc,
                                         offset_x, offset_y);
                 }