diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcssanimation.c | 13 | ||||
-rw-r--r-- | gtk/gtkcsstransition.c | 10 | ||||
-rw-r--r-- | gtk/gtkstyleanimation.c | 31 | ||||
-rw-r--r-- | gtk/gtkstyleanimationprivate.h | 4 |
4 files changed, 58 insertions, 0 deletions
diff --git a/gtk/gtkcssanimation.c b/gtk/gtkcssanimation.c index 765bb4e750..c0964de2ba 100644 --- a/gtk/gtkcssanimation.c +++ b/gtk/gtkcssanimation.c @@ -143,6 +143,18 @@ gtk_css_animation_is_finished (GtkStyleAnimation *style_animation, return FALSE; } +static gboolean +gtk_css_animation_is_static (GtkStyleAnimation *style_animation, + gint64 at_time_us) +{ + GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation); + double iteration; + + iteration = gtk_css_animation_get_iteration (animation, at_time_us); + + return iteration >= animation->iteration_count; +} + static void gtk_css_animation_finalize (GObject *object) { @@ -165,6 +177,7 @@ _gtk_css_animation_class_init (GtkCssAnimationClass *klass) animation_class->set_values = gtk_css_animation_set_values; animation_class->is_finished = gtk_css_animation_is_finished; + animation_class->is_static = gtk_css_animation_is_static; } static void diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c index ede18b32b7..d1287f2de6 100644 --- a/gtk/gtkcsstransition.c +++ b/gtk/gtkcsstransition.c @@ -68,6 +68,15 @@ gtk_css_transition_is_finished (GtkStyleAnimation *animation, return at_time_us >= transition->end_time; } +static gboolean +gtk_css_transition_is_static (GtkStyleAnimation *animation, + gint64 at_time_us) +{ + GtkCssTransition *transition = GTK_CSS_TRANSITION (animation); + + return at_time_us >= transition->end_time; +} + static void gtk_css_transition_finalize (GObject *object) { @@ -90,6 +99,7 @@ _gtk_css_transition_class_init (GtkCssTransitionClass *klass) animation_class->set_values = gtk_css_transition_set_values; animation_class->is_finished = gtk_css_transition_is_finished; + animation_class->is_static = gtk_css_transition_is_static; } static void diff --git a/gtk/gtkstyleanimation.c b/gtk/gtkstyleanimation.c index aab78bddd7..ac74851c59 100644 --- a/gtk/gtkstyleanimation.c +++ b/gtk/gtkstyleanimation.c @@ -39,11 +39,19 @@ gtk_style_animation_real_is_finished (GtkStyleAnimation *animation, return TRUE; } +static gboolean +gtk_style_animation_real_is_static (GtkStyleAnimation *animation, + gint64 at_time_us) +{ + return FALSE; +} + static void _gtk_style_animation_class_init (GtkStyleAnimationClass *klass) { klass->set_values = gtk_style_animation_real_set_values; klass->is_finished = gtk_style_animation_real_is_finished; + klass->is_static = gtk_style_animation_real_is_static; } static void @@ -80,3 +88,26 @@ _gtk_style_animation_is_finished (GtkStyleAnimation *animation, return klass->is_finished (animation, at_time_us); } +/** + * _gtk_style_animation_is_static: + * @animation: The animation to query + * @at_time_us: The timestamp to query for + * + * Checks if @animation will not change its values anymore after + * @at_time_us. This happens for example when the animation has reached its + * final value or when it has been paused. + * + * Returns: %TRUE if @animation will not change anymore after @at_time_us + **/ +gboolean +_gtk_style_animation_is_static (GtkStyleAnimation *animation, + gint64 at_time_us) +{ + GtkStyleAnimationClass *klass; + + g_return_val_if_fail (GTK_IS_STYLE_ANIMATION (animation), TRUE); + + klass = GTK_STYLE_ANIMATION_GET_CLASS (animation); + + return klass->is_static (animation, at_time_us); +} diff --git a/gtk/gtkstyleanimationprivate.h b/gtk/gtkstyleanimationprivate.h index 5d5d6c602e..b4f2c69595 100644 --- a/gtk/gtkstyleanimationprivate.h +++ b/gtk/gtkstyleanimationprivate.h @@ -46,6 +46,8 @@ struct _GtkStyleAnimationClass gboolean (* is_finished) (GtkStyleAnimation *animation, gint64 at_time_us); + gboolean (* is_static) (GtkStyleAnimation *animation, + gint64 at_time_us); GtkBitmask * (* set_values) (GtkStyleAnimation *animation, GtkBitmask *changed, gint64 for_time_us, @@ -60,6 +62,8 @@ GtkBitmask * _gtk_style_animation_set_values (GtkStyleAnimation GtkCssComputedValues *values) G_GNUC_WARN_UNUSED_RESULT; gboolean _gtk_style_animation_is_finished (GtkStyleAnimation *animation, gint64 at_time_us); +gboolean _gtk_style_animation_is_static (GtkStyleAnimation *animation, + gint64 at_time_us); G_END_DECLS |