GNOME Bugzilla – Bug 681660
GtkGrid doesn't support nth-child
Last modified: 2018-04-22 19:39:29 UTC
If an inline toolbar (GTK_STYLE_CLASS_INLINE_TOOLBAR) is added in a vertical GtkGrid, the style is not perfect: the line separating the above widget from the toolbar is thicker, and the corners at the bottom are not rounded. With a vertical GtkBox, no problem. I'll attach two screenshots.
Created attachment 220930 [details] Inline toolbar in a vertical GtkBox: OK
Created attachment 220931 [details] Inline toolbar in a vertical GtkGrid: less beautiful
This is not really a theme bug; the problem is that GtkGrid doesn't support the advanced CSS siblings features we use to get that effect, such as nth-child. The fix would involve implementing GtkContainer:get_path_for_child() in GtkGrid, but it's unclear what's the best behavior to have here, since the grid can pack children in both directions. As a very simple implementation, I think it could work following the value of the GtkGrid's orientation, and treat the children in that direction as a linear list.
Close as WONTFIX for now, because GtkBox will not be deprecated (see bug #706269).
*** Bug 769876 has been marked as a duplicate of this bug. ***
(In reply to Cosimo Cecchi from comment #3) > As a very simple implementation, I think it could work following the value > of the GtkGrid's orientation, and treat the children in that direction as a > linear list. This appears already to work. A gotcha arises because GtkBox actually reorders its child nodes in RTL, so that :first-child is always leftmost and so on, whereas other widgets don't. Benjamin argues that's wrong and should be dropped in GTK+ 4. See the result/differences here: https://bug769876.bugzilla-attachments.gnome.org/attachment.cgi?id=347098