diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-23 16:24:11 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-23 16:24:11 +1000 |
commit | 38398e2d77d57dc06b67ec88a54091c897915602 (patch) | |
tree | c80935807865fd96ab7d037070287d4dfaba1863 /include | |
parent | Preserve buffers during transactions (diff) | |
download | sway-38398e2d77d57dc06b67ec88a54091c897915602.tar.gz sway-38398e2d77d57dc06b67ec88a54091c897915602.tar.zst sway-38398e2d77d57dc06b67ec88a54091c897915602.zip |
Implement atomic layout updates for tree operations
This implements atomic layout updates for when views map, reparent or
unmap.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/desktop/transaction.h | 9 | ||||
-rw-r--r-- | include/sway/server.h | 7 | ||||
-rw-r--r-- | include/sway/tree/container.h | 16 | ||||
-rw-r--r-- | include/sway/tree/view.h | 18 |
4 files changed, 37 insertions, 13 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index 5aff28e9..d6adc609 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _SWAY_TRANSACTION_H | 1 | #ifndef _SWAY_TRANSACTION_H |
2 | #define _SWAY_TRANSACTION_H | 2 | #define _SWAY_TRANSACTION_H |
3 | #include <wlr/render/wlr_texture.h> | ||
3 | #include "sway/tree/container.h" | 4 | #include "sway/tree/container.h" |
4 | 5 | ||
5 | /** | 6 | /** |
@@ -48,4 +49,12 @@ void transaction_commit(struct sway_transaction *transaction); | |||
48 | */ | 49 | */ |
49 | void transaction_notify_view_ready(struct sway_view *view, uint32_t serial); | 50 | void transaction_notify_view_ready(struct sway_view *view, uint32_t serial); |
50 | 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 | |||
51 | #endif | 60 | #endif |
diff --git a/include/sway/server.h b/include/sway/server.h index 65d96e7a..f5f88a5a 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <wlr/render/wlr_renderer.h> | 12 | #include <wlr/render/wlr_renderer.h> |
13 | // TODO WLR: make Xwayland optional | 13 | // TODO WLR: make Xwayland optional |
14 | #include <wlr/xwayland.h> | 14 | #include <wlr/xwayland.h> |
15 | #include "list.h" | ||
15 | 16 | ||
16 | struct sway_server { | 17 | struct sway_server { |
17 | struct wl_display *wl_display; | 18 | struct wl_display *wl_display; |
@@ -43,6 +44,12 @@ struct sway_server { | |||
43 | 44 | ||
44 | struct wlr_wl_shell *wl_shell; | 45 | struct wlr_wl_shell *wl_shell; |
45 | struct wl_listener wl_shell_surface; | 46 | struct wl_listener wl_shell_surface; |
47 | |||
48 | bool terminating; | ||
49 | |||
50 | // When a view is being destroyed and is waiting for a transaction to | ||
51 | // complete it will be stored here. | ||
52 | list_t *destroying_containers; | ||
46 | }; | 53 | }; |
47 | 54 | ||
48 | struct sway_server server; | 55 | struct sway_server server; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index f4e978ea..7e78cbef 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -65,8 +65,8 @@ struct sway_container_state { | |||
65 | double gaps_inner; | 65 | double gaps_inner; |
66 | double gaps_outer; | 66 | double gaps_outer; |
67 | 67 | ||
68 | //struct sway_container *parent; | 68 | struct sway_container *parent; |
69 | //list_t *children; | 69 | list_t *children; |
70 | 70 | ||
71 | // View properties | 71 | // View properties |
72 | double view_x, view_y; | 72 | double view_x, view_y; |
@@ -79,6 +79,10 @@ struct sway_container_state { | |||
79 | bool border_bottom; | 79 | bool border_bottom; |
80 | bool border_left; | 80 | bool border_left; |
81 | bool border_right; | 81 | bool border_right; |
82 | |||
83 | // Workspace properties | ||
84 | struct sway_view *ws_fullscreen; | ||
85 | struct sway_container *ws_floating; | ||
82 | }; | 86 | }; |
83 | 87 | ||
84 | struct sway_container { | 88 | struct sway_container { |
@@ -128,8 +132,6 @@ struct sway_container { | |||
128 | 132 | ||
129 | struct sway_container *parent; | 133 | struct sway_container *parent; |
130 | 134 | ||
131 | list_t *marks; // list of char* | ||
132 | |||
133 | float alpha; | 135 | float alpha; |
134 | 136 | ||
135 | struct wlr_texture *title_focused; | 137 | struct wlr_texture *title_focused; |
@@ -138,6 +140,10 @@ struct sway_container { | |||
138 | struct wlr_texture *title_urgent; | 140 | struct wlr_texture *title_urgent; |
139 | size_t title_height; | 141 | size_t title_height; |
140 | 142 | ||
143 | list_t *instructions; // struct sway_transaction_instruction * | ||
144 | |||
145 | bool destroying; | ||
146 | |||
141 | struct { | 147 | struct { |
142 | struct wl_signal destroy; | 148 | struct wl_signal destroy; |
143 | // Raised after the tree updates, but before arrange_windows | 149 | // Raised after the tree updates, but before arrange_windows |
@@ -181,6 +187,8 @@ struct sway_container *workspace_create(struct sway_container *output, | |||
181 | struct sway_container *container_view_create( | 187 | struct sway_container *container_view_create( |
182 | struct sway_container *sibling, struct sway_view *sway_view); | 188 | struct sway_container *sibling, struct sway_view *sway_view); |
183 | 189 | ||
190 | void container_free(struct sway_container *cont); | ||
191 | |||
184 | struct sway_container *container_destroy(struct sway_container *container); | 192 | struct sway_container *container_destroy(struct sway_container *container); |
185 | 193 | ||
186 | struct sway_container *container_close(struct sway_container *container); | 194 | struct sway_container *container_close(struct sway_container *container); |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index fc4c8df9..5a615b43 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -37,7 +37,7 @@ struct sway_view_impl { | |||
37 | void (*for_each_surface)(struct sway_view *view, | 37 | void (*for_each_surface)(struct sway_view *view, |
38 | wlr_surface_iterator_func_t iterator, void *user_data); | 38 | wlr_surface_iterator_func_t iterator, void *user_data); |
39 | void (*close)(struct sway_view *view); | 39 | void (*close)(struct sway_view *view); |
40 | void (*destroy)(struct sway_view *view); | 40 | void (*free)(struct sway_view *view); |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct sway_view { | 43 | struct sway_view { |
@@ -68,15 +68,10 @@ struct sway_view { | |||
68 | bool border_left; | 68 | bool border_left; |
69 | bool border_right; | 69 | bool border_right; |
70 | 70 | ||
71 | bool destroying; | ||
72 | |||
71 | list_t *executed_criteria; // struct criteria * | 73 | list_t *executed_criteria; // struct criteria * |
72 | list_t *marks; // char * | 74 | list_t *marks; // char * |
73 | list_t *instructions; // struct sway_transaction_instruction * | ||
74 | |||
75 | // If saved_buffer is set, the main surface of the view will render this | ||
76 | // buffer/texture instead of its own. This is used while waiting for | ||
77 | // transactions to complete. | ||
78 | struct wlr_buffer *saved_buffer; | ||
79 | int saved_surface_width, saved_surface_height; | ||
80 | 75 | ||
81 | struct wlr_texture *marks_focused; | 76 | struct wlr_texture *marks_focused; |
82 | struct wlr_texture *marks_focused_inactive; | 77 | struct wlr_texture *marks_focused_inactive; |
@@ -244,11 +239,16 @@ void view_for_each_surface(struct sway_view *view, | |||
244 | void view_init(struct sway_view *view, enum sway_view_type type, | 239 | void view_init(struct sway_view *view, enum sway_view_type type, |
245 | const struct sway_view_impl *impl); | 240 | const struct sway_view_impl *impl); |
246 | 241 | ||
242 | void view_free(struct sway_view *view); | ||
243 | |||
247 | void view_destroy(struct sway_view *view); | 244 | void view_destroy(struct sway_view *view); |
248 | 245 | ||
249 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); | 246 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); |
250 | 247 | ||
251 | void view_unmap(struct sway_view *view); | 248 | /** |
249 | * Unmap the view and return the surviving parent (after reaping). | ||
250 | */ | ||
251 | struct sway_container *view_unmap(struct sway_view *view); | ||
252 | 252 | ||
253 | void view_update_position(struct sway_view *view, double lx, double ly); | 253 | void view_update_position(struct sway_view *view, double lx, double ly); |
254 | 254 | ||