[gtk+] paned: Fix size allocation



commit 5aec427c1a45c8932810dc0774194a3a8e37e5ad
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 15 20:18:59 2015 -0500

    paned: Fix size allocation
    
    We were passing negative widths to height-for-width calls that
    didn't expect this.

 gtk/gtkpaned.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index dbd60cc..7a5940e 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1178,36 +1178,28 @@ gtk_paned_measure_handle (GtkCssGadget   *gadget,
                           gpointer        data)
 {
   GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
-  GtkPaned *paned = GTK_PANED (widget);
-  GtkPanedPrivate *priv = paned->priv;
-  GtkStyleContext *context;
-  gint handle_size;
   GtkCssStyle *style;
   gint min_size;
 
   style = gtk_css_gadget_get_style (gadget);
-  if (orientation == priv->orientation)
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
+  else
+    min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
+
+  if (min_size != 0)
+    *minimum = *natural = min_size;
+  else
     {
-      if (orientation == GTK_ORIENTATION_HORIZONTAL)
-        min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
-      else
-        min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
+      GtkStyleContext *context;
 
-      if (min_size != 0)
-        *minimum = *natural = min_size;
-      else
-        {
-          context = gtk_widget_get_style_context (widget);
-          gtk_style_context_save_to_node (context, gtk_css_gadget_get_node (gadget));
-          gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
-          gtk_style_context_restore (context);
-          *minimum = *natural = handle_size;
-        }
+      context = gtk_widget_get_style_context (widget);
+      gtk_style_context_save_to_node (context, gtk_css_gadget_get_node (gadget));
+      gtk_widget_style_get (widget, "handle-size", &min_size, NULL);
+      gtk_style_context_restore (context);
+
+      *minimum = *natural = min_size;
     }
-  else if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    *minimum = *natural = gtk_widget_get_allocated_width (widget);
-  else
-    *minimum = *natural = gtk_widget_get_allocated_height(widget);
 }
 
 static void
@@ -1411,7 +1403,7 @@ gtk_paned_allocate (GtkCssGadget        *gadget,
           window1_allocation.y = window2_allocation.y = allocation->y;
 
           window2_allocation.x = window1_allocation.x + priv->child1_size + priv->handle_pos.width;
-          window2_allocation.width = MAX (1, allocation->x + allocation->width - window2_allocation.x);
+          window2_allocation.width = MAX (1, allocation->width - priv->child1_size - priv->handle_pos.width);
 
           if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)
             {


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