Merge branch 'popover-critical-fix' into 'main'

popover: Take shadow size into account in measure

Closes #5782 and #6796

See merge request GNOME/gtk!7403
This commit is contained in:
Matthias Clasen 2024-07-02 02:39:21 +00:00
commit a8bfe4e6f2

View File

@ -1511,12 +1511,20 @@ gtk_popover_measure (GtkWidget *widget,
GtkCssStyle *style;
GtkBorder shadow_width;
if (for_size >= 0 && (POS_IS_VERTICAL (priv->position) == (orientation == GTK_ORIENTATION_HORIZONTAL)))
for_size -= tail_height;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (priv->contents_widget)));
gtk_css_shadow_value_get_extents (style->used->box_shadow, &shadow_width);
if (for_size >= 0)
{
if ((POS_IS_VERTICAL (priv->position) == (orientation == GTK_ORIENTATION_HORIZONTAL)))
for_size -= tail_height;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
for_size -= shadow_width.top + shadow_width.bottom;
else
for_size -= shadow_width.left + shadow_width.right;
}
gtk_widget_measure (priv->contents_widget,
orientation, for_size,
minimum, natural,