ui/motif/Grid.c

changeset 913
3012ec57d84a
parent 901
884d70e847a3
child 921
c2b318b93062
--- a/ui/motif/Grid.c	Tue Nov 18 15:56:59 2025 +0100
+++ b/ui/motif/Grid.c	Tue Nov 18 16:47:48 2025 +0100
@@ -438,6 +438,8 @@
     int num_rows_expanding = 0;
     int req_width = w->mywidget.padding_left + w->mywidget.padding_right;
     int req_height = w->mywidget.padding_top + w->mywidget.padding_bottom;
+    int width = w->core.width;
+    int height = w->core.height;
     
     //printf("container width: %d\n", (int)w->core.width);
     
@@ -600,7 +602,7 @@
     
     // how much space can we add to each expanding col/row
     int hexpand = 0;
-    int width_diff = (int)w->core.width - req_width;
+    int width_diff = width - req_width;
     int hexpand2 = 0;
     if(width_diff > 0 && num_cols_expanding > 0) {
         hexpand = width_diff / num_cols_expanding;
@@ -618,7 +620,7 @@
     }
     
     int vexpand = 0;
-    int height_diff = (int)w->core.height - req_height;
+    int height_diff = height - req_height;
     int vexpand2 = 0;
     if(height_diff > 0 && num_rows_expanding > 0) {
         vexpand = height_diff / num_rows_expanding;
@@ -654,7 +656,7 @@
                 }
                 width = cwidth;
             } else {
-                width = c.size - w->mywidget.columnspacing;
+                width = c.size - w->mywidget.columnspacing - constraints->grid.margin_left - constraints->grid.margin_right;
             }
         }
         if(constraints->grid.vfill) {
@@ -667,7 +669,7 @@
                 }
                 height = cheight;
             } else {
-                height = r.size - w->mywidget.rowspacing;
+                height = r.size - w->mywidget.rowspacing - constraints->grid.margin_top - constraints->grid.margin_bottom;
             }
         }
               

mercurial