compositor: add wlr_surface.events.precommit

This commit is contained in:
Simon Ser 2022-11-29 17:35:22 +01:00
parent bb0fd29252
commit 512deebd82
2 changed files with 4 additions and 0 deletions

View file

@ -140,6 +140,7 @@ struct wlr_surface {
struct { struct {
struct wl_signal client_commit; struct wl_signal client_commit;
struct wl_signal precommit; // const struct wlr_surface_state *
struct wl_signal commit; struct wl_signal commit;
struct wl_signal new_subsurface; struct wl_signal new_subsurface;
struct wl_signal destroy; struct wl_signal destroy;

View file

@ -438,6 +438,8 @@ static void surface_commit_state(struct wlr_surface *surface,
surface->role->precommit(surface, next); surface->role->precommit(surface, next);
} }
wl_signal_emit_mutable(&surface->events.precommit, next);
bool invalid_buffer = next->committed & WLR_SURFACE_STATE_BUFFER; bool invalid_buffer = next->committed & WLR_SURFACE_STATE_BUFFER;
surface_update_damage(&surface->buffer_damage, &surface->current, next); surface_update_damage(&surface->buffer_damage, &surface->current, next);
@ -692,6 +694,7 @@ static struct wlr_surface *surface_create(struct wl_client *client,
surface->pending.seq = 1; surface->pending.seq = 1;
wl_signal_init(&surface->events.client_commit); wl_signal_init(&surface->events.client_commit);
wl_signal_init(&surface->events.precommit);
wl_signal_init(&surface->events.commit); wl_signal_init(&surface->events.commit);
wl_signal_init(&surface->events.destroy); wl_signal_init(&surface->events.destroy);
wl_signal_init(&surface->events.new_subsurface); wl_signal_init(&surface->events.new_subsurface);