This is an automated email from the git hooks/post-receive script. n o m a d p u s h e d a c o m m i t t o b r a n c h m a s t e r in repository apps/xfdashboard.
commit 7cd6b31daf608dba73d06a713e3606069dc94640 Author: Stephan Haller <no...@froevel.de> Date: Tue Mar 24 06:58:47 2020 +0100 Adding support to animate actor when it was shown for the first time --- data/themes/xfdashboard/animations.xml | 8 +++ libxfdashboard/actor.c | 89 +++++++++++++++++++++++++++++----- libxfdashboard/theme-animation.c | 8 ++- 3 files changed, 93 insertions(+), 12 deletions(-) diff --git a/data/themes/xfdashboard/animations.xml b/data/themes/xfdashboard/animations.xml index 049b5b3..d049f70 100644 --- a/data/themes/xfdashboard/animations.xml +++ b/data/themes/xfdashboard/animations.xml @@ -14,4 +14,12 @@ </apply> </timeline> </trigger> + + <trigger id="application-startup" sender="XfdashboardStageInterface" signal="created"> + <timeline delay="0" duration="500" mode="linear"> + <apply> + <property name="opacity" from="0" to="255" /> + </apply> + </timeline> + </trigger> </animations> diff --git a/libxfdashboard/actor.c b/libxfdashboard/actor.c index 43a97fe..bf70284 100644 --- a/libxfdashboard/actor.c +++ b/libxfdashboard/actor.c @@ -50,17 +50,22 @@ void xfdashboard_actor_base_class_finalize(XfdashboardActorClass *klass); struct _XfdashboardActorPrivate { /* Properties related */ - gboolean canFocus; - gchar *effects; + gboolean canFocus; + gchar *effects; - gchar *styleClasses; - gchar *stylePseudoClasses; + gchar *styleClasses; + gchar *stylePseudoClasses; /* Instance related */ - GHashTable *lastThemeStyleSet; - gboolean forceStyleRevalidation; - gboolean isFirstParent; - GSList *animations; + GHashTable *lastThemeStyleSet; + gboolean forceStyleRevalidation; + + gboolean isFirstParent; + + gboolean firstTimeMapped; + XfdashboardAnimation *firstTimeMappedAnimation; + + GSList *animations; }; /* Properties */ @@ -181,19 +186,73 @@ static gboolean _xfdashboard_actor_hashtable_is_duplicate_key(gpointer inKey, return(g_hash_table_lookup_extended(otherHashtable, inKey, NULL, NULL)); } +/* 'created' animation has completed */ +static void _xfdashboard_actor_first_time_created_animation_done(XfdashboardAnimation *inAnimation, + gpointer inUserData) +{ + XfdashboardActor *self; + XfdashboardActorPrivate *priv; + + g_return_if_fail(XFDASHBOARD_IS_ANIMATION(inAnimation)); + g_return_if_fail(XFDASHBOARD_IS_ACTOR(inUserData)); + + self=XFDASHBOARD_ACTOR(inUserData); + priv=self->priv; + + /* Mark completed first-time animation as removed */ + priv->firstTimeMappedAnimation=NULL; +} + /* Actor was mapped or unmapped */ static void _xfdashboard_actor_on_mapped_changed(GObject *inObject, GParamSpec *inSpec, gpointer inUserData) { - XfdashboardActor *self; + XfdashboardActor *self; + XfdashboardActorPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_ACTOR(inObject)); self=XFDASHBOARD_ACTOR(inObject); + priv=self->priv; - /* Invalide styling to get it recomputed */ - xfdashboard_stylable_invalidate(XFDASHBOARD_STYLABLE(self)); + /* If actor was mapped, invalidate styling and check for first-time animation */ + if(clutter_actor_is_mapped(CLUTTER_ACTOR(self))) + { + /* Invalide styling to get it recomputed if actor was mapped */ + xfdashboard_stylable_invalidate(XFDASHBOARD_STYLABLE(self)); + + /* If actor was mapped for the first time then check if an animation + * should be created and run. + */ + if(!priv->firstTimeMapped) + { + g_assert(!priv->firstTimeMappedAnimation); + + /* Lookup animation for create signal and if any found (i.e. has an ID), + * run it. + */ + priv->firstTimeMappedAnimation=xfdashboard_animation_new(XFDASHBOARD_ACTOR(self), "created"); + if(!xfdashboard_animation_get_id(priv->firstTimeMappedAnimation)) + { + /* Empty or invalid animation, so release allocated resources and return */ + g_object_unref(priv->firstTimeMappedAnimation); + priv->firstTimeMappedAnimation=NULL; + + return; + } + + /* Start animation */ + xfdashboard_animation_run(priv->firstTimeMappedAnimation, _xfdashboard_actor_first_time_created_animation_done, self); + XFDASHBOARD_DEBUG(self, ANIMATION, + "Found and starting animation '%s' for created signal at actor %s", + xfdashboard_animation_get_id(priv->firstTimeMappedAnimation), + G_OBJECT_TYPE_NAME(self)); + + /* Set flag that first-time visible happened at this actor */ + priv->firstTimeMapped=TRUE; + } + } } /* Actor was (re)named */ @@ -1143,6 +1202,12 @@ static void _xfdashboard_actor_dispose(GObject *inObject) priv->lastThemeStyleSet=NULL; } + if(priv->firstTimeMappedAnimation) + { + g_object_unref(priv->firstTimeMappedAnimation); + priv->firstTimeMappedAnimation=NULL; + } + if(priv->animations) { g_slist_free_full(priv->animations, (GDestroyNotify)_xfdashboard_actor_animation_entry_free); @@ -1306,6 +1371,8 @@ void xfdashboard_actor_init(XfdashboardActor *self) priv->stylePseudoClasses=NULL; priv->lastThemeStyleSet=NULL; priv->isFirstParent=TRUE; + priv->firstTimeMapped=FALSE; + priv->firstTimeMappedAnimation=NULL; priv->animations=NULL; /* Connect signals */ diff --git a/libxfdashboard/theme-animation.c b/libxfdashboard/theme-animation.c index 4203d8d..01d1bd4 100644 --- a/libxfdashboard/theme-animation.c +++ b/libxfdashboard/theme-animation.c @@ -1857,9 +1857,15 @@ XfdashboardAnimation* xfdashboard_theme_animation_create(XfdashboardThemeAnimati /* Check if actor has property to animate */ propertySpec=g_object_class_find_property(G_OBJECT_GET_CLASS(actor), propertyTargetSpec->name); + if(!propertySpec && CLUTTER_IS_ANIMATABLE(actor)) + { + propertySpec=clutter_animatable_find_property(CLUTTER_ANIMATABLE(actor), propertyTargetSpec->name); + } + if(!propertySpec) { - g_warning(_("Cannot create animation for non-existing property '%s' at actor of type '%s'"), + g_warning(_("Cannot create animation '%s' for non-existing property '%s' at actor of type '%s'"), + spec->id, propertyTargetSpec->name, G_OBJECT_TYPE_NAME(actor)); -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits