Don't directly access widget->allocation

This commit is contained in:
Paul Dicker
2025-03-30 12:04:01 +02:00
committed by Stéphane Lesimple
parent 3967ff3cae
commit eadbf54aae
8 changed files with 36 additions and 25 deletions

View File

@@ -135,22 +135,24 @@ int GuiCurveLogY(Curve *curve, gdouble y) /* not really a log */
***/
void GuiUpdateCurveGeometry(Curve *curve, char *largest_left_label, int right_padding)
{ GtkAllocation *a = &curve->widget->allocation;
{ GtkAllocation a = {0};
int w,h;
gtk_widget_get_allocation(curve->widget, &a);
/* Top and bottom margins */
GuiSetText(curve->layout, curve->leftLabel, &w, &h);
curve->topY = h + 10;
GuiSetText(curve->layout, "0123456789", &w, &h);
curve->bottomY = a->height - h - 10;
curve->bottomY = a.height - h - 10;
/* Left and right margins */
GuiSetText(curve->layout, largest_left_label, &w, &h);
curve->leftX = 5 + 6 + 3 + w;
curve->rightX = a->width - right_padding;
curve->rightX = a.width - right_padding;
/* Add space for the lograithmic curve */