[gnome-builder] layout: fix some warnings during size_allocate



commit 525af1e5b4d6a8ca5dd29e3d9cb803dd8b09bf8c
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 16 16:48:12 2016 -0800

    layout: fix some warnings during size_allocate
    
    We still need some more work, to ensure that we always give the child a
    window large enough based on its minimum requisition.

 libide/ide-layout.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-layout.c b/libide/ide-layout.c
index 1698826..c530293 100644
--- a/libide/ide-layout.c
+++ b/libide/ide-layout.c
@@ -219,6 +219,25 @@ ide_layout_destroy_handle_window (IdeLayout       *self,
 }
 
 static void
+ide_layout_child_get_preferred_size (IdeLayoutChild      *child,
+                                     const GtkAllocation *alloc)
+{
+  GtkRequisition min_req = { 0 };
+  GtkRequisition nat_req = { 0 };
+
+  g_assert (child != NULL);
+  g_assert (child->widget != NULL);
+  g_assert (alloc != NULL);
+
+  gtk_widget_get_preferred_size (child->widget, &min_req, &nat_req);
+
+  child->min_height = min_req.height;
+  child->nat_height = nat_req.height;
+  child->min_width = min_req.width;
+  child->nat_width = nat_req.width;
+}
+
+static void
 ide_layout_relayout (IdeLayout           *self,
                      const GtkAllocation *alloc)
 {
@@ -236,6 +255,11 @@ ide_layout_relayout (IdeLayout           *self,
   content = &priv->children [GTK_POS_TOP];
   bottom = &priv->children [GTK_POS_BOTTOM];
 
+  ide_layout_child_get_preferred_size (left, alloc);
+  ide_layout_child_get_preferred_size (right, alloc);
+  ide_layout_child_get_preferred_size (content, alloc);
+  ide_layout_child_get_preferred_size (bottom, alloc);
+
   /*
    * Determine everything as if we are animating in/out or the child is visible.
    */


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