diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index fdd92f648..d8a7c5010 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -56,8 +56,6 @@ void workspace_destroy(struct sway_workspace *workspace); void workspace_begin_destroy(struct sway_workspace *workspace); -void workspace_consider_destroy(struct sway_workspace *ws); - char *workspace_next_name(const char *output_name); bool workspace_switch(struct sway_workspace *workspace, diff --git a/sway/commands/move.c b/sway/commands/move.c index f8f89f183..9e5705236 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -601,15 +601,13 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth, // clean-up, destroying parents if the container was the last child if (old_parent) { container_reap_empty(old_parent); - } else if (old_ws) { - workspace_consider_destroy(old_ws); } // arrange windows if (root->fullscreen_global) { arrange_root(); } else { - if (old_ws && !old_ws->node.destroying) { + if (old_ws) { arrange_workspace(old_ws); } arrange_node(node_get_parent(destination)); @@ -643,8 +641,6 @@ static void workspace_move_to_output(struct sway_workspace *workspace, seat_set_raw_focus(seat, &ws->node); } - workspace_consider_destroy(new_output_old_ws); - output_sort_workspaces(output); struct sway_node *focus = seat_get_focus_inactive(seat, &workspace->node); seat_set_focus(seat, focus); @@ -740,8 +736,6 @@ static struct cmd_results *cmd_move_in_direction( // clean-up, destroying parents if the container was the last child if (old_parent) { container_reap_empty(old_parent); - } else if (old_ws) { - workspace_consider_destroy(old_ws); } struct sway_workspace *new_ws = container->workspace; diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c index 3c93a2766..0ee7f4d84 100644 --- a/sway/commands/sticky.c +++ b/sway/commands/sticky.c @@ -36,12 +36,10 @@ struct cmd_results *cmd_sticky(int argc, char **argv) { "Expected output to have a workspace"); } if (container->workspace != active_workspace) { - struct sway_workspace *old_workspace = container->workspace; container_detach(container); workspace_add_floating(active_workspace, container); container_handle_fullscreen_reparent(container); arrange_workspace(active_workspace); - workspace_consider_destroy(old_workspace); } } diff --git a/sway/input/seat.c b/sway/input/seat.c index 3c0d9a294..edc6ac331 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1194,13 +1194,6 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { } } - if (new_output_last_ws) { - workspace_consider_destroy(new_output_last_ws); - } - if (last_workspace && last_workspace != new_output_last_ws) { - workspace_consider_destroy(last_workspace); - } - seat->has_focus = true; if (config->smart_gaps && new_workspace) { diff --git a/sway/tree/container.c b/sway/tree/container.c index 6a9ce1c4c..ad3db5165 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -121,7 +121,6 @@ void container_reap_empty(struct sway_container *con) { if (con->view) { return; } - struct sway_workspace *ws = con->workspace; while (con) { if (con->children->length) { return; @@ -130,9 +129,6 @@ void container_reap_empty(struct sway_container *con) { container_begin_destroy(con); con = parent; } - if (ws) { - workspace_consider_destroy(ws); - } } struct sway_container *container_flatten(struct sway_container *container) { diff --git a/sway/tree/output.c b/sway/tree/output.c index a8ae30f7a..12d0c168e 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -216,12 +216,6 @@ static void output_evacuate(struct sway_output *output) { output_add_workspace(new_output, workspace); output_sort_workspaces(new_output); ipc_event_workspace(NULL, workspace, "move"); - - // If there is an old workspace (the noop output may not have one), - // check to see if it is empty and should be destroyed. - if (new_output_ws) { - workspace_consider_destroy(new_output_ws); - } } } diff --git a/sway/tree/root.c b/sway/tree/root.c index 7a594538e..56259407a 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -131,7 +131,6 @@ void root_scratchpad_show(struct sway_container *con) { // Show the container if (old_ws) { container_detach(con); - workspace_consider_destroy(old_ws); } else { // Act on the ancestor of scratchpad hidden split containers while (con->parent) { diff --git a/sway/tree/view.c b/sway/tree/view.c index e62fd018c..8559f0231 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -843,14 +843,12 @@ void view_unmap(struct sway_view *view) { container_begin_destroy(view->container); if (parent) { container_reap_empty(parent); - } else if (ws) { - workspace_consider_destroy(ws); } if (root->fullscreen_global) { // Container may have been a child of the root fullscreen container arrange_root(); - } else if (ws && !ws->node.destroying) { + } else if (ws) { arrange_workspace(ws); workspace_detect_urgent(ws); } diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 921b7d19a..4b5eb6027 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -151,26 +151,6 @@ void workspace_begin_destroy(struct sway_workspace *workspace) { node_set_dirty(&workspace->node); } -void workspace_consider_destroy(struct sway_workspace *ws) { - if (ws->tiling->length || ws->floating->length) { - return; - } - - if (ws->output && output_get_active_workspace(ws->output) == ws) { - return; - } - - struct sway_seat *seat; - wl_list_for_each(seat, &server.input->seats, link) { - struct sway_node *node = seat_get_focus_inactive(seat, &root->node); - if (node == &ws->node) { - return; - } - } - - workspace_begin_destroy(ws); -} - static bool workspace_valid_on_output(const char *output_name, const char *ws_name) { struct workspace_config *wsc = workspace_find_config(ws_name);