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.
This commit is contained in:
Kenny Levinsen 2020-05-31 01:37:43 +02:00 committed by Simon Ser
parent 613abdda6f
commit fcd0ab8f33
5 changed files with 86 additions and 54 deletions

View file

@ -55,6 +55,13 @@ struct sway_view_impl {
void (*destroy)(struct sway_view *view);
};
struct sway_saved_buffer {
struct wlr_client_buffer *buffer;
int x, y;
int width, height;
struct wl_list link; // sway_view::saved_buffers
};
struct sway_view {
enum sway_view_type type;
const struct sway_view_impl *impl;
@ -65,9 +72,6 @@ struct sway_view {
pid_t pid;
double saved_x, saved_y;
int saved_width, saved_height;
// The size the view would want to be if it weren't tiled.
// Used when changing a view from tiled to floating.
int natural_width, natural_height;
@ -80,8 +84,7 @@ struct sway_view {
bool allow_request_urgent;
struct wl_event_source *urgent_timer;
struct wlr_client_buffer *saved_buffer;
int saved_buffer_width, saved_buffer_height;
struct wl_list saved_buffers; // sway_saved_buffer::link
// The geometry for whatever the client is committing, regardless of
// transaction state. Updated on every commit.