wayland/surface: Add signal for when the actor changes

This can happen on a xdg-toplevel that is remapped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3219>
This commit is contained in:
Jonas Ådahl 2023-08-28 16:14:17 +02:00
parent 170ba63dbf
commit 34b60757c2
3 changed files with 18 additions and 0 deletions

View File

@ -447,6 +447,8 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
G_CALLBACK (on_actor_destroyed), G_CALLBACK (on_actor_destroyed),
actor_surface); actor_surface);
meta_wayland_surface_notify_actor_changed (surface);
g_signal_connect_swapped (priv->actor, "notify::allocation", g_signal_connect_swapped (priv->actor, "notify::allocation",
G_CALLBACK (meta_wayland_surface_notify_geometry_changed), G_CALLBACK (meta_wayland_surface_notify_geometry_changed),
surface); surface);

View File

@ -109,6 +109,7 @@ enum
SURFACE_SHORTCUTS_RESTORED, SURFACE_SHORTCUTS_RESTORED,
SURFACE_GEOMETRY_CHANGED, SURFACE_GEOMETRY_CHANGED,
SURFACE_PRE_STATE_APPLIED, SURFACE_PRE_STATE_APPLIED,
SURFACE_ACTOR_CHANGED,
N_SURFACE_SIGNALS N_SURFACE_SIGNALS
}; };
@ -1851,6 +1852,13 @@ meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
0, NULL, NULL, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
surface_signals[SURFACE_ACTOR_CHANGED] =
g_signal_new ("actor-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
} }
static void static void
@ -2435,3 +2443,9 @@ meta_wayland_surface_notify_highest_scale_monitor (MetaWaylandSurface *surface)
output_state_handle_highest_scale_monitor (surface); output_state_handle_highest_scale_monitor (surface);
protocol_state_handle_highest_scale_monitor (surface); protocol_state_handle_highest_scale_monitor (surface);
} }
void
meta_wayland_surface_notify_actor_changed (MetaWaylandSurface *surface)
{
g_signal_emit (surface, surface_signals[SURFACE_ACTOR_CHANGED], 0);
}

View File

@ -419,6 +419,8 @@ MetaWaylandCompositor * meta_wayland_surface_get_compositor (MetaWaylandSurface
void meta_wayland_surface_notify_highest_scale_monitor (MetaWaylandSurface *surface); void meta_wayland_surface_notify_highest_scale_monitor (MetaWaylandSurface *surface);
void meta_wayland_surface_notify_actor_changed (MetaWaylandSurface *surface);
static inline MetaWaylandSurfaceState * static inline MetaWaylandSurfaceState *
meta_wayland_surface_state_new (void) meta_wayland_surface_state_new (void)
{ {