Blame SOURCES/ghostscript-fix-pxl-devices-printing.patch

629cc8
From af6cb84ce3a0b3c26e064dbf0d7514b9260f2ef2 Mon Sep 17 00:00:00 2001
629cc8
From: Till Kamppeter <till.kamppeter@gmail.com>
629cc8
Date: Fri, 23 Sep 2016 17:17:19 -0300
629cc8
Subject: [PATCH] pxlcolor/pxlmono output devices: Make MediaPosition,
629cc8
 ManualFeed, and MediaType work
629cc8
629cc8
In the pxlcolor and pxlmono output devices (for PCL-XL printers) the
629cc8
support for the attributes MediaPosition, ManualFeed, and MediaType
629cc8
got broken when ESP Ghostscript got merged into GPL Ghostscript (Bug
629cc8
---
629cc8
 base/gdevpx.c | 60 +++++++++++++++++++++++++++++++++++++++--------------------
629cc8
 1 file changed, 40 insertions(+), 20 deletions(-)
629cc8
629cc8
diff --git a/base/gdevpx.c b/base/gdevpx.c
629cc8
index 8647332..82a3af1 100644
629cc8
--- a/base/gdevpx.c
629cc8
+++ b/base/gdevpx.c
629cc8
@@ -1394,12 +1394,6 @@ pclxl_open_device(gx_device * dev)
629cc8
     xdev->media_size = pxeMediaSize_next;	/* no size selected */
629cc8
     memset(&xdev->chars, 0, sizeof(xdev->chars));
629cc8
     xdev->chars.next_in = xdev->chars.next_out = 2;
629cc8
-    xdev->MediaPosition_set = false;
629cc8
-    xdev->MediaType_set = false;
629cc8
-    xdev->MediaPosition_old = eAutoSelect;
629cc8
-    xdev->MediaPosition = eAutoSelect;
629cc8
-    xdev->MediaType_old[0] = '\0';
629cc8
-    xdev->MediaType[0] = '\0';
629cc8
     return 0;
629cc8
 }
629cc8
 
629cc8
@@ -2185,17 +2179,18 @@ pclxl_get_params(gx_device     *dev,	/* I - Device info */
629cc8
   if ((code = param_write_bool(plist, "Duplex", &(xdev->Duplex))) < 0)
629cc8
     return (code);
629cc8
 
629cc8
-  if (xdev->MediaPosition_set)
629cc8
+    if ((code = param_write_bool(plist, "ManualFeed",
629cc8
+                                &(xdev->ManualFeed))) < 0)
629cc8
+        return (code);
629cc8
+
629cc8
     if ((code = param_write_int(plist, "MediaPosition",
629cc8
                                 &(xdev->MediaPosition))) < 0)
629cc8
       return (code);
629cc8
 
629cc8
-  if (xdev->MediaType_set) {
629cc8
     if ((code = param_string_from_string(s, xdev->MediaType)) < 0)
629cc8
       return (code);
629cc8
     if ((code = param_write_string(plist, "MediaType", &s)) < 0)
629cc8
       return (code);
629cc8
-  }
629cc8
 
629cc8
   if ((code = param_write_bool(plist, "Tumble", &(xdev->Tumble))) < 0)
629cc8
     return (code);
629cc8
@@ -2220,6 +2215,10 @@ pclxl_put_params(gx_device     *dev,	/* I - Device info */
629cc8
   int			intval;		/* Integer value */
629cc8
   bool			boolval;	/* Boolean value */
629cc8
   gs_param_string	stringval;	/* String value */
629cc8
+  bool ManualFeed;
629cc8
+  bool ManualFeed_set = false;
629cc8
+  int MediaPosition;
629cc8
+  bool MediaPosition_set = false;
629cc8
 
629cc8
  /*
629cc8
   * Process PCL-XL driver parameters...
629cc8
@@ -2287,15 +2286,19 @@ pclxl_put_params(gx_device     *dev,	/* I - Device info */
629cc8
       if_debug0('|', "round up page count\n");
629cc8
       xdev->page = (xdev->page+1) & ~1 ;
629cc8
     }
629cc8
-  intoption(MediaPosition, "MediaPosition", int)
629cc8
-  if (code == 0) {
629cc8
-    xdev->MediaPosition_set = true;
629cc8
-    /* round up for duplex */
629cc8
-    if (xdev->MediaPosition_old != xdev->MediaPosition) {
629cc8
-      if_debug0('|', "round up page count\n");
629cc8
-      xdev->page = (xdev->page+1) & ~1 ;
629cc8
-      xdev->MediaPosition_old = xdev->MediaPosition;
629cc8
-    }
629cc8
+
629cc8
+  code = param_read_bool(plist, "ManualFeed", &ManualFeed);
629cc8
+  if (code == 0)
629cc8
+      ManualFeed_set = true;
629cc8
+  if (code >= 0) {
629cc8
+      code = param_read_int(plist, "MediaPosition", &MediaPosition);
629cc8
+      if (code == 0)
629cc8
+          MediaPosition_set = true;
629cc8
+      else if (code < 0) {
629cc8
+          if (param_read_null(plist, "MediaPosition") == 0) {
629cc8
+              code = 0;
629cc8
+          }
629cc8
+      }
629cc8
   }
629cc8
   stringoption(MediaType, "MediaType")
629cc8
   if (code == 0) {
629cc8
@@ -2314,8 +2317,25 @@ pclxl_put_params(gx_device     *dev,	/* I - Device info */
629cc8
   * Then process standard page device parameters...
629cc8
   */
629cc8
 
629cc8
-  if ((code = gdev_vector_put_params(dev, plist)) < 0)
629cc8
-    return (code);
629cc8
+  if (code >= 0)
629cc8
+      if ((code = gdev_vector_put_params(dev, plist)) < 0)
629cc8
+          return (code);
629cc8
+
629cc8
+  if (code >= 0) {
629cc8
+      if (ManualFeed_set) {
629cc8
+          xdev->ManualFeed = ManualFeed;
629cc8
+          xdev->ManualFeed_set = true;
629cc8
+      }
629cc8
+      if (MediaPosition_set) {
629cc8
+          xdev->MediaPosition = MediaPosition;
629cc8
+          xdev->MediaPosition_set = true;
629cc8
+          if (xdev->MediaPosition_old != xdev->MediaPosition) {
629cc8
+              if_debug0('|', "round up page count\n");
629cc8
+              xdev->page = (xdev->page+1) & ~1 ;
629cc8
+              xdev->MediaPosition_old = xdev->MediaPosition;
629cc8
+          }
629cc8
+      }
629cc8
+  }
629cc8
 
629cc8
   return (0);
629cc8
 }
629cc8
-- 
629cc8
2.14.3
629cc8