GNOME Bugzilla – Bug 712220
GtkScrolledWindow has incorrect minimal size
Last modified: 2017-08-30 12:18:32 UTC
Code you can see below generates scrolled window. Minimal size of this window is like size of window with policy (GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS), i.e. scrollbars exist and take a place on the screen. These scrollbars are just invisible. There is no invisible scrollbars in GTK+ 2.x. Code snippet: GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
Created attachment 261272 [details] Test case Test case attached using pygobject. This works correctly with POLICY_NEVER (i.e., the textview gets its requisition), but fails with POLICY_AUTOMATIC.
Created attachment 301866 [details] test case I don't think the issue in (comment #1) is the same: this report is about the minimal size being too large, not too small. Attached test case shows that the initial size is smaller (and correct) with policy=NEVER than with policy=AUTOMATIC. The issue is that with policy=AUTOMATIC the scrolled window assumes the scrollbars will be visible in its get_preferred_size(), whether or not it is actually the case, resulting in a minimal request identical than if it used policy=ALWAYS. I guess the scrolled window should MIN(scrollbar.min_size child.nat_size) when policy=AUTOMATIC -- or whatever is the correct size used to determine whether or not to show the scrollbars in AUTOMATIC mode. However, it's probably a little more tricky for handling policy=AUTOMATIC in both directions, as the decision whether or not to show one scrollbar will affect whether or not the other should be shown. But the logic is already there somewhere, so it could probably be reused with more or less efforts.
*** This bug has been marked as a duplicate of bug 778853 ***