forked from AuroraMiddleware/gtk
iconview: Ensure icons are at least 1x1 pixels
This is useful for 2 reasons: (1) Items actually exist and are clickable (2) Size computations don't divide by 0 I've not seen problems with this in the wild (mostly because item-padding defaults to non-0), but noticed this while fixing other bugs.
This commit is contained in:
parent
62292dc247
commit
fd4c330500
@ -1469,8 +1469,8 @@ gtk_icon_view_get_preferred_item_size (GtkIconView *icon_view,
|
|||||||
|
|
||||||
if (priv->items == NULL)
|
if (priv->items == NULL)
|
||||||
{
|
{
|
||||||
*minimum = 0;
|
*minimum = 1;
|
||||||
*natural = 0;
|
*natural = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1530,9 +1530,9 @@ gtk_icon_view_get_preferred_item_size (GtkIconView *icon_view,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (minimum)
|
if (minimum)
|
||||||
*minimum += 2 * priv->item_padding;
|
*minimum = MAX (1, *minimum + 2 * priv->item_padding);
|
||||||
if (natural)
|
if (natural)
|
||||||
*natural += 2 * priv->item_padding;
|
*natural = MAX (1, *natural + 2 * priv->item_padding);
|
||||||
|
|
||||||
g_object_unref (context);
|
g_object_unref (context);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user