GNOME Bugzilla – Bug 766530
scrolledwindow: Fix typo in get_preferred_height calculation
Last modified: 2016-05-17 05:41:49 UTC
The following commit introduced a typo in the get_preferred_height calculation code. commit 55196a705f00564a44647bfc97981db0a783369a Author: Tadej Borovšak <tadeboro@gmail.com> Date: Mon Oct 18 00:21:39 2010 -0400 Add GtkScrollable interface The GtkScrollable interface provides "hadjustment" and "vadjustment" properties that are used by GtkScrolledWindow. It replaces the ::set_scroll_adjustment signal. The scrollable interface also has ::min-display-width/height properties that can be used to control the minimally visible part inside a scrolled window. Particularly, the second else block of this chunk: @@ -2043,9 +2044,20 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget, } else { - /* Always ask for at least enough to fit the scrollbars */ - minimum_req.height += hscrollbar_requisition.height; - natural_req.height += hscrollbar_requisition.height; + gint min_display_height = + gtk_scrollable_get_min_display_height (GTK_SCROLLABLE (child)); + + if (min_display_height > 0) + { + minimum_req.height += min_display_height; + natural_req.height += min_display_height; + extra_height = -1; + } + else + { + minimum_req.height += vscrollbar_requisition.height; + natural_req.height += vscrollbar_requisition.height; + } } } } Interestingly, this chunk seems to have fixed an earlier typo: @@ -2064,14 +2076,14 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget, { minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height); natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height); - if (!extra_height || priv->vscrollbar_policy == GTK_POLICY_ALWAYS) + if (!extra_width || priv->vscrollbar_policy == GTK_POLICY_ALWAYS) extra_width = scrollbar_spacing + vscrollbar_requisition.width; }
Created attachment 328008 [details] [review] scrolledwindow: Fix typo in get_preferred_height calculation
Review of attachment 328008 [details] [review]: Looks right to me. I guess we'll find out if anything breaks.
Comment on attachment 328008 [details] [review] scrolledwindow: Fix typo in get_preferred_height calculation Thanks for the review. Pushed to master.