ui/gtk/graphics.c

changeset 854
9291921f21c5
parent 848
5a4b72489111
child 978
71446363dcf9
--- a/ui/gtk/graphics.c	Fri Oct 17 15:44:30 2025 +0200
+++ b/ui/gtk/graphics.c	Fri Oct 17 16:02:26 2025 +0200
@@ -77,8 +77,14 @@
     GtkWidget *widget = gtk_drawing_area_new();
     ui_set_name_and_style(widget, args->name, args->style_class);
     
+#if GTK_CHECK_VERSION(4, 0, 0)
     gtk_drawing_area_set_content_width(GTK_DRAWING_AREA(widget), args->width > 0 ? args->width : 100);
     gtk_drawing_area_set_content_height(GTK_DRAWING_AREA(widget), args->height > 0 ? args->height : 100);
+#else
+    int w = args->width > 0 ? args->width : 100;
+    int h = args->height > 0 ? args->height : 100;
+    gtk_widget_set_size_request(widget, w, h);
+#endif
     
     UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end;
     UiLayout layout = UI_ARGS2LAYOUT(args);

mercurial