diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index cdf42222..a9859d7b 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -124,10 +124,9 @@ struct wlr_surface { /** * `current` contains the current, committed surface state. `pending` * accumulates state changes from the client between commits and shouldn't - * be accessed by the compositor directly. `previous` contains the state of - * the previous commit. + * be accessed by the compositor directly. */ - struct wlr_surface_state current, pending, previous; + struct wlr_surface_state current, pending; struct wl_list cached; // wlr_surface_state.cached_link @@ -150,9 +149,18 @@ struct wlr_surface { struct wl_list current_outputs; // wlr_surface_output::link + void *data; + + // private state + struct wl_listener renderer_destroy; - void *data; + struct { + int32_t scale; + enum wl_output_transform transform; + int width, height; + int buffer_width, buffer_height; + } previous; }; struct wlr_subsurface_state { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index e9979bb1..2ac70921 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -444,7 +444,13 @@ static void surface_commit_state(struct wlr_surface *surface, surface->sy += next->dy; surface_update_damage(&surface->buffer_damage, &surface->current, next); - surface_state_copy(&surface->previous, &surface->current); + surface->previous.scale = surface->current.scale; + surface->previous.transform = surface->current.transform; + surface->previous.width = surface->current.width; + surface->previous.height = surface->current.height; + surface->previous.buffer_width = surface->current.buffer_width; + surface->previous.buffer_height = surface->current.buffer_height; + surface_state_move(&surface->current, next); if (invalid_buffer) { @@ -726,7 +732,6 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) { wl_list_remove(&surface->renderer_destroy.link); surface_state_finish(&surface->pending); surface_state_finish(&surface->current); - surface_state_finish(&surface->previous); pixman_region32_fini(&surface->buffer_damage); pixman_region32_fini(&surface->opaque_region); pixman_region32_fini(&surface->input_region); @@ -766,7 +771,6 @@ struct wlr_surface *surface_create(struct wl_client *client, surface_state_init(&surface->current); surface_state_init(&surface->pending); - surface_state_init(&surface->previous); surface->pending.seq = 1; wl_signal_init(&surface->events.commit);