X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/8f32c9e8976417d6040cd48359e999a1e4a3a998..HEAD:/gtk.c diff --git a/gtk.c b/gtk.c index 8452bcd..4222bd4 100644 --- a/gtk.c +++ b/gtk.c @@ -1672,13 +1672,19 @@ static gboolean not_size_allocated_yet(GtkWidget *w) * size allocation. A null widget is already taking up all the * space it ever will.) */ - GtkAllocation a; - if (!w) return FALSE; /* nonexistent widgets aren't a problem */ - gtk_widget_get_allocation(w, &a); - return a.height == 0 || a.width == 0; +#if GTK_CHECK_VERSION(2,18,0) /* skip if no gtk_widget_get_allocation */ + { + GtkAllocation a; + gtk_widget_get_allocation(w, &a); + if (a.height == 0 || a.width == 0) + return TRUE; /* widget exists but has no size yet */ + } +#endif + + return FALSE; } static void try_shrink_drawing_area(frontend *fe) @@ -2649,11 +2655,6 @@ int main(int argc, char **argv) } } - if (*errbuf) { - fputs(errbuf, stderr); - return 1; - } - /* * Special standalone mode for generating puzzle IDs on the * command line. Useful for generating puzzles to be printed @@ -2681,6 +2682,16 @@ int main(int argc, char **argv) char *id; document *doc = NULL; + /* + * If we're in this branch, we should display any pending + * error message from the command line, since GTK isn't going + * to take another crack at making sense of it. + */ + if (*errbuf) { + fputs(errbuf, stderr); + return 1; + } + n = ngenerate; me = midend_new(NULL, &thegame, NULL, NULL);