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 679168 - st-box-layout: Always pass on for_width/height
st-box-layout: Always pass on for_width/height
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: st
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 681797
 
 
Reported: 2012-06-29 22:58 UTC by Rui Matos
Modified: 2012-12-03 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st-box-layout: Always pass on for_width/height (1.39 KB, patch)
2012-06-29 22:58 UTC, Rui Matos
none Details | Review
iconGrid: Handle preferred height requests for infinite widths (1.07 KB, patch)
2012-07-03 12:24 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2012-06-29 22:58:33 UTC
This is precluding, at least, having IconGrids with > 1 row inside
vertical BoxLayouts.

I'm not 100% sure it's the correct fix though. Jasper pointed me to
https://github.com/clutter-project/mx/commit/df8cbce32cca3da3cfac4b62a980c7548418808f
but says that this was probably before "Clutter had a request mode
machinery".

I don't see any ill effects running with it though.
Comment 1 Rui Matos 2012-06-29 22:58:35 UTC
Created attachment 217679 [details] [review]
st-box-layout: Always pass on for_width/height

We shouldn't be lying to our children.
Comment 2 Florian Müllner 2012-06-29 23:11:58 UTC
Also see the remaining patch in bug 672543.
Comment 3 Florian Müllner 2012-06-29 23:16:26 UTC
(In reply to comment #2)
> Also see the remaining patch in bug 672543.

Note that the patch there only has one of the two changes, because I *did* find regressions for the other one (I don't remember the exact details, but it was in some of the popup menus)
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-06-30 00:33:06 UTC
I also want to get Emmanuele's opinion: ClutterBoxLayout has the same issue:

    http://git.gnome.org/browse/clutter/tree/clutter/clutter-box-layout.c#n493

as both were stolen from Mx, so we should probably fix up both while we're at it.
Comment 5 Emmanuele Bassi (:ebassi) 2012-06-30 08:57:25 UTC
ClutterBoxLayout was taken from GtkBox - the line in comment 4 is the Clutter-equivalent of the GTK+ idiomatic gtk_widget_get_preferred_width(), which lets the widget compute the size of the child without an height, e.g.:

  http://git.gnome.org/browse/gtk+/tree/gtk/gtkbox.c#n1041

the layout policy for GtkBox (and ClutterBoxLayout) is to request the sum of all widths and the maximum height of all the children if orientation==horizontal, and the sum of all heights and the maximum width of all the children if orientation==vertical. if anything ought to be changed is to remove the for_height/for_width and always pass -1, to make the code exactly like GtkBox.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-07-02 17:39:15 UTC
(In reply to comment #5)
> ClutterBoxLayout was taken from GtkBox - the line in comment 4 is the
> Clutter-equivalent of the GTK+ idiomatic gtk_widget_get_preferred_width(),
> which lets the widget compute the size of the child without an height, e.g.:
> 
>   http://git.gnome.org/browse/gtk+/tree/gtk/gtkbox.c#n1041
> 
> the layout policy for GtkBox (and ClutterBoxLayout) is to request the sum of
> all widths and the maximum height of all the children if
> orientation==horizontal, and the sum of all heights and the maximum width of
> all the children if orientation==vertical. if anything ought to be changed is
> to remove the for_height/for_width and always pass -1, to make the code exactly
> like GtkBox.

The issue, I believe, happens when you have nested StBoxLayouts (or ClutterBoxLayouts) of the same orientation -- if one is constrained, the other won't notice, and you'll get odd clipping when using a multiline layout or something.
Comment 7 Rui Matos 2012-07-03 12:24:35 UTC
Created attachment 217928 [details] [review]
iconGrid: Handle preferred height requests for infinite widths

Request enough height to fit all children in a single line instead of
requesting 0.
--
Ok, so it seems that the real bug is in IconGrid. This patch fixes at
least an obvious wrong case but there are probably others.
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-07-03 15:10:28 UTC
(In reply to comment #7)
> Ok, so it seems that the real bug is in IconGrid. This patch fixes at
> least an obvious wrong case but there are probably others.

That's not true. Florian found a case where this happened in a modal dialog, and other people have had the same happen in a BoxLayout.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-07-03 15:10:44 UTC
er, other people have had the same happen in a popup menu.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-08-13 23:16:18 UTC
I also want to point out that ClutterBoxLayout changed recently. I don't know if inheriting it into StBoxLayout will "fix" this issue or not.
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-08-14 01:22:52 UTC
So, Florian, if you can find a standalone test with either St.BoxLayout or Clutter.BoxLayout, I'd be really appreciated to investigation. I tried for a few hours a while ago, and couldn't make one up.
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-08-21 15:24:29 UTC
Review of attachment 217928 [details] [review]:

Yes.
Comment 13 Jasper St. Pierre (not reading bugmail) 2012-09-22 13:58:42 UTC
This patch has landed, right?
Comment 14 Rui Matos 2012-09-22 14:06:21 UTC
(In reply to comment #13)
> This patch has landed, right?

I don't think so. I think it isn't needed with the current code. It's only with the search results re-design that the issue becomes visible.
Comment 15 Cosimo Cecchi 2012-12-03 15:01:02 UTC
I still have this patch in my search re-layout branch; can we please get this in?
Comment 16 Jasper St. Pierre (not reading bugmail) 2012-12-03 17:27:40 UTC
The iconGrid patch? Sure.
Comment 17 Cosimo Cecchi 2012-12-03 17:45:25 UTC
Okay, I pushed it to master now.

Attachment 217928 [details] pushed as 29cb10f - iconGrid: Handle preferred height requests for infinite widths