diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index be1f3f6a4d..613b5aeae7 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -803,7 +803,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget, } } - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void @@ -1172,7 +1172,7 @@ gtk_box_size_allocate_with_center (GtkWidget *widget, } gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index ebe4f15bb6..c1f4d0d0f4 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1773,7 +1773,7 @@ gtk_button_size_allocate (GtkWidget *widget, gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline); } - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static gboolean diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index b5329fa5ad..05b6c81af9 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -645,7 +645,7 @@ swatch_size_allocate (GtkWidget *widget, allocation->width, allocation->height); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static gboolean diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 96ef51a051..8b6d81e5bd 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2768,7 +2768,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (child_widget, &child); } - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } #undef GTK_COMBO_BOX_ALLOCATE_BUTTON diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 5a9298cb7a..536e0480ab 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3715,7 +3715,7 @@ gtk_entry_size_allocate (GtkWidget *widget, _gtk_entry_completion_resize_popup (completion); } - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static gboolean diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index d735e63224..ce4a7dca43 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -1681,7 +1681,7 @@ gtk_grid_size_allocate (GtkWidget *widget, gtk_grid_request_allocate_children (&request); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static gboolean diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c index 91d848c200..f8b234c582 100644 --- a/gtk/gtklevelbar.c +++ b/gtk/gtklevelbar.c @@ -581,7 +581,7 @@ gtk_level_bar_size_allocate (GtkWidget *widget, { GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->size_allocate (widget, allocation); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 562a15cebb..83aea7871c 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -3137,7 +3137,7 @@ gtk_list_box_row_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (child, &child_allocation); } - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } /** diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 251f34ffd1..0afef8c8a3 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -551,7 +551,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget, /* No path is set; we don't have to allocate anything. */ if (path_bar->priv->button_list == NULL) { - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); return; } @@ -773,7 +773,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget, if (needs_reorder) child_ordering_changed (path_bar); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index b2b24969a8..84aeef9950 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -450,7 +450,7 @@ gtk_progress_bar_size_allocate (GtkWidget *widget, { GTK_WIDGET_CLASS (gtk_progress_bar_parent_class)->size_allocate (widget, allocation); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index e9b4fcc1a0..2050477e91 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -480,7 +480,7 @@ gtk_switch_size_allocate (GtkWidget *widget, else priv->handle_x = 0; - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 5ec5e52481..ea05df472a 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -1835,7 +1835,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget, g_free (allocations); g_free (new_states); - _gtk_widget_set_simple_clip (widget); + _gtk_widget_set_simple_clip (widget, NULL); } static void diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 383728d0b5..cb9727baa4 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -15548,6 +15548,8 @@ union_with_clip (GtkWidget *widget, /* * _gtk_widget_set_simple_clip: * @widget: a #GtkWidget + * @content_clip: Clipping area of the contents or %NULL, if the contents + * do not extent the allocation. * * This is a convenience function for gtk_widget_set_clip(), if you * just want to set the clip for @widget based on its allocation, @@ -15562,7 +15564,8 @@ union_with_clip (GtkWidget *widget, * function and must call gtk_widget_set_clip() yourself. **/ void -_gtk_widget_set_simple_clip (GtkWidget *widget) +_gtk_widget_set_simple_clip (GtkWidget *widget, + GtkAllocation *content_clip) { GtkStyleContext *context; GtkAllocation clip; @@ -15580,6 +15583,9 @@ _gtk_widget_set_simple_clip (GtkWidget *widget) clip.width += extents.left + extents.right; clip.height += extents.top + extents.bottom; + if (content_clip) + gdk_rectangle_union (content_clip, &clip, &clip); + if (GTK_IS_CONTAINER (widget)) gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip); diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 9b8fae5c08..3a825d3c04 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -134,7 +134,8 @@ GtkStyle * _gtk_widget_get_style (GtkWidget *widget); void _gtk_widget_set_style (GtkWidget *widget, GtkStyle *style); gboolean _gtk_widget_supports_clip (GtkWidget *widget); -void _gtk_widget_set_simple_clip (GtkWidget *widget); +void _gtk_widget_set_simple_clip (GtkWidget *widget, + GtkAllocation *content_clip); typedef gboolean (*GtkCapturedEventHandler) (GtkWidget *widget, GdkEvent *event);