wayland/actor-surface: Add actor clear helper

No functional changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/825
This commit is contained in:
Jonas Ådahl 2019-10-03 21:41:48 +02:00 committed by Georges Basile Stavracas Neto
parent 8d6d2d07dd
commit 092b3edb51

View File

@ -51,20 +51,32 @@ meta_wayland_actor_surface_constructed (GObject *object)
} }
static void static void
meta_wayland_actor_surface_dispose (GObject *object) clear_surface_actor (MetaWaylandActorSurface *actor_surface)
{ {
MetaWaylandActorSurfacePrivate *priv = MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (object)); meta_wayland_actor_surface_get_instance_private (actor_surface);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (actor_surface);
MetaWaylandSurface *surface = MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (object)); meta_wayland_surface_role_get_surface (surface_role);
if (priv->actor)
{
g_signal_handlers_disconnect_by_func (priv->actor, g_signal_handlers_disconnect_by_func (priv->actor,
meta_wayland_surface_notify_geometry_changed, meta_wayland_surface_notify_geometry_changed,
surface); surface);
clutter_actor_set_reactive (CLUTTER_ACTOR (priv->actor), FALSE);
g_clear_object (&priv->actor); g_clear_object (&priv->actor);
}
static void
meta_wayland_actor_surface_dispose (GObject *object)
{
MetaWaylandActorSurface *actor_surface = META_WAYLAND_ACTOR_SURFACE (object);
MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (actor_surface);
if (priv->actor)
{
clutter_actor_set_reactive (CLUTTER_ACTOR (priv->actor), FALSE);
clear_surface_actor (actor_surface);
} }
G_OBJECT_CLASS (meta_wayland_actor_surface_parent_class)->dispose (object); G_OBJECT_CLASS (meta_wayland_actor_surface_parent_class)->dispose (object);
@ -300,13 +312,7 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
MetaWaylandSurface *surface = MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_surface)); meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_surface));
if (priv->actor) clear_surface_actor (actor_surface);
{
g_signal_handlers_disconnect_by_func (priv->actor,
meta_wayland_surface_notify_geometry_changed,
surface);
g_object_unref (priv->actor);
}
priv->actor = g_object_ref_sink (meta_surface_actor_wayland_new (surface)); priv->actor = g_object_ref_sink (meta_surface_actor_wayland_new (surface));