wayland/surface: Add role commit_state callback

Which gets called when pending state is committed for the surface.

This callback may amend the pending transaction or surface state as
needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1880>
This commit is contained in:
Michel Dänzer 2022-11-01 16:43:03 +01:00 committed by Michel Dänzer
parent 79dc41499d
commit 9ed6a3dffb
2 changed files with 23 additions and 0 deletions

View File

@ -114,6 +114,11 @@ guint surface_signals[N_SURFACE_SIGNALS] = { 0 };
static void
meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role);
static void
meta_wayland_surface_role_commit_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandTransaction *transaction,
MetaWaylandSurfaceState *pending);
static void
meta_wayland_surface_role_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
@ -1023,6 +1028,9 @@ meta_wayland_surface_commit (MetaWaylandSurface *surface)
else
transaction = meta_wayland_transaction_new (surface->compositor);
if (surface->role)
meta_wayland_surface_role_commit_state (surface->role, transaction, pending);
meta_wayland_transaction_merge_pending_state (transaction, surface);
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (&surface->protocol_state,
@ -1952,6 +1960,18 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role)
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->assigned (surface_role);
}
static void
meta_wayland_surface_role_commit_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandTransaction *transaction,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurfaceRoleClass *klass;
klass = META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role);
if (klass->commit_state)
klass->commit_state (surface_role, transaction, pending);
}
static void
meta_wayland_surface_role_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)

View File

@ -54,6 +54,9 @@ struct _MetaWaylandSurfaceRoleClass
GObjectClass parent_class;
void (*assigned) (MetaWaylandSurfaceRole *surface_role);
void (*commit_state) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandTransaction *transaction,
MetaWaylandSurfaceState *pending);
void (*pre_apply_state) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
void (*apply_state) (MetaWaylandSurfaceRole *surface_role,