From: Yubao Liu Date: Sat, 16 Jul 2022 16:12:39 +0000 (+0800) Subject: popover: Correctly substract arrow height when measuring popover widget X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~4^2~54^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=50a8cbc0da3118640cf0525d30f94c54e68b73d2;p=gtk4.git popover: Correctly substract arrow height when measuring popover widget For default popover arrow position and default height-for-width layout mode, natural_width is calculated first with for_size=-1 and orientation=HORIZONTAL, at the end of gtk_popover_measure() natural_width won't be added with tail_height. Then to measure with for_size=natural_width and orientation=VERTICAL, obviously for_size shouldn't be substract with tail_height. The wrong logic will force content in popover gets less width and then text labels in popover may get wrapped unnecessarily. --- diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index d6f976daa7..8ac30372b7 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1451,7 +1451,7 @@ gtk_popover_measure (GtkWidget *widget, GtkCssStyle *style; GtkBorder shadow_width; - if (for_size >= 0) + 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)));