[gtk+/wip/matthiasc/gadget: 21/34] headerbar: Fix up some oversights



commit 05c6622f5cb0c0af26b368397704dc5237441278
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 8 10:15:51 2015 -0500

    headerbar: Fix up some oversights
    
    Don't look at css borders anymore at all, and don't forget
    to include the center widget in size requests.

 gtk/gtkheaderbar.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 27979ae..c981468 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -667,6 +667,17 @@ gtk_header_bar_get_size (GtkWidget      *widget,
         nvis_children += 1;
     }
 
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      minimum += center_min;
+      natural += center_nat;
+    }
+  else
+    {
+      minimum = MAX (minimum, center_min);
+      natural = MAX (natural, center_nat);
+    }
+
   if (nvis_children > 0 && orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       minimum += nvis_children * priv->spacing;
@@ -691,7 +702,6 @@ gtk_header_bar_compute_size_for_orientation (GtkWidget *widget,
   gint child_size;
   gint child_natural;
   gint nvis_children;
-  GtkBorder css_borders;
 
   nvis_children = 0;
 
@@ -776,7 +786,6 @@ gtk_header_bar_compute_size_for_opposing_orientation (GtkWidget *widget,
   gint child_size;
   gint child_minimum;
   gint child_natural;
-  GtkBorder css_borders;
   gint center_min, center_nat;
 
   nvis_children = count_visible_children (bar);
@@ -989,7 +998,6 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   gint x;
   gint child_size;
   GtkTextDirection direction;
-  GtkBorder css_borders;
 
   gtk_widget_set_allocation (widget, allocation);
 
@@ -1063,12 +1071,12 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   side[0] = side[1] = 0;
   for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++)
     {
-      child_allocation.y = allocation->y + css_borders.top;
+      child_allocation.y = allocation->y;
       child_allocation.height = height;
       if (packing == GTK_PACK_START)
-        x = allocation->x + css_borders.left + start_width;
+        x = allocation->x + start_width;
       else
-        x = allocation->x + allocation->width - end_width - css_borders.right;
+        x = allocation->x + allocation->width - end_width;
 
       i = 0;
       for (l = priv->children; l != NULL; l = l->next)
@@ -1145,16 +1153,16 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   if (priv->label_box != NULL)
     gtk_widget_size_allocate (priv->label_box, &child_allocation);
 
-  child_allocation.y = allocation->y + css_borders.top;
+  child_allocation.y = allocation->y;
   child_allocation.height = height;
 
   if (priv->titlebar_start_box)
     {
       gboolean left = (direction == GTK_TEXT_DIR_LTR);
       if (left)
-        child_allocation.x = allocation->x + css_borders.left;
+        child_allocation.x = allocation->x;
       else
-        child_allocation.x = allocation->x + allocation->width - css_borders.right - start_width + 
priv->spacing;
+        child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
       child_allocation.width = start_width - priv->spacing;
       gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation);
     }
@@ -1163,9 +1171,9 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
     {
       gboolean left = (direction != GTK_TEXT_DIR_LTR);
       if (left)
-        child_allocation.x = allocation->x + css_borders.left;
+        child_allocation.x = allocation->x;
       else
-        child_allocation.x = allocation->x + allocation->width - css_borders.right - end_width + 
priv->spacing;
+        child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
       child_allocation.width = end_width - priv->spacing;
       gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation);
     }


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