mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-17 15:40:12 +00:00
gadget: Avoid warning for empty containers
Empty boxes end up setting the clip to { 0, 0, 0, 0}, so warning for a width or height of 0 triggers false positives. Instead, initialize the clip to clearly invalid values.
This commit is contained in:
parent
09d9674d69
commit
f3c95e1c63
@ -525,7 +525,7 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
|
|||||||
{
|
{
|
||||||
GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
|
GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
|
||||||
GtkAllocation content_allocation;
|
GtkAllocation content_allocation;
|
||||||
GtkAllocation content_clip = { 0, 0, 0, 0 };
|
GtkAllocation content_clip = { 0, 0, -1, -1 };
|
||||||
GtkBorder margin, border, padding, shadow, extents;
|
GtkBorder margin, border, padding, shadow, extents;
|
||||||
GtkCssStyle *style;
|
GtkCssStyle *style;
|
||||||
|
|
||||||
@ -568,10 +568,14 @@ 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)
|
if (content_clip.width == -1 || content_clip.height == -1)
|
||||||
|
{
|
||||||
g_warning ("GtkCssAllocateFunc did not set clip for gadget (node %s, owner %s)\n",
|
g_warning ("GtkCssAllocateFunc did not set clip for gadget (node %s, owner %s)\n",
|
||||||
gtk_css_node_get_name (gtk_css_gadget_get_node (gadget)),
|
gtk_css_node_get_name (gtk_css_gadget_get_node (gadget)),
|
||||||
G_OBJECT_TYPE_NAME (gtk_css_gadget_get_owner (gadget)));
|
G_OBJECT_TYPE_NAME (gtk_css_gadget_get_owner (gadget)));
|
||||||
|
content_clip.width = 0;
|
||||||
|
content_clip.height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user