+static gint
+doc_config_event (GtkWidget *widget, void *ugly)
+{
+ DOC_ROOT *doc = hack_global;
+
+ g_return_val_if_fail (doc, FALSE);
+ g_return_val_if_fail (doc->magic == DOC_ROOT_MAGIC, FALSE);
+
+ if (doc->pixmap)
+ gdk_pixmap_unref(doc->pixmap);
+
+ doc->pixmap = gdk_pixmap_new(widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ -1);
+
+ printf ("Creating pixmap of size %d %d\n",
+ widget->allocation.width, widget->allocation.height);
+ gdk_color_white (gtk_widget_get_default_colormap(), &doc->paper);
+ doc->out = new GOutputDev (doc->pixmap, doc->paper);
+
+ return TRUE;
+}
+
+static gint
+doc_redraw_event (GtkWidget *widget, void *ugly)
+{
+ DOC_ROOT *doc = hack_global;
+
+ g_return_val_if_fail (doc, FALSE);
+ g_return_val_if_fail (doc->magic == DOC_ROOT_MAGIC, FALSE);
+
+ if (doc->out && doc->pdf) {
+ printf ("There are %d pages\n", doc->pdf->getNumPages());
+
+ doc->pdf->displayPage(doc->out, 1, 72, 0, gTrue);
+ gdk_draw_pixmap (widget->window,
+ widget->style->white_gc,
+ doc->pixmap,
+ 0, 0,
+ 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
+
+ } else
+ printf ("Null pointer error %p %p\n", doc->out, doc->pdf);
+
+ return FALSE;
+}
+
+static GBool
+loadFile(GString *fileName)
+{
+ DOC_ROOT *doc = new DOC_ROOT();