diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-12 21:27:28 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-02-16 00:18:26 +0100 |
commit | c8bf84c82d82e332c1bb83ff27c3df87576c892e (patch) | |
tree | cff03b4c167b30b9725e56654582f220dfc80c8f /include/sway | |
parent | Align ordering of core node properties with i3 (diff) | |
download | sway-c8bf84c82d82e332c1bb83ff27c3df87576c892e.tar.gz sway-c8bf84c82d82e332c1bb83ff27c3df87576c892e.tar.zst sway-c8bf84c82d82e332c1bb83ff27c3df87576c892e.zip |
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
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/server.h | 18 |
1 files changed, 17 insertions, 1 deletions
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 @@ | |||
23 | #include "sway/xwayland.h" | 23 | #include "sway/xwayland.h" |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | struct sway_transaction; | ||
27 | |||
26 | struct sway_server { | 28 | struct sway_server { |
27 | struct wl_display *wl_display; | 29 | struct wl_display *wl_display; |
28 | struct wl_event_loop *wl_event_loop; | 30 | struct wl_event_loop *wl_event_loop; |
@@ -85,8 +87,22 @@ struct sway_server { | |||
85 | struct wlr_text_input_manager_v3 *text_input; | 87 | struct wlr_text_input_manager_v3 *text_input; |
86 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 88 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
87 | 89 | ||
90 | // The timeout for transactions, after which a transaction is applied | ||
91 | // regardless of readiness. | ||
88 | size_t txn_timeout_ms; | 92 | size_t txn_timeout_ms; |
89 | list_t *transactions; | 93 | |
94 | // Stores a transaction after it has been committed, but is waiting for | ||
95 | // views to ack the new dimensions before being applied. A queued | ||
96 | // transaction is frozen and must not have new instructions added to it. | ||
97 | struct sway_transaction *queued_transaction; | ||
98 | |||
99 | // Stores a pending transaction that will be committed once the existing | ||
100 | // queued transaction is applied and freed. The pending transaction can be | ||
101 | // updated with new instructions as needed. | ||
102 | struct sway_transaction *pending_transaction; | ||
103 | |||
104 | // Stores the nodes that have been marked as "dirty" and will be put into | ||
105 | // the pending transaction. | ||
90 | list_t *dirty_nodes; | 106 | list_t *dirty_nodes; |
91 | }; | 107 | }; |
92 | 108 | ||