From ec7ff769c7b4da616ebe6bfd90b70350dd39e166 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Fri, 1 Apr 2016 00:04:08 +0200 Subject: Tabbed and stacked layout --- sway/commands.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 11284577..07dd715c 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1759,7 +1759,15 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { parent = parent->parent; } - if (strcasecmp(argv[0], "splith") == 0) { + if (strcasecmp(argv[0], "default") == 0) { + // TODO: determine default from default_orientation and + // cmd_workspace_layout + parent->layout = L_HORIZ; + } else if (strcasecmp(argv[0], "tabbed") == 0) { + parent->layout = L_TABBED; + } else if (strcasecmp(argv[0], "stacking") == 0) { + parent->layout = L_STACKED; + } else if (strcasecmp(argv[0], "splith") == 0) { parent->layout = L_HORIZ; } else if (strcasecmp(argv[0], "splitv") == 0) { parent->layout = L_VERT; @@ -1770,6 +1778,7 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { parent->layout = L_VERT; } } + arrange_windows(parent, parent->width, parent->height); return cmd_results_new(CMD_SUCCESS, NULL, NULL); -- cgit v1.2.3 From 8d700fe008ccf9f7eb4664e236277c9f30a449fb Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Fri, 1 Apr 2016 13:36:36 +0200 Subject: Fix problems with floating windows Makes any tabbed/stacked layout a container to separate from floating windows which may be attached to a workspace. --- sway/commands.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 07dd715c..12d60854 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1764,8 +1764,16 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { // cmd_workspace_layout parent->layout = L_HORIZ; } else if (strcasecmp(argv[0], "tabbed") == 0) { + if (parent->type != C_CONTAINER) { + parent = new_container(parent, L_TABBED); + } + parent->layout = L_TABBED; } else if (strcasecmp(argv[0], "stacking") == 0) { + if (parent->type != C_CONTAINER) { + parent = new_container(parent, L_STACKED); + } + parent->layout = L_STACKED; } else if (strcasecmp(argv[0], "splith") == 0) { parent->layout = L_HORIZ; -- cgit v1.2.3 From d26658fb355fdf7feee2d6aa801e487502e6ce8b Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Fri, 1 Apr 2016 15:58:29 +0200 Subject: Correctly determine default layout --- sway/commands.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 12d60854..ce1fe8a3 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1760,9 +1760,8 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { } if (strcasecmp(argv[0], "default") == 0) { - // TODO: determine default from default_orientation and - // cmd_workspace_layout - parent->layout = L_HORIZ; + swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); + parent->layout = default_layout(output); } else if (strcasecmp(argv[0], "tabbed") == 0) { if (parent->type != C_CONTAINER) { parent = new_container(parent, L_TABBED); -- cgit v1.2.3 From e226b20bd8d2ce98077aee35b2a33b73943db247 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Sat, 2 Apr 2016 16:29:31 +0200 Subject: Reapply prev layout when exiting tabbed/stacked --- sway/commands.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index ce1fe8a3..ad5416f7 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1760,29 +1760,38 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { } if (strcasecmp(argv[0], "default") == 0) { - swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); - parent->layout = default_layout(output); - } else if (strcasecmp(argv[0], "tabbed") == 0) { - if (parent->type != C_CONTAINER) { - parent = new_container(parent, L_TABBED); + parent->layout = parent->prev_layout; + if (parent->layout == L_NONE) { + swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); + parent->layout = default_layout(output); } - - parent->layout = L_TABBED; - } else if (strcasecmp(argv[0], "stacking") == 0) { - if (parent->type != C_CONTAINER) { - parent = new_container(parent, L_STACKED); + } else { + if (parent->layout != L_TABBED && parent->layout != L_STACKED) { + parent->prev_layout = parent->layout; } - parent->layout = L_STACKED; - } else 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], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { - if (parent->layout == L_VERT) { + if (strcasecmp(argv[0], "tabbed") == 0) { + if (parent->type != C_CONTAINER) { + parent = new_container(parent, L_TABBED); + } + + parent->layout = L_TABBED; + } else if (strcasecmp(argv[0], "stacking") == 0) { + if (parent->type != C_CONTAINER) { + parent = new_container(parent, L_STACKED); + } + + parent->layout = L_STACKED; + } else if (strcasecmp(argv[0], "splith") == 0) { parent->layout = L_HORIZ; - } else { + } else if (strcasecmp(argv[0], "splitv") == 0) { parent->layout = L_VERT; + } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { + if (parent->layout == L_VERT) { + parent->layout = L_HORIZ; + } else { + parent->layout = L_VERT; + } } } -- cgit v1.2.3 From 3e1f78ab26e8bc6b6cefd53ee137e97533c2695e Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Wed, 20 Apr 2016 00:22:15 +0200 Subject: Add support for nested tabbed/stacked containers --- sway/commands.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index ad5416f7..ff1ddc5b 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1759,6 +1759,8 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { parent = parent->parent; } + enum swayc_layouts old_layout = parent->layout; + if (strcasecmp(argv[0], "default") == 0) { parent->layout = parent->prev_layout; if (parent->layout == L_NONE) { @@ -1795,6 +1797,8 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { } } + update_layout_geometry(parent, old_layout); + arrange_windows(parent, parent->width, parent->height); return cmd_results_new(CMD_SUCCESS, NULL, NULL); @@ -2032,6 +2036,7 @@ static struct cmd_results *_do_split(int argc, char **argv, int layout) { /* regular case where new split container is build around focused container * or in case of workspace, container inherits its children */ sway_log(L_DEBUG, "Adding new container around current focused container"); + sway_log(L_INFO, "FOCUSED SIZE: %.f %.f", focused->width, focused->height); swayc_t *parent = new_container(focused, layout); set_focused_container(focused); arrange_windows(parent, -1, -1); -- cgit v1.2.3 From 6c7ed7e7cb1f25429db05103b98e6fcee11d0362 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Sun, 24 Apr 2016 01:47:57 +0200 Subject: Add title to nested tabbed/stacked containers --- sway/commands.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index ff1ddc5b..34364917 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -2041,6 +2042,17 @@ static struct cmd_results *_do_split(int argc, char **argv, int layout) { set_focused_container(focused); arrange_windows(parent, -1, -1); } + + // update container title if tabbed/stacked + if (swayc_tabbed_stacked_parent(focused)) { + update_view_border(focused); + swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT); + // schedule render to make changes take effect right away, + // otherwise we would have to wait for the view to render, + // which is unpredictable. + wlc_output_schedule_render(output->handle); + } + return cmd_results_new(CMD_SUCCESS, NULL, NULL); } -- cgit v1.2.3