mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-26 19:39:49 +01:00
surface: kill wlr_surface.previous
This wlr_surface_state field was a special case because we don't want to save the whole current state: for instance, the wlr_buffer must not be saved or else wouldn't get released soon enough. Let's just inline the state fields we need instead.
This commit is contained in:
parent
111d4eafd7
commit
3f9e4f7a44
2 changed files with 19 additions and 7 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue