diff options
Diffstat (limited to 'include/sway/desktop/transaction.h')
-rw-r--r-- | include/sway/desktop/transaction.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h new file mode 100644 index 00000000..7ab80eb8 --- /dev/null +++ b/include/sway/desktop/transaction.h | |||
@@ -0,0 +1,67 @@ | |||
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 | * Submit a transaction to the client views for configuration. | ||
35 | */ | ||
36 | void transaction_commit(struct sway_transaction *transaction); | ||
37 | |||
38 | /** | ||
39 | * Notify the transaction system that a view is ready for the new layout. | ||
40 | * | ||
41 | * When all views in the transaction are ready, the layout will be applied. | ||
42 | */ | ||
43 | void transaction_notify_view_ready(struct sway_view *view, uint32_t serial); | ||
44 | |||
45 | /** | ||
46 | * Notify the transaction system that a view is ready for the new layout, but | ||
47 | * identifying the instruction by width and height rather than by serial. | ||
48 | * | ||
49 | * This is used by xwayland views, as they don't have serials. | ||
50 | */ | ||
51 | void transaction_notify_view_ready_by_size(struct sway_view *view, | ||
52 | int width, int height); | ||
53 | |||
54 | /** | ||
55 | * Get the saved texture that should be rendered for a view. | ||
56 | * | ||
57 | * The addresses pointed at by the width and height pointers will be populated | ||
58 | * with the surface's dimensions, which may be different to the texture's | ||
59 | * dimensions if output scaling is used. | ||
60 | * | ||
61 | * This function should only be called if it is known that the view has | ||
62 | * instructions. | ||
63 | */ | ||
64 | struct wlr_texture *transaction_get_saved_texture(struct sway_view *view, | ||
65 | int *width, int *height); | ||
66 | |||
67 | #endif | ||