diff options
-rw-r--r-- | sway/container.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/container.c b/sway/container.c index 416b8db8..d6d27033 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -342,7 +342,7 @@ swayc_t *destroy_workspace(swayc_t *workspace) { | |||
342 | 342 | ||
343 | // Do not destroy if there are children | 343 | // Do not destroy if there are children |
344 | if (workspace->children->length == 0 && workspace->floating->length == 0) { | 344 | if (workspace->children->length == 0 && workspace->floating->length == 0) { |
345 | sway_log(L_DEBUG, "destroying '%s'", workspace->name); | 345 | sway_log(L_DEBUG, "destroying workspace '%s'", workspace->name); |
346 | swayc_t *parent = workspace->parent; | 346 | swayc_t *parent = workspace->parent; |
347 | free_swayc(workspace); | 347 | free_swayc(workspace); |
348 | return parent; | 348 | return parent; |
@@ -600,7 +600,22 @@ void set_view_visibility(swayc_t *view, void *data) { | |||
600 | } | 600 | } |
601 | 601 | ||
602 | void update_visibility(swayc_t *container) { | 602 | void update_visibility(swayc_t *container) { |
603 | swayc_t *ws = swayc_active_workspace_for(container); | 603 | if (!container) { |
604 | return; | ||
605 | } | ||
606 | swayc_t *ws; | ||
607 | if (container->type == C_ROOT || container->type == C_OUTPUT) { | ||
608 | int i, len = container->children->length; | ||
609 | for (i = 0; i < len; ++i) { | ||
610 | update_visibility(container->children->items[i]); | ||
611 | } | ||
612 | return; | ||
613 | } else if (container->type == C_WORKSPACE) { | ||
614 | container->visible = container->parent->focused == container; | ||
615 | ws = container; | ||
616 | } else { | ||
617 | ws = swayc_active_workspace_for(container); | ||
618 | } | ||
604 | // TODO better visibility setting | 619 | // TODO better visibility setting |
605 | bool visible = (ws->parent->focused == ws); | 620 | bool visible = (ws->parent->focused == ws); |
606 | sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible"); | 621 | sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible"); |