[gtk/wip/carlosg/revealer-fix-interrupted-animations-master] revealer: Fully set the target state if unmapped during animation



commit 0b5abb8807173c8effca619de9c0339fa59d09bb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 19 19:26:04 2018 +0100

    revealer: Fully set the target state if unmapped during animation
    
    If the revealer is told do animate and then unrealize itself, we do
    (correctly) stop the animation, but used to do a shortcut where we
    just set the target state as current.
    
    Other things are dependent on the animation properly finishing though,
    like the contained widget child visibility. This may lead to inconsistent
    state where gtk_revealer_get_child_revealed() returns TRUE but the child
    widget is unmapped, or vice-versa.
    
    Fully finish the animation here, so the child state is coherent the next
    time the revealer is mapped. We can also skip notifying on the property
    since it will be handled by gtk_revealer_set_position().

 gtk/gtkrevealer.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 92a33da868..1bd58b64eb 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -202,10 +202,8 @@ gtk_revealer_unmap (GtkWidget *widget)
 
   /* Finish & stop the animation */
   if (priv->current_pos != priv->target_pos)
-    {
-      priv->current_pos = priv->target_pos;
-      g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_CHILD_REVEALED]);
-    }
+    gtk_revealer_set_position (revealer, priv->target_pos);
+
   if (priv->tick_id != 0)
     {
       gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]