From f4eea795c070e5ddca183bc6ff2e4199e39a5cd1 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 20 Jul 2026 17:36:17 +0300 Subject: gridview: allocate the flowbox via GtkBinLayout so the grid renders (fixes black grid) GgazeGrid is a GtkWidget with a single child (the GtkScrolledWindow holding the GtkFlowBox) but set no layout manager and overrode no measure/size_allocate vfunc, so GTK4 never allocated the child and the grid stayed a 0x0 black area (`Trying to snapshot GtkScrolledWindow without a current allocation`). Add a GtkBinLayout in class_init so the child is sized to fill the grid and the flowbox renders. --- src/gridview.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/gridview.c') diff --git a/src/gridview.c b/src/gridview.c index c8336e8..56267b3 100644 --- a/src/gridview.c +++ b/src/gridview.c @@ -268,9 +268,14 @@ ggaze_grid_finalize(GObject *p_obj) { static void ggaze_grid_class_init(GgazeGridClass *p_klass) { - GObjectClass *p_oc = G_OBJECT_CLASS(p_klass); - p_oc->dispose = ggaze_grid_dispose; - p_oc->finalize = ggaze_grid_finalize; + GObjectClass *p_oc = G_OBJECT_CLASS(p_klass); + GtkWidgetClass *p_wc = GTK_WIDGET_CLASS(p_klass); + p_oc->dispose = ggaze_grid_dispose; + p_oc->finalize = ggaze_grid_finalize; + /* GgazeGrid has a single child (the GtkScrolledWindow holding the + * GtkFlowBox); GtkBinLayout allocates it to fill the grid so the flowbox + * actually gets sized and renders instead of staying a 0x0 black area. */ + gtk_widget_class_set_layout_manager_type(p_wc, GTK_TYPE_BIN_LAYOUT); u_activate_signal = g_signal_new("activate", G_TYPE_FROM_CLASS(p_klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); -- cgit v1.2.3