GtkFlowBox children don't return valid GtkAllocation
I have a vertically organized GtkFlowBox
which is put on a GtkNotebook
page so it's not always visible.
I have added 100 labels to this GtkFlowBox
and I would like to know which child starts to be rendered on a new column.
Since there's no signal for GtkFlowBox
that would indicate breaking over to the next line or column, I thought the easiest way is to get the GtkAllocation of the child widgets:
for (i = 0; i < 100; i++) {
GtkFlowBoxChild *flowboxchild;
GtkWidget *child;
GtkAllocation alloc;
flowboxchild = gtk_flow_box_get_child_at_index(GTK_FLOW_BOX(gui->orderitems), i);
child = gtk_flow_box_child_get_child(flowboxchild);
gtk_widget_get_allocation(child, &alloc);
g_message("child alloc %dx%d+%dx%d", alloc.x, alloc.y, alloc.width, alloc.height);
}
But I get 0x0+0x0
reported for every label and -3x-3+6x6
on the GtkFlowBoxChild
widgets, regardless of their visibility.
I use GTK 4.6.1 on Fedora 35. (I built it from source into rpm.)
Edited by Zoltán Böszörményi