diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2025-05-26 14:19:17 +0200 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2025-05-26 14:19:17 +0200 |
| commit | d2ef57e60c89c7cb3c652a932de37fd560b9addd (patch) | |
| tree | dc9e4e8671983a8072cd3e978c8434f4028da82f /include | |
| parent | a0533257b4ccab1b4c4f2c52e1dda9e959c720cf (diff) | |
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.
Diffstat (limited to 'include')
| -rw-r--r-- | include/sway/desktop/transaction.h | 6 | ||||
| -rw-r--r-- | include/sway/output.h | 2 | ||||
| -rw-r--r-- | include/sway/tree/container.h | 2 | ||||
| -rw-r--r-- | include/sway/tree/node.h | 1 | ||||
| -rw-r--r-- | include/sway/tree/view.h | 4 | ||||
| -rw-r--r-- | include/sway/tree/workspace.h | 4 |
6 files changed, 7 insertions, 12 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index dd7edb7a..80af4aae 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h @@ -23,6 +23,7 @@ struct sway_transaction_instruction; struct sway_view; +struct sway_node; /** * Find all dirty containers, create and commit a transaction containing them, @@ -30,6 +31,11 @@ struct sway_view; */ void transaction_commit_dirty(void); +/** + * Remove a node that will be destroyed from transactions and dirty node lists. + */ +void transaction_remove_node(struct sway_node *node); + /* * Same as transaction_commit_dirty, but signalling that this is a * client-initiated change has already taken effect. diff --git a/include/sway/output.h b/include/sway/output.h index f6354e0e..43c3dc9a 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -84,8 +84,6 @@ struct sway_output *output_create(struct wlr_output *wlr_output); void output_destroy(struct sway_output *output); -void output_begin_destroy(struct sway_output *output); - struct sway_output *output_from_wlr_output(struct wlr_output *output); struct sway_output *output_get_in_direction(struct sway_output *reference, diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index e18fd00a..4b284104 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -155,8 +155,6 @@ struct sway_container *container_create(struct sway_view *view); void container_destroy(struct sway_container *con); -void container_begin_destroy(struct sway_container *con); - /** * Search a container's descendants a container based on test criteria. Returns * the first container that passes the test. diff --git a/include/sway/tree/node.h b/include/sway/tree/node.h index e2dbcdf0..7b6e936c 100644 --- a/include/sway/tree/node.h +++ b/include/sway/tree/node.h @@ -39,7 +39,6 @@ struct sway_node { struct sway_transaction_instruction *instruction; size_t ntxnrefs; - bool destroying; // If true, indicates that the container has pending state that differs from // the current. diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 6151a023..d999b502 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -101,8 +101,6 @@ struct sway_view { struct wl_listener foreign_close_request; struct wl_listener foreign_destroy; - bool destroying; - list_t *executed_criteria; // struct criteria * union { @@ -296,8 +294,6 @@ bool view_init(struct sway_view *view, enum sway_view_type type, void view_destroy(struct sway_view *view); -void view_begin_destroy(struct sway_view *view); - /** * Map a view, ie. make it visible in the tree. * diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 27ed649f..77991b27 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -62,9 +62,7 @@ struct sway_workspace *workspace_create(struct sway_output *output, void workspace_destroy(struct sway_workspace *workspace); -void workspace_begin_destroy(struct sway_workspace *workspace); - -void workspace_consider_destroy(struct sway_workspace *ws); +bool workspace_consider_destroy(struct sway_workspace *ws); char *workspace_next_name(const char *output_name); |
