GNOME Bugzilla – Bug 660654
GtkScrolledWindow ignores natural width for child widget
Last modified: 2017-02-17 17:36:41 UTC
Created attachment 197984 [details] A test case for this bug GtkScrolledWindow ignores the natural width of its child widget, unless the scrollbar policy is GTK_POLICY_NEVER. I would expect that a GtkScrolledWindow's natural size is given by child_natural_size + size_of_scrollbars but instead, min_content_width seems to be used. I've attached demonstration code. Compile with valac --pkg gtk+-3.0 scrolledwindowbugtest.vala It also includes a naive subclass that overrides get_preferred_width. When you use that subclass, it works as expected. This is evidence that the problem is in GtkScrolledWindow and not elsewhere. This old bug looks similar, but is probably not relevant anymore since Gtk3 has entirely different layout management: https://bugzilla.gnome.org/show_bug.cgi?id=352594
Created attachment 346099 [details] Test case with propagate-natural-width/height set, fixing this This appears to be resolved, now that we have properties propagate-natural-(width|height) from 3.20 onwards. See the attachment, which converts your code to C (this or a .ui file is preferable for test cases), just adds code to set those properties to TRUE, and seems to do what you wanted.