diff --git a/src/curve.c b/src/curve.c index 82d2ea8..18f573c 100644 --- a/src/curve.c +++ b/src/curve.c @@ -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 */ diff --git a/src/help-dialogs.c b/src/help-dialogs.c index 17eaf8c..9bab9f5 100644 --- a/src/help-dialogs.c +++ b/src/help-dialogs.c @@ -235,7 +235,9 @@ void GuiFreeLabelWithOnlineHelp(LabelWithOnlineHelp *lwoh) static gboolean wrapper_fix_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data) { int *last_width = (int*)data; - int label_width = widget->allocation.width; + GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); + int label_width = a.width; if(*last_width == label_width) /* short circuit expose events */ return FALSE; /* without size changes */ diff --git a/src/read-adaptive-window.c b/src/read-adaptive-window.c index 8de2900..ccade53 100644 --- a/src/read-adaptive-window.c +++ b/src/read-adaptive-window.c @@ -158,10 +158,11 @@ static void redraw_spiral(GtkWidget *widget) /* Calculate the geometry of the spiral */ static void update_geometry(GtkWidget *widget) -{ GtkAllocation *a = &widget->allocation; +{ GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); - Closure->readAdaptiveSpiral->mx = a->width - 15 - Closure->readAdaptiveSpiral->diameter / 2; - Closure->readAdaptiveSpiral->my = a->height / 2; + Closure->readAdaptiveSpiral->mx = a.width - 15 - Closure->readAdaptiveSpiral->diameter / 2; + Closure->readAdaptiveSpiral->my = a.height / 2; } /* Expose event handler */ @@ -339,11 +340,12 @@ void GuiResetAdaptiveReadWindow() if(Closure->readAdaptiveDrawingArea->window) { static GdkRectangle rect; - GtkAllocation *a = &Closure->readAdaptiveDrawingArea->allocation; + GtkAllocation a = {0}; + gtk_widget_get_allocation(Closure->readAdaptiveDrawingArea, &a); rect.x = rect.y = 0; - rect.width = a->width; - rect.height = a->height; + rect.width = a.width; + rect.height = a.height; gdk_window_clear(Closure->readAdaptiveDrawingArea->window); gdk_window_invalidate_rect(Closure->readAdaptiveDrawingArea->window, &rect, FALSE); diff --git a/src/read-linear-window.c b/src/read-linear-window.c index 40ebe9b..592e81e 100644 --- a/src/read-linear-window.c +++ b/src/read-linear-window.c @@ -280,7 +280,8 @@ void GuiMarkExistingSectors(void) static void update_geometry(void) { GtkWidget *widget = Closure->readLinearDrawingArea; - GtkAllocation *a = &widget->allocation; + GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); /* Curve geometry */ @@ -289,8 +290,8 @@ static void update_geometry(void) /* Spiral center */ - Closure->readLinearSpiral->mx = a->width - 15 - Closure->readLinearSpiral->diameter / 2; - Closure->readLinearSpiral->my = a->height / 2; + Closure->readLinearSpiral->mx = a.width - 15 - Closure->readLinearSpiral->diameter / 2; + Closure->readLinearSpiral->my = a.height / 2; if(Closure->crcBuf && Closure->crcBuf->crcCached) { int w,h; diff --git a/src/rs01-verify.c b/src/rs01-verify.c index a43e138..698a659 100644 --- a/src/rs01-verify.c +++ b/src/rs01-verify.c @@ -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; diff --git a/src/rs02-verify.c b/src/rs02-verify.c index ac0d677..19f8db6 100644 --- a/src/rs02-verify.c +++ b/src/rs02-verify.c @@ -134,7 +134,8 @@ static void redraw_spiral(RS02Widgets *wl) static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data) { RS02Widgets *wl = (RS02Widgets*)data; - GtkAllocation *a = &widget->allocation; + GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); int w,h,size; /* Finish spiral initialization */ @@ -147,8 +148,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 */ redraw_spiral(wl); /* Redraw the spiral */ diff --git a/src/rs03-verify.c b/src/rs03-verify.c index a11fa72..1bbfcbe 100644 --- a/src/rs03-verify.c +++ b/src/rs03-verify.c @@ -144,7 +144,8 @@ static void redraw_spiral(RS03Widgets *wl) static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data) { RS03Widgets *wl = (RS03Widgets*)data; - GtkAllocation *a = &widget->allocation; + GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); int w,h,size; /* Finish spiral initialization */ @@ -157,8 +158,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 */ redraw_spiral(wl); /* Redraw the spiral */ diff --git a/src/spiral.c b/src/spiral.c index 99b299a..483c3a7 100644 --- a/src/spiral.c +++ b/src/spiral.c @@ -70,12 +70,13 @@ Spiral* GuiCreateSpiral(GdkColor *outline, GdkColor *fill, } void GuiSetSpiralWidget(Spiral *spiral, GtkWidget *widget) -{ GtkAllocation *al = &widget->allocation; +{ GtkAllocation a = {0}; + gtk_widget_get_allocation(widget, &a); if(!spiral->drawable) { spiral->drawable = widget->window; - spiral->mx = al->width/2; - spiral->my = al->height/2; + spiral->mx = a.width/2; + spiral->my = a.height/2; } }