diff options
-rw-r--r-- | include/sway/desktop/transaction.h | 7 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 42 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 5 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 5 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 5 | ||||
-rw-r--r-- | sway/tree/arrange.c | 9 | ||||
-rw-r--r-- | sway/tree/view.c | 6 |
7 files changed, 24 insertions, 55 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index b1da86f1..fcfed297 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -31,13 +31,6 @@ void transaction_add_container(struct sway_transaction *transaction, | |||
31 | struct sway_container *container); | 31 | struct sway_container *container); |
32 | 32 | ||
33 | /** | 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. | 34 | * Submit a transaction to the client views for configuration. |
42 | */ | 35 | */ |
43 | void transaction_commit(struct sway_transaction *transaction); | 36 | void transaction_commit(struct sway_transaction *transaction); |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 98cde889..c29b6661 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -30,7 +30,6 @@ | |||
30 | struct sway_transaction { | 30 | struct sway_transaction { |
31 | struct wl_event_source *timer; | 31 | struct wl_event_source *timer; |
32 | list_t *instructions; // struct sway_transaction_instruction * | 32 | list_t *instructions; // struct sway_transaction_instruction * |
33 | list_t *damage; // struct wlr_box * | ||
34 | size_t num_waiting; | 33 | size_t num_waiting; |
35 | size_t num_configures; | 34 | size_t num_configures; |
36 | struct sway_transaction *next; | 35 | struct sway_transaction *next; |
@@ -51,7 +50,6 @@ struct sway_transaction *transaction_create() { | |||
51 | struct sway_transaction *transaction = | 50 | struct sway_transaction *transaction = |
52 | calloc(1, sizeof(struct sway_transaction)); | 51 | calloc(1, sizeof(struct sway_transaction)); |
53 | transaction->instructions = create_list(); | 52 | transaction->instructions = create_list(); |
54 | transaction->damage = create_list(); | ||
55 | if (server.debug_txn_timings) { | 53 | if (server.debug_txn_timings) { |
56 | clock_gettime(CLOCK_MONOTONIC, &transaction->create_time); | 54 | clock_gettime(CLOCK_MONOTONIC, &transaction->create_time); |
57 | } | 55 | } |
@@ -97,10 +95,6 @@ static void transaction_destroy(struct sway_transaction *transaction) { | |||
97 | } | 95 | } |
98 | list_free(transaction->instructions); | 96 | list_free(transaction->instructions); |
99 | 97 | ||
100 | // Free damage | ||
101 | list_foreach(transaction->damage, free); | ||
102 | list_free(transaction->damage); | ||
103 | |||
104 | if (transaction->timer) { | 98 | if (transaction->timer) { |
105 | wl_event_source_remove(transaction->timer); | 99 | wl_event_source_remove(transaction->timer); |
106 | } | 100 | } |
@@ -174,13 +168,6 @@ void transaction_add_container(struct sway_transaction *transaction, | |||
174 | list_add(transaction->instructions, instruction); | 168 | list_add(transaction->instructions, instruction); |
175 | } | 169 | } |
176 | 170 | ||
177 | void transaction_add_damage(struct sway_transaction *transaction, | ||
178 | struct wlr_box *_box) { | ||
179 | struct wlr_box *box = calloc(1, sizeof(struct wlr_box)); | ||
180 | memcpy(box, _box, sizeof(struct wlr_box)); | ||
181 | list_add(transaction->damage, box); | ||
182 | } | ||
183 | |||
184 | /** | 171 | /** |
185 | * Apply a transaction to the "current" state of the tree. | 172 | * Apply a transaction to the "current" state of the tree. |
186 | */ | 173 | */ |
@@ -200,12 +187,32 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
200 | "%.1fms total (%.1f frames if 60Hz)", transaction, | 187 | "%.1fms total (%.1f frames if 60Hz)", transaction, |
201 | ms_arranging, ms_waiting, ms_total, ms_total / (1000 / 60)); | 188 | ms_arranging, ms_waiting, ms_total, ms_total / (1000 / 60)); |
202 | } | 189 | } |
190 | |||
203 | // Apply the instruction state to the container's current state | 191 | // Apply the instruction state to the container's current state |
204 | for (int i = 0; i < transaction->instructions->length; ++i) { | 192 | for (int i = 0; i < transaction->instructions->length; ++i) { |
205 | struct sway_transaction_instruction *instruction = | 193 | struct sway_transaction_instruction *instruction = |
206 | transaction->instructions->items[i]; | 194 | transaction->instructions->items[i]; |
207 | struct sway_container *container = instruction->container; | 195 | struct sway_container *container = instruction->container; |
208 | 196 | ||
197 | // Damage the old and new locations | ||
198 | struct wlr_box old_box = { | ||
199 | .x = container->current.swayc_x, | ||
200 | .y = container->current.swayc_y, | ||
201 | .width = container->current.swayc_width, | ||
202 | .height = container->current.swayc_height, | ||
203 | }; | ||
204 | struct wlr_box new_box = { | ||
205 | .x = instruction->state.swayc_x, | ||
206 | .y = instruction->state.swayc_y, | ||
207 | .width = instruction->state.swayc_width, | ||
208 | .height = instruction->state.swayc_height, | ||
209 | }; | ||
210 | for (int j = 0; j < root_container.children->length; ++j) { | ||
211 | struct sway_container *output = root_container.children->items[j]; | ||
212 | output_damage_box(output->sway_output, &old_box); | ||
213 | output_damage_box(output->sway_output, &new_box); | ||
214 | } | ||
215 | |||
209 | // There are separate children lists for each instruction state, the | 216 | // There are separate children lists for each instruction state, the |
210 | // container's current state and the container's pending state | 217 | // container's current state and the container's pending state |
211 | // (ie. con->children). The list itself needs to be freed here. | 218 | // (ie. con->children). The list itself needs to be freed here. |
@@ -216,15 +223,6 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
216 | memcpy(&container->current, &instruction->state, | 223 | memcpy(&container->current, &instruction->state, |
217 | sizeof(struct sway_container_state)); | 224 | sizeof(struct sway_container_state)); |
218 | } | 225 | } |
219 | |||
220 | // Apply damage | ||
221 | for (int i = 0; i < transaction->damage->length; ++i) { | ||
222 | struct wlr_box *box = transaction->damage->items[i]; | ||
223 | for (int j = 0; j < root_container.children->length; ++j) { | ||
224 | struct sway_container *output = root_container.children->items[j]; | ||
225 | output_damage_box(output->sway_output, box); | ||
226 | } | ||
227 | } | ||
228 | } | 226 | } |
229 | 227 | ||
230 | static void transaction_progress_queue() { | 228 | static void transaction_progress_queue() { |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 484afd0c..b6fa9525 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -272,10 +272,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
272 | view_set_fullscreen(view, e->fullscreen); | 272 | view_set_fullscreen(view, e->fullscreen); |
273 | 273 | ||
274 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 274 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
275 | struct sway_transaction *transaction = transaction_create(); | 275 | arrange_and_commit(ws); |
276 | arrange_windows(ws, transaction); | ||
277 | transaction_add_damage(transaction, container_get_box(ws->parent)); | ||
278 | transaction_commit(transaction); | ||
279 | } | 276 | } |
280 | 277 | ||
281 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { | 278 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index da2eda7a..6042a806 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -267,10 +267,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
267 | view_set_fullscreen(view, e->fullscreen); | 267 | view_set_fullscreen(view, e->fullscreen); |
268 | 268 | ||
269 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 269 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
270 | struct sway_transaction *transaction = transaction_create(); | 270 | arrange_and_commit(ws); |
271 | arrange_windows(ws, transaction); | ||
272 | transaction_add_damage(transaction, container_get_box(ws->parent)); | ||
273 | transaction_commit(transaction); | ||
274 | } | 271 | } |
275 | 272 | ||
276 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 273 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 720ea2fd..1d5dab70 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -342,10 +342,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
342 | view_set_fullscreen(view, xsurface->fullscreen); | 342 | view_set_fullscreen(view, xsurface->fullscreen); |
343 | 343 | ||
344 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 344 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
345 | struct sway_transaction *transaction = transaction_create(); | 345 | arrange_and_commit(ws); |
346 | arrange_windows(ws, transaction); | ||
347 | transaction_add_damage(transaction, container_get_box(ws->parent)); | ||
348 | transaction_commit(transaction); | ||
349 | } | 346 | } |
350 | 347 | ||
351 | static void handle_set_title(struct wl_listener *listener, void *data) { | 348 | static void handle_set_title(struct wl_listener *listener, void *data) { |
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index cb3f8ba2..582b2891 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c | |||
@@ -304,15 +304,6 @@ void arrange_windows(struct sway_container *container, | |||
304 | case C_TYPES: | 304 | case C_TYPES: |
305 | break; | 305 | break; |
306 | } | 306 | } |
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); | 307 | add_deleted_containers(transaction); |
317 | } | 308 | } |
318 | 309 | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index a616af03..68d2a029 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -550,11 +550,7 @@ void view_unmap(struct sway_view *view) { | |||
550 | ws->sway_workspace->fullscreen = NULL; | 550 | ws->sway_workspace->fullscreen = NULL; |
551 | container_destroy(view->swayc); | 551 | container_destroy(view->swayc); |
552 | 552 | ||
553 | struct sway_container *output = ws->parent; | 553 | arrange_and_commit(ws->parent); |
554 | struct sway_transaction *transaction = transaction_create(); | ||
555 | arrange_windows(output, transaction); | ||
556 | transaction_add_damage(transaction, container_get_box(output)); | ||
557 | transaction_commit(transaction); | ||
558 | } else { | 554 | } else { |
559 | struct sway_container *parent = container_destroy(view->swayc); | 555 | struct sway_container *parent = container_destroy(view->swayc); |
560 | arrange_and_commit(parent); | 556 | arrange_and_commit(parent); |