mirror of
https://github.com/swaywm/sway.git
synced 2026-03-20 05:34:28 -04:00
sway/tree: Simplify sway_node teardown
A sway_node may end up being referenced in either a queued transaction, pending transaction or as a dirty node. To manage this, the transaction system has been responsible for destroying containers, workspaces and outputs at the end of their last referenced transaction. This significantly complicates the teardown flow of surfaces and outputs. Instead, remove the node from transactions and dirty lists so that the callsite can remove and free the node immediately.
This commit is contained in:
parent
4f59eeef05
commit
e28e6484e8
16 changed files with 125 additions and 149 deletions
|
|
@ -611,14 +611,16 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
|||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
} else if (old_ws) {
|
||||
workspace_consider_destroy(old_ws);
|
||||
if (workspace_consider_destroy(old_ws)) {
|
||||
old_ws = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
|
@ -753,7 +755,9 @@ static struct cmd_results *cmd_move_in_direction(
|
|||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
} else if (old_ws) {
|
||||
workspace_consider_destroy(old_ws);
|
||||
if (workspace_consider_destroy(old_ws)) {
|
||||
old_ws = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct sway_workspace *new_ws = container->pending.workspace;
|
||||
|
|
@ -761,7 +765,9 @@ static struct cmd_results *cmd_move_in_direction(
|
|||
if (root->fullscreen_global) {
|
||||
arrange_root();
|
||||
} else {
|
||||
arrange_workspace(old_ws);
|
||||
if (old_ws) {
|
||||
arrange_workspace(old_ws);
|
||||
}
|
||||
if (new_ws != old_ws) {
|
||||
arrange_workspace(new_ws);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue