# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1727020877 -7200
# Node ID d554b2a601053fab9910d5ee361d64283cdc00b1
# Parent  dc8b504604f4eb10810ca486aeff511a1f6ba5e5
fix gtk box margin

diff -r dc8b504604f4 -r d554b2a60105 application/main.c
--- a/application/main.c	Sun Sep 22 17:54:33 2024 +0200
+++ b/application/main.c	Sun Sep 22 18:01:17 2024 +0200
@@ -108,11 +108,12 @@
     MyDocument *doc = create_doc();
     ui_attach_document(obj->ctx, doc);
     
-    ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button);
-    ui_togglebutton(obj, .label = "Toggle");
-    ui_checkbox(obj, .label = "My Checkbox");
-    
-    ui_grid(obj, .fill = 1, .columnspacing = 15, .rowspacing = 15, .margin = 15) {
+    ui_vbox(obj, .fill = UI_OFF, .margin = 15, .spacing = 15) {
+        ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button);
+        ui_togglebutton(obj, .label = "Toggle");
+        ui_checkbox(obj, .label = "My Checkbox");
+    }
+    ui_grid(obj, .fill = UI_OFF, .columnspacing = 15, .rowspacing = 15, .margin = 15) {
         ui_button(obj, .label = "cell1", .hexpand = TRUE);
         ui_button(obj, .label = "cell2");
         ui_newline(obj);
diff -r dc8b504604f4 -r d554b2a60105 ui/gtk/container.c
--- a/ui/gtk/container.c	Sun Sep 22 17:54:33 2024 +0200
+++ b/ui/gtk/container.c	Sun Sep 22 18:01:17 2024 +0200
@@ -249,8 +249,8 @@
 
 static GtkWidget* box_set_margin(GtkWidget *box, int margin) {
     GtkWidget *ret = box;
-#ifdef UI_GTK3
-#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 12
+#if GTK_MAJOR_VERSION >= 3
+#if GTK_MAJOR_VERSION * 1000 + GTK_MINOR_VERSION >= 3012
     gtk_widget_set_margin_start(box, margin);
     gtk_widget_set_margin_end(box, margin);
 #else
@@ -303,7 +303,7 @@
     GtkWidget *grid = gtk_grid_new();
     gtk_grid_set_column_spacing(GTK_GRID(grid), args.columnspacing);
     gtk_grid_set_row_spacing(GTK_GRID(grid), args.rowspacing);
-#if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 12
+#if GTK_MAJOR_VERSION * 1000 + GTK_MINOR_VERSION >= 3012
     gtk_widget_set_margin_start(grid, args.margin);
     gtk_widget_set_margin_end(grid, args.margin);
 #else