combobox: Avoid extra queue_resize()

width-request already ensures it's above the minimum width, so avoid an
extra queue_resize() when setting size request to (-1, -1).

This is the same way as GtkDropDown works. This also unbreaks
GtkComboBox after the recent allocation fix in
75a417e337.

Incidentally, this also makes GtkComboBox actually resize its popup as
intended (that was broken before).

I don't think this is ultimately the final fix, sometimes I still get
allocation warnings. But the proper fix will probably involve changing
some more allocation machinery around popovers. This is good enough for
now.
This commit is contained in:
Ivan Molodetskikh
2023-03-07 09:51:32 -08:00
committed by Mat
parent 770e5460d2
commit fc4044bbce

View File

@@ -362,7 +362,6 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
int menu_width;
gtk_widget_size_allocate (priv->box,
&(GtkAllocation) {
@@ -370,17 +369,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
width, height
}, baseline);
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
if (priv->popup_fixed_width)
gtk_widget_measure (priv->popup_widget, GTK_ORIENTATION_HORIZONTAL, -1,
&menu_width, NULL, NULL, NULL);
else
gtk_widget_measure (priv->popup_widget, GTK_ORIENTATION_HORIZONTAL, -1,
NULL, &menu_width, NULL, NULL);
gtk_widget_set_size_request (priv->popup_widget,
MAX (width, menu_width), -1);
gtk_widget_set_size_request (priv->popup_widget, width, -1);
gtk_widget_queue_resize (priv->popup_widget);
gtk_popover_present (GTK_POPOVER (priv->popup_widget));
}