surface: drop subsurface_commit hook

Move it to the role precommit handler.
This commit is contained in:
Simon Ser 2021-03-25 19:47:22 +01:00
parent 659c4bd133
commit db26319c24

View file

@ -496,30 +496,10 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
}
}
static void subsurface_commit(struct wlr_subsurface *subsurface) {
struct wlr_surface *surface = subsurface->surface;
if (subsurface_is_synchronized(subsurface)) {
if (subsurface->has_cache) {
// We already lock a previous commit. The prevents any future
// commit to be applied before we release the previous commit.
return;
}
subsurface->has_cache = true;
subsurface->cached_seq = wlr_surface_lock_pending(surface);
}
}
static void surface_commit(struct wl_client *client,
struct wl_resource *resource) {
struct wlr_surface *surface = wlr_surface_from_resource(resource);
struct wlr_subsurface *subsurface = wlr_surface_is_subsurface(surface) ?
wlr_subsurface_from_wlr_surface(surface) : NULL;
if (subsurface != NULL) {
subsurface_commit(subsurface);
}
if (!surface_state_finalize(surface, &surface->pending)) {
return;
}
@ -536,6 +516,7 @@ static void surface_commit(struct wl_client *client,
}
surface->pending.seq = next_seq;
struct wlr_subsurface *subsurface;
wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) {
subsurface_parent_commit(subsurface, false);
}
@ -1068,6 +1049,16 @@ static void subsurface_role_precommit(struct wlr_surface *surface) {
return;
}
if (subsurface_is_synchronized(subsurface)) {
if (subsurface->has_cache) {
// We already lock a previous commit. The prevents any future
// commit to be applied before we release the previous commit.
return;
}
subsurface->has_cache = true;
subsurface->cached_seq = wlr_surface_lock_pending(surface);
}
if (surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
surface->pending.buffer_resource == NULL) {
// This is a NULL commit