After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 712220 - GtkScrolledWindow has incorrect minimal size
GtkScrolledWindow has incorrect minimal size
Status: RESOLVED DUPLICATE of bug 778853
Product: gtk+
Classification: Platform
Component: Widget: GtkScrolledWindow
3.5.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-11-13 14:24 UTC by dolbnya
Modified: 2017-08-30 12:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (400 bytes, text/x-python)
2013-11-22 22:00 UTC, Kai Willadsen
Details
test case (512 bytes, text/x-python)
2015-04-17 17:07 UTC, Colomban Wendling
Details

Description dolbnya 2013-11-13 14:24:20 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);
Comment 1 Kai Willadsen 2013-11-22 22:00:42 UTC
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.
Comment 2 Colomban Wendling 2015-04-17 17:07:23 UTC
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.
Comment 3 Daniel Boles 2017-08-30 12:18:32 UTC

*** This bug has been marked as a duplicate of bug 778853 ***