diff --git a/sway/commands/default_orientation.c b/sway/commands/default_orientation.c index 848b1a44e..a5347ce21 100644 --- a/sway/commands/default_orientation.c +++ b/sway/commands/default_orientation.c @@ -11,13 +11,11 @@ struct cmd_results *cmd_default_orientation(int argc, char **argv) { config->default_orientation = L_HORIZ; } else if (strcasecmp(argv[0], "vertical") == 0) { config->default_orientation = L_VERT; - } else if (strcasecmp(argv[0], "tabbed") == 0) { - config->default_orientation = L_TABBED; } else if (strcasecmp(argv[0], "auto") == 0) { // Do nothing } else { return cmd_results_new(CMD_INVALID, "default_orientation", - "Expected 'orientation '"); + "Expected 'orientation '"); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } diff --git a/sway/commands/layout.c b/sway/commands/layout.c index 559be7c5b..fa59eac47 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -23,8 +23,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) { parent = parent->parent; } - // TODO: stacks and tabs - + // TODO: stacks if (strcasecmp(argv[0], "default") == 0) { parent->layout = parent->prev_layout; @@ -36,14 +35,12 @@ struct cmd_results *cmd_layout(int argc, char **argv) { parent->prev_layout = parent->layout; } - if (strcasecmp(argv[0], "tabbed") == 0) { - parent->layout = L_TABBED; - } - if (strcasecmp(argv[0], "splith") == 0) { parent->layout = L_HORIZ; } else if (strcasecmp(argv[0], "splitv") == 0) { parent->layout = L_VERT; + } else if (strcasecmp(argv[0], "tabbed") == 0) { + parent->layout = L_TABBED; } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { if (parent->layout == L_HORIZ) { parent->layout = L_VERT; diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 4fd8db8c9..0fd4434f1 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -228,19 +228,16 @@ static void render_view(struct sway_view *view, struct sway_output *output) { */ static void render_container_simple_border_normal(struct sway_output *output, struct sway_container *con, struct border_colors *colors, - struct wlr_texture *title_texture, int iteration) { + struct wlr_texture *title_texture, int depth) { struct wlr_renderer *renderer = wlr_backend_get_renderer(output->wlr_output->backend); struct wlr_box box; float color[4]; - size_t num_tabs; + size_t num_tabs = 1; if (con->parent->layout == L_TABBED) { num_tabs = con->parent->children->length; } - else { - num_tabs = 1; - } // Child border - left edge memcpy(&color, colors->child_border, sizeof(float) * 4); @@ -286,7 +283,7 @@ static void render_container_simple_border_normal(struct sway_output *output, // Single pixel bar above title memcpy(&color, colors->border, sizeof(float) * 4); color[3] *= con->alpha; - box.x = con->x + iteration * (con->width / num_tabs); + box.x = con->x + depth * (con->width / num_tabs); box.y = con->y; box.width = con->width / num_tabs; box.height = 1; @@ -295,7 +292,7 @@ static void render_container_simple_border_normal(struct sway_output *output, output->wlr_output->transform_matrix); // Single pixel bar below title - box.x = con->x + iteration * (con->width / num_tabs); + box.x = con->x + depth * (con->width / num_tabs); box.y = con->sway_view->y - 1; box.width = con->width / num_tabs; box.height = 1; @@ -306,7 +303,7 @@ static void render_container_simple_border_normal(struct sway_output *output, // Title background memcpy(&color, colors->background, sizeof(float) * 4); color[3] *= con->alpha; - box.x = con->x + iteration * (con->width / num_tabs); + box.x = con->x + depth * (con->width / num_tabs); box.y = con->y + 1; box.width = con->width / num_tabs; box.height = con->sway_view->y - con->y - 2; @@ -476,8 +473,7 @@ static void render_container_tabbed(struct sway_output *output, } } } - } - else { + } else { render_container(output, child); } } diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 3fe68ec5b..60d0dfb95 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -164,7 +164,7 @@ static void apply_tabbed_layout(struct sway_container *parent) { if (!num_children) { return; } - for (size_t i=0; i < num_children; ++i) { + for (size_t i = 0; i < num_children; ++i) { struct sway_container *child = parent->children->items[i]; child->x = parent->x; child->y = parent->y;