diff options
Diffstat (limited to 'sway/tree/arrange.c')
-rw-r--r-- | sway/tree/arrange.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index ac99c5df..cb3f8ba2 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c | |||
@@ -144,6 +144,19 @@ static void apply_tabbed_or_stacked_layout(struct sway_container *parent) { | |||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | /** | ||
148 | * If a container has been deleted from the pending tree state, we must add it | ||
149 | * to the transaction so it can be freed afterwards. To do this, we iterate the | ||
150 | * server's destroying_containers list and add all of them. We may add more than | ||
151 | * what we need to, but this is easy and has no negative consequences. | ||
152 | */ | ||
153 | static void add_deleted_containers(struct sway_transaction *transaction) { | ||
154 | for (int i = 0; i < server.destroying_containers->length; ++i) { | ||
155 | struct sway_container *child = server.destroying_containers->items[i]; | ||
156 | transaction_add_container(transaction, child); | ||
157 | } | ||
158 | } | ||
159 | |||
147 | static void arrange_children_of(struct sway_container *parent, | 160 | static void arrange_children_of(struct sway_container *parent, |
148 | struct sway_transaction *transaction); | 161 | struct sway_transaction *transaction); |
149 | 162 | ||
@@ -158,6 +171,7 @@ static void arrange_floating(struct sway_container *floating, | |||
158 | } | 171 | } |
159 | transaction_add_container(transaction, floater); | 172 | transaction_add_container(transaction, floater); |
160 | } | 173 | } |
174 | transaction_add_container(transaction, floating); | ||
161 | } | 175 | } |
162 | 176 | ||
163 | static void arrange_children_of(struct sway_container *parent, | 177 | static void arrange_children_of(struct sway_container *parent, |
@@ -290,7 +304,16 @@ void arrange_windows(struct sway_container *container, | |||
290 | case C_TYPES: | 304 | case C_TYPES: |
291 | break; | 305 | break; |
292 | } | 306 | } |
293 | transaction_add_damage(transaction, container_get_box(container)); | 307 | // Add damage for whatever container arrange_windows() was called with, |
308 | // unless it was called with the special floating container, in which case | ||
309 | // we'll damage the entire output. | ||
310 | if (container->type == C_CONTAINER && container->layout == L_FLOATING) { | ||
311 | struct sway_container *output = container_parent(container, C_OUTPUT); | ||
312 | transaction_add_damage(transaction, container_get_box(output)); | ||
313 | } else { | ||
314 | transaction_add_damage(transaction, container_get_box(container)); | ||
315 | } | ||
316 | add_deleted_containers(transaction); | ||
294 | } | 317 | } |
295 | 318 | ||
296 | void arrange_and_commit(struct sway_container *container) { | 319 | void arrange_and_commit(struct sway_container *container) { |