mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 09:40:19 +00:00
gadget: Warn if clip is not set
This leads to hard-to-track-down drawing errors, so better warn explicitly about it.
This commit is contained in:
parent
2417184a1f
commit
ec5596ce20
@ -524,7 +524,8 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
|
|||||||
GtkAllocation *out_clip)
|
GtkAllocation *out_clip)
|
||||||
{
|
{
|
||||||
GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
|
GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
|
||||||
GtkAllocation content_allocation, content_clip;
|
GtkAllocation content_allocation;
|
||||||
|
GtkAllocation content_clip = { 0, 0, 0, 0 };
|
||||||
GtkBorder margin, border, padding, shadow, extents;
|
GtkBorder margin, border, padding, shadow, extents;
|
||||||
GtkCssStyle *style;
|
GtkCssStyle *style;
|
||||||
|
|
||||||
@ -563,11 +564,16 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
|
|||||||
|
|
||||||
GTK_CSS_GADGET_GET_CLASS (gadget)->allocate (gadget, &content_allocation, baseline, &content_clip);
|
GTK_CSS_GADGET_GET_CLASS (gadget)->allocate (gadget, &content_allocation, baseline, &content_clip);
|
||||||
|
|
||||||
|
if (content_clip.width == 0 || content_clip.height == 0)
|
||||||
|
g_warning ("GtkCssAllocateFunc did not set clip\n");
|
||||||
|
|
||||||
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
|
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
|
||||||
|
|
||||||
out_clip->x = allocation->x + margin.left - shadow.left;
|
out_clip->x = allocation->x + margin.left - shadow.left;
|
||||||
out_clip->y = allocation->y + margin.top - shadow.top;
|
out_clip->y = allocation->y + margin.top - shadow.top;
|
||||||
out_clip->width = allocation->width - margin.left - margin.right + shadow.left + shadow.right;
|
out_clip->width = allocation->width - margin.left - margin.right + shadow.left + shadow.right;
|
||||||
out_clip->height = allocation->height - margin.top - margin.bottom + shadow.top + shadow.bottom;
|
out_clip->height = allocation->height - margin.top - margin.bottom + shadow.top + shadow.bottom;
|
||||||
|
|
||||||
gdk_rectangle_union (&content_clip, out_clip, out_clip);
|
gdk_rectangle_union (&content_clip, out_clip, out_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user