diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-06 22:57:34 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-09 10:11:25 +1000 |
commit | bb66e6d578fdc68fb33d0fde921390d74f20bb31 (patch) | |
tree | 99d3763eee97acb870c16a762c0ee40af787c295 /sway/desktop/transaction.c | |
parent | Make main properties be the pending state (diff) | |
download | sway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.tar.gz sway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.tar.zst sway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.zip |
Refactor everything that needs to arrange windows
* The arrange_foo functions are now replaced with arrange_and_commit, or
with manually created transactions and arrange_windows x2.
* The arrange functions are now only called from the highest level
functions rather than from both high level and low level functions.
* Due to the previous point, view_set_fullscreen_raw and
view_set_fullscreen are both merged into one function again.
* Floating and fullscreen are now working with transactions.
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r-- | sway/desktop/transaction.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 313e707b..ee9883e2 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -17,6 +17,13 @@ | |||
17 | */ | 17 | */ |
18 | #define TIMEOUT_MS 200 | 18 | #define TIMEOUT_MS 200 |
19 | 19 | ||
20 | struct sway_transaction { | ||
21 | struct wl_event_source *timer; | ||
22 | list_t *instructions; // struct sway_transaction_instruction * | ||
23 | list_t *damage; // struct wlr_box * | ||
24 | size_t num_waiting; | ||
25 | }; | ||
26 | |||
20 | struct sway_transaction_instruction { | 27 | struct sway_transaction_instruction { |
21 | struct sway_transaction *transaction; | 28 | struct sway_transaction *transaction; |
22 | struct sway_container *container; | 29 | struct sway_container *container; |
@@ -162,16 +169,18 @@ void transaction_commit(struct sway_transaction *transaction) { | |||
162 | for (int i = 0; i < transaction->instructions->length; ++i) { | 169 | for (int i = 0; i < transaction->instructions->length; ++i) { |
163 | struct sway_transaction_instruction *instruction = | 170 | struct sway_transaction_instruction *instruction = |
164 | transaction->instructions->items[i]; | 171 | transaction->instructions->items[i]; |
165 | if (instruction->container->type == C_VIEW) { | 172 | struct sway_container *con = instruction->container; |
166 | struct sway_view *view = instruction->container->sway_view; | 173 | if (con->type == C_VIEW && |
167 | instruction->serial = view_configure(view, | 174 | (con->current.view_width != instruction->state.view_width || |
175 | con->current.view_height != instruction->state.view_height)) { | ||
176 | instruction->serial = view_configure(con->sway_view, | ||
168 | instruction->state.view_x, | 177 | instruction->state.view_x, |
169 | instruction->state.view_y, | 178 | instruction->state.view_y, |
170 | instruction->state.view_width, | 179 | instruction->state.view_width, |
171 | instruction->state.view_height); | 180 | instruction->state.view_height); |
172 | if (instruction->serial) { | 181 | if (instruction->serial) { |
173 | save_view_texture(view); | 182 | save_view_texture(con->sway_view); |
174 | list_add(view->instructions, instruction); | 183 | list_add(con->sway_view->instructions, instruction); |
175 | ++transaction->num_waiting; | 184 | ++transaction->num_waiting; |
176 | } | 185 | } |
177 | } | 186 | } |