[gtk+/wip/baedert/drawing: 230/241] revealer: Request child size for NONE transition type



commit 0d8bc6fd6da7fbaebcafa07eccaaad4c9556f4f1
Author: Timm Bäder <mail baedert org>
Date:   Sun Jun 4 18:33:08 2017 +0200

    revealer: Request child size for NONE transition type
    
    Previously, we would request a size of 0×0 when the transition type was
    NONE and the child un-revealed, making the revealer in this case a
    gtk_widget_set_visible replacement. Instead, to the exact same thing we
    do in the CROSSFADE case and request the child size instead. This also
    keeps the revealer from under allocating the child when the transition
    type is set to NONE.

 gtk/gtkrevealer.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 32b87cd..2dbe9c4 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -385,10 +385,17 @@ gtk_revealer_set_position (GtkRevealer *revealer,
   child = gtk_bin_get_child (GTK_BIN (revealer));
   if (child != NULL &&
       new_visible != gtk_widget_get_child_visible (child))
-    gtk_widget_set_child_visible (child, new_visible);
+    {
+      gtk_widget_set_child_visible (child, new_visible);
+      gtk_widget_queue_resize (GTK_WIDGET (revealer));
+    }
 
   transition = effective_transition (revealer);
-  if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
+  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE)
+    {
+      gtk_widget_queue_draw (GTK_WIDGET (revealer));
+    }
+  else if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
     {
       gtk_widget_set_opacity (GTK_WIDGET (revealer), priv->current_pos);
       gtk_widget_queue_draw (GTK_WIDGET (revealer));
@@ -550,8 +557,7 @@ set_height (GtkRevealer *revealer,
   GtkRevealerTransitionType transition;
 
   transition = effective_transition (revealer);
-  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
-      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
+  if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
       transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
     {
       *minimum_height = round (*minimum_height * priv->current_pos);
@@ -568,8 +574,7 @@ set_width (GtkRevealer *revealer,
   GtkRevealerTransitionType transition;
 
   transition = effective_transition (revealer);
-  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
-      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
+  if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
       transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
     {
       *minimum_width = round (*minimum_width * priv->current_pos);


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