Gtk 4.12.3
GtkScrolledWindow::vscrollvar-policy = never
GtkGridView::vscroll-policy = natural
The problem occurs in the gtk_grid_view_measure function.
gridview does not receive the for_size value, so it cannot calculate how much width the child should occupy like _size_allocate does, and use the width to calculate the height of the child.
If you set the child’s min-width to the currently allocated width via css at this time, everything will work fine. This also verifies the above point
However, when GtkScrolledWindow uses GTK_POLICY_AUTOMATIC, everything returns to normal.
The question I asked doesn’t appear and I can’t figure out what the problem is.
log
>## LxBaseWidgetSimple(0x555559046340) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: 960, orientation: 1
>
>## LxSearchPageSonglistViewport(0x555559225b50) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: -1, orientation: 1
>
>## LxGeneralDataGridView(0x555558950d10) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: -1, orientation: 1
// There are two more widgets here
scrolledwindow > gridview
>
>## LxSonglistInfoCard(0x5555592385d0) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: -1, orientation: 0
>LxHoverImage:: minimum: 100, natural: 100
>GtkLabel:: minimum: 12, natural: 96
>GtkLabel:: minimum: 12, natural: 65
>
>minimum: 100, natural: 100
>## LxSonglistInfoCard(0x5555592385d0) <<<<<<<<<<<<<<<<<<<<<<<<
>
>
>## LxSonglistInfoCard(0x5555592385d0) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: 100, orientation: 1
>LxHoverImage:: minimum: 100, natural: 100
>GtkLabel:: minimum: 18, natural: 18
>GtkLabel:: minimum: 18, natural: 18
>
// The wrong height is reported here.
>minimum: 136, natural: 136
>## LxSonglistInfoCard(0x5555592385d0) <<<<<<<<<<<<<<<<<<<<<<<<
>
>
>minimum: 152, natural: 152
>## LxGeneralDataGridView(0x555558950d10) <<<<<<<<<<<<<<<<<<<<<<<<
>
>
>minimum: 152, natural: 152
>## LxSearchPageSonglistViewport(0x555559225b50) <<<<<<<<<<<<<<<<<<<<<<<<
>
>
>minimum: 1136, natural: 1136
>## LxBaseWidgetSimple(0x555559046340) <<<<<<<<<<<<<<<<<<<<<<<<
>
// in gtk_grid_view_size_allocate:
Since the gridview already has a width and height at this point,
it can be passed to the child widget as for_size.
So the child widget will be assigned the correct dimensions.
>
>## LxSonglistInfoCard(0x5555592385d0) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: -1, orientation: 0
>LxHoverImage:: minimum: 100, natural: 100
>GtkLabel:: minimum: 12, natural: 96
>GtkLabel:: minimum: 12, natural: 65
>
>minimum: 100, natural: 100
>## LxSonglistInfoCard(0x5555592385d0) <<<<<<<<<<<<<<<<<<<<<<<<
>
>
>## LxSonglistInfoCard(0x5555592385d0) >>>>>>>>>>>>>>>>>>>>>>>>
>for_size: 134, orientation: 1
>LxHoverImage:: minimum: 134, natural: 134
>GtkLabel:: minimum: 18, natural: 18
>GtkLabel:: minimum: 18, natural: 18
>
// This is the correct height
>minimum: 170, natural: 170
>## LxSonglistInfoCard(0x5555592385d0) <<<<<<<<<<<<<<<<<<<<<<<<
>