summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 97318daa..78baa705 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -592,19 +592,18 @@ void view_unmap(struct sway_view *view) {
592 view->urgent_timer = NULL; 592 view->urgent_timer = NULL;
593 } 593 }
594 594
595 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); 595 bool was_fullscreen = view->swayc->is_fullscreen;
596 596 struct sway_container *surviving_ancestor = container_destroy(view->swayc);
597 struct sway_container *parent; 597
598 if (container_is_fullscreen_or_child(view->swayc)) { 598 // If the workspace wasn't reaped
599 parent = container_destroy(view->swayc); 599 if (surviving_ancestor->type >= C_WORKSPACE) {
600 arrange_windows(ws->parent); 600 struct sway_container *ws = surviving_ancestor->type == C_WORKSPACE ?
601 } else { 601 surviving_ancestor :
602 parent = container_destroy(view->swayc); 602 container_parent(surviving_ancestor, C_WORKSPACE);
603 arrange_windows(parent); 603 arrange_windows(was_fullscreen ? ws : surviving_ancestor);
604 }
605 if (parent->type >= C_WORKSPACE) { // if the workspace still exists
606 workspace_detect_urgent(ws); 604 workspace_detect_urgent(ws);
607 } 605 }
606
608 transaction_commit_dirty(); 607 transaction_commit_dirty();
609 view->surface = NULL; 608 view->surface = NULL;
610} 609}