GNOME Bugzilla – Bug 629794
Need for a way to know the natural size of any object.
Last modified: 2018-05-22 13:05:06 UTC
By "natural size" I mean the size the rendered model will occupy if there are no external restrictions on its size. Steps to reproduce: 1) Create a graph widget with GogAreaPlot. Add it to a GtkWindow 2) Add legend and populate with data 3) Note that when running, making the window (and thus the allocation for the widget) big enough will result in the legend being shown with all legend items in one row. The legend will then have a certain height X just a bit smaller than the window height. Increasing the window height further will not influence X. 4) Get a renderer for the graph view, update it with gog_renderer_update. 5) Get the view of the legend, and use gog_view_size_request() with (constant) very large sizes for the "available" attribute. Note that at the moment, you will need to modify gog_renderer_update from destroying the renderer surface (last two lines). Expected results: Height of the "required" GogViewRequisition equal to X, the height the legend had when the available area in the window was big enough. This should be independent of the size of the window the graph widget is in (as the sizes given to the renderer/view are not related to it). Actual results: Height that depends on the window height. Works fine for available height bigger than X. For available heights slightly smaller than X it seems to almost work (the value is a bit low, but does not seem to be a relation to the actual window size). For small window heights it seems to return the height of the window.
I wonder if GOGraphWidget (that you use in massifg) needs its own size_request vfunc implementation, which asks for its minumum size. Or would the baase GtkLayout's size-request just be correct if gog_view_size_request() was correct?
If gog_view_size_request() worked as expected, applications could set the size request of the widget based on the returned information. That sounds more flexible to me than the library deciding on a certain behavior by implementing the size_request vfunc on the widget. I at least consider that to be a separate issue from this bug.
Natural size makes sense for the legend, for titles and axes (at least in one dimension in that case), but not for the plot area.
What is actually needed is a new function giving the natural size for any object. This can't be done with gog_view_size_request since this would just break things. We need a new entry in GogViewClass, so this will have to wait until we branch.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/goffice/issues/24.