Skip to content
  • Luca Bacci's avatar
    Use natural size in Gtk::ScrolledWindows for Gtk >= 3.22 (!39) · c5556e8a
    Luca Bacci authored
    In Gtk 3.22 GtkScrolledWindow behaviour was changed to request the
    minimum size for its child [1]. An API was added to make it request
    the natural size [2].
    This was done to have better support out of the box for dynamic
    content inside scrolled windows, that is, content that may change
    allocated size.
    If the scrolled window content is not dynamic it is better to request
    the natural size because it gives a better looking layout. This is
    especially true in presence of wrapping labels, that may otherwise
    end up taking a very small width.
    
    Request natural size allocation to child of Gtk::ScrolledWindow for Gtk
    >= 3.22.
    
    References:
    
    [1] Gtk commit from 2016-08-31:
        GtkScrolledWindow: Make propagation of natural child sizes optional
        GNOME/gtk@0984d162
        "Making propagation of child natural sizes mandatory (or default, even) was
        evidently a mistake as this causes dynamic content in a scrolled window
        to resize it's parent when the scrolled window is competing for space
        with an adjacent widget."
    
    [2] Gtk 3.22 Reference Documentation - gtk_scrolled_window_set_propagate_natural_width
        https://developer.gnome.org/gtk3/3.22/GtkScrolledWindow.html#gtk-scrolled-window-set-propagate-natural-width
    
    [3] Gtkmm 3.21.6 NEWS
        https://gitlab.gnome.org/GNOME/gtkmm/blob/3.21.6/NEWS
        "ScrolledWindow: Added get/set_propagate_natural_height/width() and the properties."
    
    Closes !39 - Always request natural size inside Gtk::ScrolledWindows
    c5556e8a