diff options
author | Michel Dänzer <mdaenzer@redhat.com> | 2022-11-01 16:43:03 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2022-12-01 12:41:32 +0100 |
commit | 9ed6a3dffb75676dca31ec6d9767ac5caaab9539 (patch) | |
tree | 4776393f321fa382560725874f153cc30db8dcdb | |
parent | 79dc41499df7b149e3735a2810d7f07a1c64009e (diff) | |
download | mutter-9ed6a3dffb75676dca31ec6d9767ac5caaab9539.tar.gz |
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>
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 20 | ||||
-rw-r--r-- | src/wayland/meta-wayland-surface.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 31ffff1c5..7beb0ab60 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -115,6 +115,11 @@ 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, @@ -1953,6 +1961,18 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *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) { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 072d7f8eb..307038a2c 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -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, |