[gtk+] revealer: Don't report >0 preferred width...



commit 0c25c5d43d3a299698a54b31107339861e556a2d
Author: Timm Bäder <mail baedert org>
Date:   Fri Feb 19 13:22:02 2016 +0100

    revealer: Don't report >0 preferred width...
    
    ... if the child is concealed and the transition type is set to NONE.
    In this case, both preferred width and preferred height should be 0, but
    we still can't use that to allocate a size for the child, so care about
    the minimum size of the child in gtk_revealer_get_child_allocation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761760

 gtk/gtkrevealer.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index e4d144b..52ebd26 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -339,6 +339,13 @@ gtk_revealer_get_child_allocation (GtkRevealer   *revealer,
           transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
         gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding), 
NULL,
                                                    &child_allocation->width);
+      else if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE)
+        {
+          gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding), 
NULL,
+                                                     &child_allocation->width);
+          gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding), 
NULL,
+                                                     &child_allocation->height);
+        }
       else
         gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding), 
NULL,
                                                    &child_allocation->height);
@@ -873,7 +880,8 @@ set_width_with_paddings (GtkRevealer *revealer,
   natural_width = preferred_natural_width + horizontal_padding;
 
   transition = effective_transition (revealer);
-  if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
+  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
+      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
       transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
     {
       /* Paddings are included in the animation */


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