From c8bf84c82d82e332c1bb83ff27c3df87576c892e Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 12 Feb 2021 21:27:28 +0100 Subject: transactions: Amend pending transactions The transaction system contains a necessary optimization where a popped transaction is combined with later, similar transactions. This breaks the chronological order of states, and can lead to desynchronized geometries. To fix this, we replace the queue with only 2 transactions: current and pending. If a pending transaction exists, it is updated with new state instead of creating additional transactions. As we never have more than a single waiting transaction, we no longer need the queue optimization that is causing problems. Closes: https://github.com/swaywm/sway/issues/6012 --- include/sway/server.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sway/server.h b/include/sway/server.h index 0f5e3ab2..5a2562b3 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -23,6 +23,8 @@ #include "sway/xwayland.h" #endif +struct sway_transaction; + struct sway_server { struct wl_display *wl_display; struct wl_event_loop *wl_event_loop; @@ -85,8 +87,22 @@ struct sway_server { struct wlr_text_input_manager_v3 *text_input; struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; + // The timeout for transactions, after which a transaction is applied + // regardless of readiness. size_t txn_timeout_ms; - list_t *transactions; + + // Stores a transaction after it has been committed, but is waiting for + // views to ack the new dimensions before being applied. A queued + // transaction is frozen and must not have new instructions added to it. + struct sway_transaction *queued_transaction; + + // Stores a pending transaction that will be committed once the existing + // queued transaction is applied and freed. The pending transaction can be + // updated with new instructions as needed. + struct sway_transaction *pending_transaction; + + // Stores the nodes that have been marked as "dirty" and will be put into + // the pending transaction. list_t *dirty_nodes; }; -- cgit v1.2.3-54-g00ecf