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

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