[gedit] overlay-child: always allocate to the real widget the full allocation



commit 7e2d4d425d9f3e823501afb5c8e65b43a8373b45
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Feb 24 21:02:41 2011 -0500

    overlay-child: always allocate to the real widget the full allocation
    
    I don't get why we cache allocation here, and we should always just proxy
    the real widget allocation/request.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643258

 gedit/gedit-overlay-child.c |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/gedit/gedit-overlay-child.c b/gedit/gedit-overlay-child.c
index dfe4906..4344e8f 100644
--- a/gedit/gedit-overlay-child.c
+++ b/gedit/gedit-overlay-child.c
@@ -20,13 +20,11 @@
  */
 
 #include "gedit-overlay-child.h"
-#include "gedit-enum-types.h"
 
 struct _GeditOverlayChildPrivate
 {
 	GtkWidget		 *widget;
 	GBinding		 *binding;
-	GtkAllocation             widget_alloc;
 	GeditOverlayChildPosition position;
 	guint                     offset;
 };
@@ -124,19 +122,16 @@ gedit_overlay_child_get_preferred_width (GtkWidget *widget,
                                          gint      *natural)
 {
 	GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
-	gint width;
+        gint child_min = 0, child_nat = 0;
 
 	if (child->priv->widget != NULL)
 	{
-		gint child_min, child_nat;
-
 		gtk_widget_get_preferred_width (child->priv->widget,
 		                                &child_min, &child_nat);
-		child->priv->widget_alloc.width = child_min;
 	}
 
-	width = child->priv->widget_alloc.width;
-	*minimum = *natural = width;
+	*minimum = child_min;
+        *natural = child_nat;
 }
 
 static void
@@ -145,19 +140,16 @@ gedit_overlay_child_get_preferred_height (GtkWidget *widget,
                                           gint      *natural)
 {
 	GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
-	gint height;
+        gint child_min = 0, child_nat = 0;
 
 	if (child->priv->widget != NULL)
 	{
-		gint child_min, child_nat;
-
 		gtk_widget_get_preferred_height (child->priv->widget,
 		                                 &child_min, &child_nat);
-		child->priv->widget_alloc.height = child_min;
 	}
 
-	height = child->priv->widget_alloc.height;
-	*minimum = *natural = height;
+	*minimum = child_min;
+        *natural = child_nat;
 }
 
 static void
@@ -165,15 +157,18 @@ gedit_overlay_child_size_allocate (GtkWidget     *widget,
                                    GtkAllocation *allocation)
 {
 	GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
+        GtkAllocation tmp;
 
+        tmp.width = allocation->width;
+        tmp.height = allocation->height;
+        tmp.x = tmp.y = 0;
+        
 	GTK_WIDGET_CLASS (gedit_overlay_child_parent_class)->size_allocate (widget, allocation);
 
-	if (child->priv->widget != NULL &&
-	    child->priv->widget_alloc.height &&
-	    child->priv->widget_alloc.width)
+	if (child->priv->widget != NULL)
 	{
 		gtk_widget_size_allocate (child->priv->widget,
-		                          &child->priv->widget_alloc);
+		                          &tmp);
 	}
 }
 



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