menu: Do a proper min height request
The minimum height is the size of one menu item plus the arrows, not the minimum size of all menu items. https://bugzilla.gnome.org/show_bug.cgi?id=691974 https://bugzilla.gnome.org/show_bug.cgi?id=694859
This commit is contained in:
committed by
Matthias Clasen
parent
ca41e8b4ff
commit
061601225d
@@ -3273,18 +3273,19 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkBorder padding;
|
||||
GtkBorder padding, arrow_border;
|
||||
GtkMenu *menu = GTK_MENU (widget);
|
||||
GtkMenuPrivate *priv = menu->priv;
|
||||
guint *min_heights, *nat_heights;
|
||||
guint border_width;
|
||||
gint n_heights, i;
|
||||
gint min_height, nat_height;
|
||||
gint min_height, single_height, nat_height;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
get_menu_padding (widget, &padding);
|
||||
|
||||
min_height = nat_height = (2 * border_width) + padding.top + padding.bottom;
|
||||
single_height = 0;
|
||||
|
||||
n_heights =
|
||||
calculate_line_heights (menu, for_size, &min_heights, &nat_heights);
|
||||
@@ -3292,9 +3293,16 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
||||
for (i = 0; i < n_heights; i++)
|
||||
{
|
||||
min_height += min_heights[i];
|
||||
single_height = MAX (single_height, min_heights[i]);
|
||||
nat_height += nat_heights[i];
|
||||
}
|
||||
|
||||
get_arrows_border (menu, &arrow_border);
|
||||
single_height += (2 * border_width)
|
||||
+ padding.top + padding.bottom
|
||||
+ arrow_border.top + arrow_border.bottom;
|
||||
min_height = MIN (min_height, single_height);
|
||||
|
||||
if (priv->have_position)
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (priv->toplevel);
|
||||
|
||||
Reference in New Issue
Block a user