diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-05-31 01:37:43 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-06-03 16:41:17 +0200 |
commit | fcd0ab8f331a6e74fde113d665d4aed21bccdfc5 (patch) | |
tree | c2f53f827372904f8d7b1356231350652bed8a8d /sway/desktop/transaction.c | |
parent | 613abdda6fa978480067a35c3adc46fb414b0b5c (diff) |
view: Save all buffers associated with view
During the execution of a resize transaction, the buffer associated
with a view's surface is saved and reused until the client acknowledges
the resulting configure event.
However, only one the main buffer of the main surface was stored and
rendered, meaning that subsurfaces disappear during resize.
Iterate over all, store and render buffers from all surfaces in the view
to ensure that correct rendering is preserved.
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r-- | sway/desktop/transaction.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index ccf60514..ef656102 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -210,14 +210,17 @@ static void apply_container_state(struct sway_container *container, struct sway_view *view = container->view; // Damage the old location desktop_damage_whole_container(container); - if (view && view->saved_buffer) { - struct wlr_box box = { - .x = container->current.content_x - view->saved_geometry.x, - .y = container->current.content_y - view->saved_geometry.y, - .width = view->saved_buffer_width, - .height = view->saved_buffer_height, - }; - desktop_damage_box(&box); + if (view && !wl_list_empty(&view->saved_buffers)) { + struct sway_saved_buffer *saved_buf; + wl_list_for_each(saved_buf, &view->saved_buffers, link) { + struct wlr_box box = { + .x = container->current.content_x - view->saved_geometry.x + saved_buf->x, + .y = container->current.content_y - view->saved_geometry.y + saved_buf->y, + .width = saved_buf->width, + .height = saved_buf->height, + }; + desktop_damage_box(&box); + } } // There are separate children lists for each instruction state, the @@ -229,7 +232,7 @@ static void apply_container_state(struct sway_container *container, memcpy(&container->current, state, sizeof(struct sway_container_state)); - if (view && view->saved_buffer) { + if (view && !wl_list_empty(&view->saved_buffers)) { if (!container->node.destroying || container->node.ntxnrefs == 1) { view_remove_saved_buffer(view); } @@ -432,7 +435,7 @@ static void transaction_commit(struct sway_transaction *transaction) { wlr_surface_send_frame_done( node->sway_container->view->surface, &now); } - if (node_is_view(node) && !node->sway_container->view->saved_buffer) { + if (node_is_view(node) && wl_list_empty(&node->sway_container->view->saved_buffers)) { view_save_buffer(node->sway_container->view); memcpy(&node->sway_container->view->saved_geometry, &node->sway_container->view->geometry, |