[gtk+] listbox: Move the priv->gadget allocation



commit e28d94bc8baed22da1885488f82cab3160d3afd0
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 29 11:46:32 2016 +0100

    listbox: Move the priv->gadget allocation
    
    It used to be relative to the window, now it is relative to the widget.
    
    That is necessary so the snapshot fuction doesn't confuse coordinate
    systems.

 gtk/gtklistbox.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index db3a9a5..db6e9f0 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2735,7 +2735,6 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
   GtkListBoxPrivate *priv = BOX_PRIV (widget);
-  GtkAllocation child_allocation;
   GtkAllocation clip;
 
   gtk_widget_set_allocation (widget, allocation);
@@ -2745,18 +2744,11 @@ gtk_list_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);
 
-  clip.x += allocation->x;
-  clip.y += allocation->y;
   gtk_widget_set_clip (widget, &clip);
 }
 
@@ -2772,17 +2764,20 @@ gtk_list_box_allocate (GtkCssGadget        *gadget,
   GtkListBoxPrivate *priv = BOX_PRIV (widget);
   GtkAllocation child_allocation;
   GtkAllocation header_allocation;
+  GtkAllocation widget_allocation;
   GtkListBoxRow *row;
   GSequenceIter *iter;
   int child_min;
 
-  child_allocation.x = allocation->x;
-  child_allocation.y = allocation->y;
+  gtk_widget_get_allocation (widget, &widget_allocation);
+
+  child_allocation.x = allocation->x - widget_allocation.x;
+  child_allocation.y = allocation->y - widget_allocation.y;
   child_allocation.width = allocation->width;
   child_allocation.height = 0;
 
-  header_allocation.x = allocation->x;
-  header_allocation.y = allocation->y;
+  header_allocation.x = allocation->x - widget_allocation.x;
+  header_allocation.y = allocation->y - widget_allocation.y;
   header_allocation.width = allocation->width;
   header_allocation.height = 0;
 


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