File ghostscript-8.61-x11.dif of Package ghostscript-library
--- src/gdevx.c
+++ src/gdevx.c 2007-09-26 10:20:40.086961112 +0000
@@ -1039,27 +1039,41 @@ static void
update_do_flush(gx_device_X * xdev)
{
flush_text(xdev);
+ if (xdev->update.box.q.x == min_int_in_fixed || xdev->update.box.q.y == min_int_in_fixed)
+ return;
+ if (xdev->update.box.p.x == max_int_in_fixed || xdev->update.box.p.y == max_int_in_fixed)
+ return;
if (xdev->update.count != 0) {
int x = xdev->update.box.p.x, y = xdev->update.box.p.y;
int w = xdev->update.box.q.x - x, h = xdev->update.box.q.y - y;
+ const gx_device_memory *mdev = NULL;
+
+ /*
+ * Copy from memory image to X server if any.
+ */
+ if (xdev->is_buffered) {
+ /*
+ * The bbox device may have set the target to NULL
+ * temporarily. If this is the case, defer the screen
+ * update.
+ */
+ if (!(mdev = (const gx_device_memory *)xdev->target))
+ return;
+ }
+
+ /*
+ * mdev->width and mdev->height arn't the same as
+ * xdev->width and xdev->height ... at least for gv
+ */
+ if (mdev)
+ fit_fill_xywh(mdev, x, y, w, h);
+ else
+ fit_fill_xywh(xdev, x, y, w, h);
- fit_fill_xywh(xdev, x, y, w, h);
if (w > 0 && h > 0) {
- if (xdev->is_buffered) {
- /* Copy from memory image to X server. */
- const gx_device_memory *mdev =
- (const gx_device_memory *)xdev->target;
-
- /*
- * The bbox device may have set the target to NULL
- * temporarily. If this is the case, defer the screen
- * update.
- */
- if (mdev == NULL)
- return; /* don't reset */
+ if (mdev)
x_copy_image(xdev, mdev->line_ptrs[y], x, mdev->raster,
x, y, w, h);
- }
if (xdev->bpixmap) {
/* Copy from X backing pixmap to screen. */
--- src/gdevxini.c
+++ src/gdevxini.c 2007-08-06 12:36:43.890015000 +0200
@@ -413,6 +413,7 @@ gdev_x_open(gx_device_X * xdev)
xdev->height = xid_height;
xdev->initial_matrix.ty = xdev->height;
} else { /* !xdev->pwin */
+ memset(&xswa, 0, sizeof(XSetWindowAttributes));
xswa.event_mask = ExposureMask;
xswa.background_pixel = xdev->background;
xswa.border_pixel = xdev->borderColor;
@@ -902,7 +903,12 @@ gdev_x_put_params(gx_device * dev, gs_pa
dev->is_open = false;
xdev->IsPageDevice = values.IsPageDevice;
code = gx_default_put_params(dev, plist);
- dev->is_open = values.is_open; /* saved value */
+#if 0 /* bug #274952 */
+ /* Prevent us from preventing the device closure if the size changed, */
+ /* that may require us to rebuild the buffer (see x_set_buffer). */
+ if (xdev->width == values.width && xdev->height == values.height)
+#endif
+ dev->is_open = values.is_open; /* saved value */
if (code < 0) { /* Undo setting of .IsPageDevice */
xdev->IsPageDevice = save_is_page;
return code;