aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2020-01-14 17:08:01 -0700
committerBrian Ashworth <bosrsf04@gmail.com>2020-01-16 21:48:25 -0500
commitd88d4bbd9d363435a4d65191446a497de9031cca (patch)
tree369c3bf76bea3013dc08a6796e1ca7225216dc0d /sway/tree
parent18507e62fd9445090ecbe3cdfffb4a10d7ea90ea (diff)
downloadsway-d88d4bbd9d363435a4d65191446a497de9031cca.tar.xz
Fix crash when showing scratchpad hidden split containers
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c7
-rw-r--r--sway/tree/root.c5
2 files changed, 12 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index aa819be7..56cdee1d 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1527,3 +1527,10 @@ void container_raise_floating(struct sway_container *con) {
bool container_is_scratchpad_hidden(struct sway_container *con) {
return con->scratchpad && !con->workspace;
}
+
+bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
+ while (con->parent) {
+ con = con->parent;
+ }
+ return con->scratchpad && !con->workspace;
+}
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 46a140ef..ebd185ec 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -132,6 +132,11 @@ void root_scratchpad_show(struct sway_container *con) {
if (old_ws) {
container_detach(con);
workspace_consider_destroy(old_ws);
+ } else {
+ // Act on the ancestor of scratchpad hidden split containers
+ while (con->parent) {
+ con = con->parent;
+ }
}
workspace_add_floating(new_ws, con);