summaryrefslogtreecommitdiff
path: root/gtk/gtklistbox.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-07-11 09:58:21 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:16 -0400
commit36ab70ddf5dbe993eb995bd9157f347258765922 (patch)
tree508f0ca9cf6b4fc990e88b0a5892b50f594890fe /gtk/gtklistbox.c
parent95bd58ac00ede771ca80684e143fffdc61ff2194 (diff)
downloadgtk+-36ab70ddf5dbe993eb995bd9157f347258765922.tar.gz
widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well change the size-allocate signature to include a out_clip parameter, just like GtkCssGadget did. And since we now always propagate baselines, we might as well pass that one on to size-allocate. This way we can also make sure to transform the clip returned from size-allocate to parent-coordinates, i.e. the same coordinate space priv->allocation is in.
Diffstat (limited to 'gtk/gtklistbox.c')
-rw-r--r--gtk/gtklistbox.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 12d76fe373..c19e01b6ad 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -214,7 +214,9 @@ static void gtk_list_box_compute_expand (GtkWidget
static GType gtk_list_box_child_type (GtkContainer *container);
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
static void gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_list_box_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time_);
@@ -2509,11 +2511,12 @@ gtk_list_box_measure (GtkWidget *widget,
}
static void
-gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkListBoxPrivate *priv = BOX_PRIV (widget);
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkAllocation child_allocation;
GtkAllocation header_allocation;
@@ -2539,9 +2542,8 @@ gtk_list_box_size_allocate (GtkWidget *widget,
&child_min, NULL, NULL, NULL);
header_allocation.height = allocation->height;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (priv->placeholder, &header_allocation);
- gtk_widget_get_clip (priv->placeholder, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
@@ -2564,9 +2566,11 @@ gtk_list_box_size_allocate (GtkWidget *widget,
&child_min, NULL, NULL, NULL);
header_allocation.height = child_min;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (ROW_PRIV (row)->header, &header_allocation);
- gtk_widget_get_clip (ROW_PRIV (row)->header, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (ROW_PRIV (row)->header,
+ &header_allocation,
+ -1,
+ &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
@@ -2578,13 +2582,10 @@ gtk_list_box_size_allocate (GtkWidget *widget,
child_allocation.height = child_min;
ROW_PRIV (row)->height = child_allocation.height;
- gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation);
- gtk_widget_get_clip (GTK_WIDGET (row), &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
-
- gtk_widget_set_clip (widget, &clip);
}
/**
@@ -3061,20 +3062,16 @@ gtk_list_box_row_measure (GtkWidget *widget,
}
static void
-gtk_list_box_row_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_row_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidget *child;
- GtkAllocation clip = *allocation;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- {
- gtk_widget_size_allocate (child, allocation);
- gtk_widget_get_clip (child, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (child, allocation, baseline, out_clip);
}
/**