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/container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 95a46632..e77ba062 100644 --- a/sway/container.c +++ b/sway/container.c @@ -725,7 +725,7 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { if (parent->type == C_OUTPUT || parent->layout == L_TABBED || parent->layout == L_STACKED) { - container->visible = parent->focused == container; + container->visible = parent->focused == container && parent->visible; } // Set visibility and output for view if (container->type == C_VIEW) { -- 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/container.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index e77ba062..2b100f40 100644 --- a/sway/container.c +++ b/sway/container.c @@ -237,7 +237,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { add_child(workspace, cont); // give them proper layouts cont->layout = workspace->layout; - workspace->layout = layout; + /* TODO: might break shit in move_container!!! workspace->layout = layout; */ set_focused_container_for(workspace, get_focused_view(workspace)); } else { // Or is built around container swayc_t *parent = replace_child(child, cont); @@ -722,9 +722,7 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { swayc_t *parent = container->parent; container->visible = parent->visible; // special cases where visibility depends on focus - if (parent->type == C_OUTPUT - || parent->layout == L_TABBED - || parent->layout == L_STACKED) { + if (parent->type == C_OUTPUT || swayc_is_tabbed_stacked(container)) { container->visible = parent->focused == container && parent->visible; } // Set visibility and output for view @@ -814,3 +812,8 @@ static void close_view(swayc_t *container, void *data) { void close_views(swayc_t *container) { container_map(container, close_view, NULL); } + +bool swayc_is_tabbed_stacked(swayc_t *view) { + return (view->parent->layout == L_TABBED + || view->parent->layout == L_STACKED); +} -- 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/container.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 2b100f40..5579fddb 100644 --- a/sway/container.c +++ b/sway/container.c @@ -163,16 +163,8 @@ swayc_t *new_workspace(swayc_t *output, const char *name) { sway_log(L_DEBUG, "Added workspace %s for output %u", name, (unsigned int)output->handle); swayc_t *workspace = new_swayc(C_WORKSPACE); - // TODO: default_layout - if (config->default_layout != L_NONE) { - workspace->layout = config->default_layout; - } else if (config->default_orientation != L_NONE) { - workspace->layout = config->default_orientation; - } else if (output->width >= output->height) { - workspace->layout = L_HORIZ; - } else { - workspace->layout = L_VERT; - } + workspace->layout = default_layout(output); + workspace->x = output->x; workspace->y = output->y; workspace->width = output->width; -- 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/container.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 5579fddb..42f6a69a 100644 --- a/sway/container.c +++ b/sway/container.c @@ -163,6 +163,7 @@ swayc_t *new_workspace(swayc_t *output, const char *name) { sway_log(L_DEBUG, "Added workspace %s for output %u", name, (unsigned int)output->handle); swayc_t *workspace = new_swayc(C_WORKSPACE); + workspace->prev_layout = L_NONE; workspace->layout = default_layout(output); workspace->x = output->x; @@ -203,6 +204,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { sway_log(L_DEBUG, "creating container %p around %p", cont, child); + cont->prev_layout = L_NONE; cont->layout = layout; cont->width = child->width; cont->height = child->height; @@ -229,6 +231,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { add_child(workspace, cont); // give them proper layouts cont->layout = workspace->layout; + cont->prev_layout = workspace->prev_layout; /* TODO: might break shit in move_container!!! workspace->layout = layout; */ set_focused_container_for(workspace, get_focused_view(workspace)); } else { // Or is built around container -- 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/container.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 42f6a69a..f4258c84 100644 --- a/sway/container.c +++ b/sway/container.c @@ -8,6 +8,7 @@ #include "container.h" #include "workspace.h" #include "focus.h" +#include "border.h" #include "layout.h" #include "input_state.h" #include "log.h" @@ -64,7 +65,12 @@ static void free_swayc(swayc_t *cont) { if (cont->bg_pid != 0) { terminate_swaybg(cont->bg_pid); } - free(cont->border); + if (cont->border) { + if (cont->border->buffer) { + free(cont->border->buffer); + } + free(cont->border); + } free(cont); } @@ -211,6 +217,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { cont->x = child->x; cont->y = child->y; cont->visible = child->visible; + cont->cached_geometry = child->cached_geometry; /* Container inherits all of workspaces children, layout and whatnot */ if (child->type == C_WORKSPACE) { @@ -812,3 +819,18 @@ bool swayc_is_tabbed_stacked(swayc_t *view) { return (view->parent->layout == L_TABBED || view->parent->layout == L_STACKED); } + +swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { + swayc_t *parent = NULL; + if (!ASSERT_NONNULL(view)) { + return NULL; + } + do { + view = view->parent; + if (view->layout == L_TABBED || view->layout == L_STACKED) { + parent = view; + } + } while (view && view->type != C_WORKSPACE); + + return parent; +} -- cgit v1.2.3 From 5492277f0c007eea632d242a6d7cbd9cee7cdcf6 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Fri, 22 Apr 2016 22:44:02 +0200 Subject: Disable inner gaps when in tabbed/stacked mode --- sway/container.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index f4258c84..9db81012 100644 --- a/sway/container.c +++ b/sway/container.c @@ -218,6 +218,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { cont->y = child->y; cont->visible = child->visible; cont->cached_geometry = child->cached_geometry; + cont->gaps = child->gaps; /* Container inherits all of workspaces children, layout and whatnot */ if (child->type == C_WORKSPACE) { @@ -680,7 +681,7 @@ bool swayc_is_child_of(swayc_t *child, swayc_t *parent) { } int swayc_gap(swayc_t *container) { - if (container->type == C_VIEW) { + if (container->type == C_VIEW || container->type == C_CONTAINER) { return container->gaps >= 0 ? container->gaps : config->gaps_inner; } else if (container->type == C_WORKSPACE) { int base = container->gaps >= 0 ? container->gaps : config->gaps_outer; -- cgit v1.2.3 From 5a22c0f1c08eddc84a738e8de74dcfab33f41dcf Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Sun, 24 Apr 2016 21:54:33 +0200 Subject: Don't send invisble view to back --- sway/container.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 9db81012..d54dfd96 100644 --- a/sway/container.c +++ b/sway/container.c @@ -732,9 +732,6 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { if (container->type == C_VIEW) { wlc_view_set_output(container->handle, output); wlc_view_set_mask(container->handle, container->visible ? VISIBLE : 0); - if (!container->visible) { - wlc_view_send_to_back(container->handle); - } } // Update visibility for children else { -- cgit v1.2.3 From 856ac7d5cca35dcff2f484003fceba1217b1e491 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Sun, 24 Apr 2016 22:04:26 +0200 Subject: Remove unused function --- sway/container.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index d54dfd96..b49b32ee 100644 --- a/sway/container.c +++ b/sway/container.c @@ -725,7 +725,8 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { swayc_t *parent = container->parent; container->visible = parent->visible; // special cases where visibility depends on focus - if (parent->type == C_OUTPUT || swayc_is_tabbed_stacked(container)) { + if (parent->type == C_OUTPUT || parent->layout == L_TABBED || + parent->layout == L_STACKED) { container->visible = parent->focused == container && parent->visible; } // Set visibility and output for view @@ -813,11 +814,6 @@ void close_views(swayc_t *container) { container_map(container, close_view, NULL); } -bool swayc_is_tabbed_stacked(swayc_t *view) { - return (view->parent->layout == L_TABBED - || view->parent->layout == L_STACKED); -} - swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { swayc_t *parent = NULL; if (!ASSERT_NONNULL(view)) { -- cgit v1.2.3