entry: Measure icons again

This was previously removed because it changes the minimum and natural
size of the entry when the icons are shown/hidden at runtime. Just not
measuring them does not work however, so reintroduce this.
This commit is contained in:
Timm Bäder 2019-07-21 09:58:08 +02:00
parent 7eae9d115c
commit b658a1a8e3

View File

@ -1529,6 +1529,7 @@ gtk_entry_measure (GtkWidget *widget,
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
int i;
gtk_widget_measure (priv->text,
orientation,
@ -1536,6 +1537,30 @@ gtk_entry_measure (GtkWidget *widget,
minimum, natural,
minimum_baseline, natural_baseline);
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
int icon_min, icon_nat;
if (!icon_info)
continue;
gtk_widget_measure (icon_info->widget,
GTK_ORIENTATION_HORIZONTAL,
-1, &icon_min, &icon_nat, NULL, NULL);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
*minimum += icon_min;
*natural += icon_nat;
}
else
{
*minimum = MAX (*minimum, icon_min);
*natural = MAX (*natural, icon_nat);
}
}
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
{
int prog_min, prog_nat;