aboutsummaryrefslogtreecommitdiff
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorD.B <thejan.2009@gmail.com>2016-07-07 22:28:57 +0200
committerD.B <thejan.2009@gmail.com>2016-07-07 22:28:57 +0200
commitee67cd0ba1e950f5e21328580cc46b618be5fc01 (patch)
tree20a270ed04829763c56c854f7b3978cf4b640e5d /sway/handlers.c
parent378149b59c8d2a6d2b0bab7f2bb507dbac990734 (diff)
Fix tabbed/stacked corner case #742
Tabbed/stacked containers are now created only if a view is present on the workspace. If a view is created on previously empty tabbed/stacked workspace, it gets wrapped in a container.
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 8f2f8a21..647f9771 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -318,6 +318,16 @@ static bool handle_view_created(wlc_handle handle) {
if (workspace && workspace->fullscreen) {
set_focused_container(workspace->fullscreen);
}
+
+ // if parent container is a workspace, newview its only child and
+ // layout is tabbed/stacked, add a container around newview
+ swayc_t *parent_container = newview->parent;
+ if (parent_container->type == C_WORKSPACE && parent_container->children->length == 1 &&
+ (parent_container->layout == L_TABBED || parent_container->layout == L_STACKED)) {
+ swayc_t *container = new_container(newview, parent_container->layout);
+ set_focused_container(newview);
+ arrange_windows(container, -1, -1);
+ }
} else {
swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
wlc_handle *h = malloc(sizeof(wlc_handle));