clutter/actor-meta: Add a new 'set_enabled' vfunc
Various subclasses of ClutterActorMeta need to reacto to being disabled. Right now, however, the only way to do that is by overriding GObject's 'notify' vfunc, and doing a string comparison against "enabled". Add a new vfunc to ClutterActorMeta in order to replace this bad practice. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1187
This commit is contained in:
parent
5b30a52bbd
commit
ac52631e8a
@ -105,6 +105,18 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||
meta);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
{
|
||||
g_warn_if_fail (!meta->priv->actor ||
|
||||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||
|
||||
meta->priv->is_enabled = is_enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_meta_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
@ -176,6 +188,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->set_actor = clutter_actor_meta_real_set_actor;
|
||||
klass->set_enabled = clutter_actor_meta_real_set_enabled;
|
||||
|
||||
/**
|
||||
* ClutterActorMeta:actor:
|
||||
@ -297,17 +310,12 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||
|
||||
g_warn_if_fail (!meta->priv->actor ||
|
||||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||
|
||||
is_enabled = !!is_enabled;
|
||||
|
||||
if (meta->priv->is_enabled == is_enabled)
|
||||
return;
|
||||
|
||||
meta->priv->is_enabled = is_enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,6 +87,9 @@ struct _ClutterActorMetaClass
|
||||
void (* set_actor) (ClutterActorMeta *meta,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* set_enabled) (ClutterActorMeta *meta,
|
||||
gboolean is_enabled);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_meta1) (void);
|
||||
void (* _clutter_meta2) (void);
|
||||
@ -94,7 +97,6 @@ struct _ClutterActorMetaClass
|
||||
void (* _clutter_meta4) (void);
|
||||
void (* _clutter_meta5) (void);
|
||||
void (* _clutter_meta6) (void);
|
||||
void (* _clutter_meta7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
Loading…
Reference in New Issue
Block a user