diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index d26f8e2ec..63a8c16ce 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -484,6 +484,8 @@ void wlr_surface_set_preferred_buffer_scale(struct wlr_surface *surface, void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface, enum wl_output_transform transform); +struct wlr_surface_synced; + /** * Implementation for struct wlr_surface_synced. * @@ -500,6 +502,11 @@ struct wlr_surface_synced_impl { void (*finish_state)(void *state); // Move a state. If NULL, memcpy() is used. void (*move_state)(void *dst, void *src); + + // Called when the state is committed. If NULL, this is a no-op. + // If an object is a surface role object which has state synchronized with + // the surface state, the role commit hook should be preferred over this. + void (*commit)(struct wlr_surface_synced *synced); }; /** diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index afa35ec99..7bc8ea473 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -552,6 +552,13 @@ static void surface_commit_state(struct wlr_surface *surface, surface->pending.seq++; } + struct wlr_surface_synced *synced; + wl_list_for_each(synced, &surface->synced, link) { + if (synced->impl->commit) { + synced->impl->commit(synced); + } + } + if (surface->role != NULL && surface->role->commit != NULL && (surface->role_resource != NULL || surface->role->no_object)) { surface->role->commit(surface);