diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-03 16:35:06 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-09 10:08:43 +1000 |
commit | 59c94887018bdfa578c4371c4275061ca6e71b3e (patch) | |
tree | 62bdaa6ac4777d1fcb292013bddd2043dad7765a /include/sway/desktop | |
parent | Merge pull request #2115 from RedSoxFan/restore-workspaces (diff) | |
download | sway-59c94887018bdfa578c4371c4275061ca6e71b3e.tar.gz sway-59c94887018bdfa578c4371c4275061ca6e71b3e.tar.zst sway-59c94887018bdfa578c4371c4275061ca6e71b3e.zip |
WIP: Atomic layout updates ground work
Diffstat (limited to 'include/sway/desktop')
-rw-r--r-- | include/sway/desktop/transaction.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h new file mode 100644 index 00000000..575d28c8 --- /dev/null +++ b/include/sway/desktop/transaction.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef _SWAY_TRANSACTION_H | ||
2 | #define _SWAY_TRANSACTION_H | ||
3 | #include "sway/tree/container.h" | ||
4 | |||
5 | /** | ||
6 | * Transactions enable us to perform atomic layout updates. | ||
7 | * | ||
8 | * When we want to make adjustments to the layout, we create a transaction. | ||
9 | * A transaction contains a list of affected containers and their new state. | ||
10 | * A state might contain a new size, or new border settings, or new parent/child | ||
11 | * relationships. | ||
12 | * | ||
13 | * Calling transaction_commit() makes sway notify of all the affected clients | ||
14 | * with their new sizes. We then wait for all the views to respond with their | ||
15 | * new surface sizes. When all are ready, or when a timeout has passed, we apply | ||
16 | * the updates all at the same time. | ||
17 | */ | ||
18 | |||
19 | struct sway_transaction { | ||
20 | struct wl_event_source *timer; | ||
21 | list_t *instructions; // struct sway_transaction_instruction * | ||
22 | list_t *damage; // struct wlr_box * | ||
23 | size_t num_waiting; | ||
24 | }; | ||
25 | |||
26 | /** | ||
27 | * Create a new transaction. | ||
28 | */ | ||
29 | struct sway_transaction *transaction_create(void); | ||
30 | |||
31 | /** | ||
32 | * Add a container's pending state to the transaction. | ||
33 | */ | ||
34 | void transaction_add_container(struct sway_transaction *transaction, | ||
35 | struct sway_container *container); | ||
36 | |||
37 | /** | ||
38 | * Add a box to be damaged when the transaction is applied. | ||
39 | * The box should be in layout coordinates. | ||
40 | */ | ||
41 | void transaction_add_damage(struct sway_transaction *transaction, | ||
42 | struct wlr_box *box); | ||
43 | |||
44 | /** | ||
45 | * Submit a transaction to the client views for configuration. | ||
46 | */ | ||
47 | void transaction_commit(struct sway_transaction *transaction); | ||
48 | |||
49 | /** | ||
50 | * Notify the transaction system that a view is ready for the new layout. | ||
51 | * | ||
52 | * When all views in the transaction are ready, the layout will be applied. | ||
53 | */ | ||
54 | void transaction_notify_view_ready(struct sway_view *view, uint32_t serial); | ||
55 | |||
56 | #endif | ||