From f396b95d8d10ceb3824bf00405a04b6104fea883 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 22 Dec 2004 20:21:59 +0000 Subject: Fix a few bugs 2004-12-22 Marco Pesenti Gritti * ps/gtkgs.c: (gtk_gs_init), (set_up_page), (ps_document_set_target), (ps_document_get_page_size), (ps_document_render): * ps/gtkgs.h: Fix a few bugs --- diff --git a/ChangeLog b/ChangeLog index a19f3ac..fd32647 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-12-22 Marco Pesenti Gritti + + * ps/gtkgs.c: (gtk_gs_init), (set_up_page), + (ps_document_set_target), (ps_document_get_page_size), + (ps_document_render): + * ps/gtkgs.h: + + Fix a few bugs + 2004-12-22 Christian Rose * configure.ac: Added "sv" to ALL_LINGUAS. diff --git a/ps/gtkgs.c b/ps/gtkgs.c index 3c8ce19..4c895b9 100644 --- a/ps/gtkgs.c +++ b/ps/gtkgs.c @@ -269,7 +269,6 @@ static void gtk_gs_init(GtkGS * gs) { gs->bpixmap = NULL; - gs->use_bpixmap = TRUE; gs->current_page = -2; gs->disable_start = FALSE; @@ -504,6 +503,9 @@ set_up_page(GtkGS * gs) char *savelocale; #endif + if (gs->pstarget == NULL) + return; + /* Do we have to check if the actual geometry changed? */ stop_interpreter(gs); @@ -516,11 +518,9 @@ set_up_page(GtkGS * gs) /* clear new pixmap (set to white) */ fill = gdk_gc_new(gs->pstarget); if(fill) { - //colormap = gtk_widget_get_colormap(GTK_WIDGET(gs)); - //gdk_color_alloc(colormap, &white); gdk_gc_set_foreground(fill, &white); - if(gs->use_bpixmap && gs->width > 0 && gs->height > 0) { + if(gs->width > 0 && gs->height > 0) { if(gs->bpixmap) { gdk_drawable_unref(gs->bpixmap); gs->bpixmap = NULL; @@ -2093,7 +2093,10 @@ static void ps_document_set_target (EvDocument *document, GdkDrawable *target) { - GTK_GS (document)->pstarget = target; + GtkGS *gs = GTK_GS (document); + + gs->pstarget = target; + gtk_gs_goto_page (gs, gs->current_page); } static void @@ -2115,6 +2118,15 @@ ps_document_get_page_size (EvDocument *document, int *width, int *height) { + GtkGS *gs = GTK_GS (document); + + if (width) { + *width = gs->width; + } + + if (height) { + *height = gs->height; + } } static void @@ -2127,6 +2139,11 @@ ps_document_render (EvDocument *document, GtkGS *gs = GTK_GS (document); GdkGC *gc; + if (gs->pstarget == NULL || + gs->bpixmap == NULL) { + return; + } + gc = gdk_gc_new (gs->pstarget); gdk_draw_drawable (gs->pstarget, gc, diff --git a/ps/gtkgs.h b/ps/gtkgs.h index 3ca3701..763c09c 100644 --- a/ps/gtkgs.h +++ b/ps/gtkgs.h @@ -70,7 +70,6 @@ struct _GtkGS { GtkGSZoomMode zoom_mode; GdkPixmap *bpixmap; /* Backing pixmap */ - int use_bpixmap; long message_window; /* Used by ghostview to receive messages from app */ @@ -170,7 +169,6 @@ gboolean gtk_gs_load(GtkGS * gs, const gchar * fname); void gtk_gs_reload(GtkGS * gs); /* control functions */ -void gtk_gs_center_page(GtkGS * gs); gboolean gtk_gs_next_page(GtkGS * gs); gboolean gtk_gs_prev_page(GtkGS * gs); gboolean gtk_gs_goto_page(GtkGS * gs, gint); -- cgit v0.9.1