diff options
Diffstat (limited to 'include/sway/desktop/transaction.h')
-rw-r--r-- | include/sway/desktop/transaction.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h new file mode 100644 index 00000000..d6adc609 --- /dev/null +++ b/include/sway/desktop/transaction.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef _SWAY_TRANSACTION_H | ||
2 | #define _SWAY_TRANSACTION_H | ||
3 | #include <wlr/render/wlr_texture.h> | ||
4 | #include "sway/tree/container.h" | ||
5 | |||
6 | /** | ||
7 | * Transactions enable us to perform atomic layout updates. | ||
8 | * | ||
9 | * When we want to make adjustments to the layout, we create a transaction. | ||
10 | * A transaction contains a list of affected containers and their new state. | ||
11 | * A state might contain a new size, or new border settings, or new parent/child | ||
12 | * relationships. | ||
13 | * | ||
14 | * Calling transaction_commit() makes sway notify of all the affected clients | ||
15 | * with their new sizes. We then wait for all the views to respond with their | ||
16 | * new surface sizes. When all are ready, or when a timeout has passed, we apply | ||
17 | * the updates all at the same time. | ||
18 | */ | ||
19 | |||
20 | struct sway_transaction; | ||
21 | |||
22 | /** | ||
23 | * Create a new transaction. | ||
24 | */ | ||
25 | struct sway_transaction *transaction_create(void); | ||
26 | |||
27 | /** | ||
28 | * Add a container's pending state to the transaction. | ||
29 | */ | ||
30 | void transaction_add_container(struct sway_transaction *transaction, | ||
31 | struct sway_container *container); | ||
32 | |||
33 | /** | ||
34 | * Add a box to be damaged when the transaction is applied. | ||
35 | * The box should be in layout coordinates. | ||
36 | */ | ||
37 | void transaction_add_damage(struct sway_transaction *transaction, | ||
38 | struct wlr_box *box); | ||
39 | |||
40 | /** | ||
41 | * Submit a transaction to the client views for configuration. | ||
42 | */ | ||
43 | void transaction_commit(struct sway_transaction *transaction); | ||
44 | |||
45 | /** | ||
46 | * Notify the transaction system that a view is ready for the new layout. | ||
47 | * | ||
48 | * When all views in the transaction are ready, the layout will be applied. | ||
49 | */ | ||
50 | void transaction_notify_view_ready(struct sway_view *view, uint32_t serial); | ||
51 | |||
52 | /** | ||
53 | * Get the texture that should be rendered for a view. | ||
54 | * | ||
55 | * In most cases this will return the normal live texture for a view, but if the | ||
56 | * view is in a transaction then it'll return a saved texture. | ||
57 | */ | ||
58 | struct wlr_texture *transaction_get_texture(struct sway_view *view); | ||
59 | |||
60 | #endif | ||