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

@@ -141,7 +141,8 @@ static void redraw_spiral(RS01Widgets *wl)
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{ RS01Widgets *wl = (RS01Widgets*)data;
GtkAllocation *a = &widget->allocation;
GtkAllocation a = {0};
gtk_widget_get_allocation(widget, &a);
int w,h,size;
/* Finish spiral initialization */
@@ -154,8 +155,8 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
GuiSetText(wl->cmpLayout, _("Missing sectors"), &w, &h);
size = wl->cmpSpiral->diameter + 20 + 3*(10+h); /* approx. size of spiral + labels */
wl->cmpSpiral->mx = a->width / 2;
wl->cmpSpiral->my = (wl->cmpSpiral->diameter + a->height - size)/2;
wl->cmpSpiral->mx = a.width / 2;
wl->cmpSpiral->my = (wl->cmpSpiral->diameter + a.height - size)/2;
if(event->count) /* Exposure compression */
{ return TRUE;