diff options
author | Timm Bäder <mail@baedert.org> | 2017-06-25 18:51:23 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:14 -0400 |
commit | 8645dd1030d1ea7fa814c16d7506c933148d4fb9 (patch) | |
tree | 108d77cfc9ea03d28e95884fbf7b0d683b82e850 /gtk/gtkflowbox.c | |
parent | f1813e8f8850ae707598455d4ed2fc89a1afb394 (diff) | |
download | gtk+-8645dd1030d1ea7fa814c16d7506c933148d4fb9.tar.gz |
flowbox: Compute clip directly
Diffstat (limited to 'gtk/gtkflowbox.c')
-rw-r--r-- | gtk/gtkflowbox.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 11325406f8..1fec4ce7a5 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -420,14 +420,19 @@ static void gtk_flow_box_child_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkAllocation clip; + GtkAllocation clip = *allocation; GtkWidget *child; child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) - gtk_widget_size_allocate (child, (GtkAllocation *)allocation); + { + GdkRectangle child_clip; + + gtk_widget_size_allocate (child, allocation); + gtk_widget_get_clip (child, &child_clip); - gtk_container_get_children_clip (GTK_CONTAINER (widget), &clip); + gdk_rectangle_union (&child_clip, &clip, &clip); + } gtk_widget_set_clip (widget, &clip); } @@ -1403,6 +1408,7 @@ gtk_flow_box_size_allocate (GtkWidget *widget, GtkFlowBox *box = GTK_FLOW_BOX (widget); GtkFlowBoxPrivate *priv = BOX_PRIV (box); GtkAllocation clip = *allocation; + GdkRectangle child_clip; GtkAllocation widget_allocation; GtkAllocation child_allocation; gint avail_size, avail_other_size, min_items, item_spacing, line_spacing; @@ -1741,7 +1747,10 @@ gtk_flow_box_size_allocate (GtkWidget *widget, if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) child_allocation.x = allocation->width - child_allocation.x - child_allocation.width; + gtk_widget_size_allocate (child, &child_allocation); + gtk_widget_get_clip (child, &child_clip); + gdk_rectangle_union (&clip, &child_clip, &clip); item_offset += this_item_size; item_offset += item_spacing; @@ -1752,8 +1761,6 @@ gtk_flow_box_size_allocate (GtkWidget *widget, g_free (item_sizes); g_free (line_sizes); - gtk_container_get_children_clip (GTK_CONTAINER (widget), &clip); - gtk_widget_set_clip (widget, &clip); } |