+ int offset_x = 0;
+ int offset_y = 0;
+ 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;
+ }
+ } else if (container->stack_limit == STACK_LIMIT_ROWS) {
+ offset_x = current_col * wrap;
+ offset_y = current_row * decoration_height;
+ current_row++;
+ if ((current_row % container->stack_limit_value) == 0) {
+ current_col++;
+ current_row = 0;
+ }
+ } else {
+ offset_y = current_client * decoration_height;
+ }
+ current_client++;
+ } else if (container->mode == MODE_TABBED) {
+ if (container->stack_limit == STACK_LIMIT_ROWS) {
+ LOG("You limited a tabbed container in its rows. "
+ "This makes no sense in tabbing mode.\n");
+ }
+ offset_x = current_client++ * size_each;
+ }
+ if (stack_win->pixmap.id == XCB_NONE)
+ continue;
+ decorate_window(conn, client, stack_win->pixmap.id,
+ stack_win->pixmap.gc, offset_x, offset_y);
+ }
+
+ /* Check if we need to fill one column because of an uneven
+ * amount of windows */
+ if (container->mode == MODE_STACK) {
+ if (container->stack_limit == STACK_LIMIT_COLS && (current_col % 2) != 0) {
+ xcb_change_gc_single(conn, stack_win->pixmap.gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#000000"));
+
+ int offset_x = current_col * (stack_win->rect.width / container->stack_limit_value);
+ int offset_y = current_row * decoration_height;
+ xcb_rectangle_t rect = {offset_x, offset_y,
+ offset_x + container->width,
+ offset_y + decoration_height };
+ xcb_poly_fill_rectangle(conn, stack_win->pixmap.id, stack_win->pixmap.gc, 1, &rect);
+ } else if (container->stack_limit == STACK_LIMIT_ROWS && (current_row % 2) != 0) {
+ xcb_change_gc_single(conn, stack_win->pixmap.gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#000000"));
+
+ int offset_x = current_col * wrap;
+ int offset_y = current_row * decoration_height;
+ xcb_rectangle_t rect = {offset_x, offset_y,
+ offset_x + container->width,
+ offset_y + decoration_height };
+ xcb_poly_fill_rectangle(conn, stack_win->pixmap.id, stack_win->pixmap.gc, 1, &rect);
+ }