GtkScrolledWindow not expanding to fit children

What I’m trying to accomplish:

A horizontal ScrolledWindow nested inside a vertical ScrolledWindow. The horizontal ScrolledWindow contains a horizontal Box with a bunch of custom widgets.

I expect the horizontal ScrolledWindow to realize the height of its children and adjust the GtkViewport height accordingly, but that doesn’t happen, instead it gets cut off.

Here’s an example:

The highlighted blue area is what the GTK Inspector shows as the bounds for the child box, but for some reason, the GtkViewport’s bounds aren’t expanding:

Notably, I’ve created a custom widget implementing a custom LayoutManager for those cards inside the Box that set those GtkPictures to be a fixed aspect ratio set by a property, and when I don’t use that custom widget, everything works fine, so it might be a problem with that widget. But I’m not sure if that’s the case or not, since all the bounds are being computed correctly except for the GtkViewport.

Additionally, I’ve set the vscrollbar-policy to GTK_POLICY_NEVER on the ScrolledWindow.

Not sure what else could be the problem, and would appreciate some help.

EDIT: Here’s the source code for anyone who might need more context: src/widgets/gelata_window.rs · rust-port · Brendan Szymanski / Gelata · GitLab

Hi, what happens if you set Gtk.ScrolledWindow.propagate-natural-height?

Doesn’t seem to help unfortunately. This is how I have the layout configured currently for reference: data/gtk/gelata_window.blp · rust-port · Brendan Szymanski / Gelata · GitLab

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.