clutter/actor: Add cloned/decloned signals

This are called when a clone directly attaches to an actor. While not
reliable to know whether a particular actor is cloned or not, one can at
least this way get notified about whether an actor in particular is
cloned.

This can be useful for e.g. the MetaWindowActor, as it's what's most
likely cloned, e.g. for alt-tab views etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3019>
This commit is contained in:
Jonas Ådahl 2023-05-24 14:25:12 +02:00 committed by Marge Bot
parent 150a9e35ad
commit b21294dcac

View File

@ -926,6 +926,8 @@ enum
TRANSITION_STOPPED,
STAGE_VIEWS_CHANGED,
RESOURCE_SCALE_CHANGED,
CLONED,
DECLONED,
LAST_SIGNAL
};
@ -7381,6 +7383,24 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_STRUCT_OFFSET (ClutterActorClass, resource_scale_changed),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/*< private > */
actor_signals[CLONED] =
g_signal_new ("cloned",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_CLONE);
/*< private > */
actor_signals[DECLONED] =
g_signal_new ("decloned",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_CLONE);
}
static void
@ -18517,6 +18537,8 @@ _clutter_actor_attach_clone (ClutterActor *actor,
g_hash_table_add (priv->clones, clone);
clutter_actor_push_in_cloned_branch (actor, 1);
g_signal_emit (actor, actor_signals[CLONED], 0, clone);
}
void
@ -18540,6 +18562,8 @@ _clutter_actor_detach_clone (ClutterActor *actor,
g_hash_table_unref (priv->clones);
priv->clones = NULL;
}
g_signal_emit (actor, actor_signals[DECLONED], 0, clone);
}
/**