[gtk+] flowbox: Size gadget realtive to widget->window



commit d12c81f177346f09dbc5a72f74e5627487a602ac
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 29 11:57:11 2016 +0100

    flowbox: Size gadget realtive to widget->window
    
    This fixes a few clipping issues and syncs code with GtkListBox.

 gtk/gtkflowbox.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index d543d54..38a528b 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -519,8 +519,6 @@ gtk_flow_box_child_size_allocate (GtkWidget     *widget,
                            gtk_widget_get_allocated_baseline (widget),
                            &clip);
 
-  clip.x += allocation->x;
-  clip.y += allocation->y;
   gtk_widget_set_clip (widget, &clip);
 }
 
@@ -1575,7 +1573,6 @@ gtk_flow_box_size_allocate (GtkWidget     *widget,
   GtkFlowBox *box = GTK_FLOW_BOX (widget);
   GtkFlowBoxPrivate  *priv = BOX_PRIV (box);
   GtkAllocation clip;
-  GtkAllocation child_allocation;
 
   gtk_widget_set_allocation (widget, allocation);
 
@@ -1584,13 +1581,8 @@ gtk_flow_box_size_allocate (GtkWidget     *widget,
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
 
-  child_allocation.x = 0;
-  child_allocation.y = 0;
-  child_allocation.width = allocation->width;
-  child_allocation.height = allocation->height;
-
   gtk_css_gadget_allocate (BOX_PRIV (widget)->gadget,
-                           &child_allocation,
+                           allocation,
                            gtk_widget_get_allocated_baseline (widget),
                            &clip);
 
@@ -1607,6 +1599,7 @@ gtk_flow_box_allocate (GtkCssGadget        *gadget,
   GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
   GtkFlowBox *box = GTK_FLOW_BOX (widget);
   GtkFlowBoxPrivate  *priv = BOX_PRIV (box);
+  GtkAllocation widget_allocation;
   GtkAllocation child_allocation;
   gint avail_size, avail_other_size, min_items, item_spacing, line_spacing;
   GtkAlign item_align;
@@ -1623,6 +1616,8 @@ gtk_flow_box_allocate (GtkCssGadget        *gadget,
   gint i, this_line_size;
   GSequenceIter *iter;
 
+  gtk_widget_get_allocation (widget, &widget_allocation);
+
   min_items = MAX (1, priv->min_children_per_line);
 
   if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -1803,8 +1798,8 @@ gtk_flow_box_allocate (GtkCssGadget        *gadget,
    * Prepare item/line initial offsets and jump into the
    * real allocation loop.
    */
-  line_offset = allocation->y;
-  item_offset = allocation->x;
+  line_offset = allocation->y - widget_allocation.y;
+  item_offset = allocation->x - widget_allocation.x;
 
   /* prepend extra space to item_offset/line_offset for SPREAD_END */
   item_offset += get_offset_pixels (item_align, extra_pixels);
@@ -1868,7 +1863,7 @@ gtk_flow_box_allocate (GtkCssGadget        *gadget,
                 }
             }
 
-          item_offset = allocation->x;
+          item_offset = allocation->x - widget_allocation.x;
 
           if (item_align == GTK_ALIGN_CENTER)
             {


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