2003-11-14 16:54:54 +01:00
|
|
|
/* $Xorg: PsInit.c,v 1.4 2001/02/09 02:04:36 xorgcvs Exp $ */
|
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright 1996, 1998 The Open Group
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall not be
|
|
|
|
used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
in this Software without prior written authorization from The Open Group.
|
|
|
|
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* (c) Copyright 1996 Hewlett-Packard Company
|
|
|
|
* (c) Copyright 1996 International Business Machines Corp.
|
|
|
|
* (c) Copyright 1996 Sun Microsystems, Inc.
|
|
|
|
* (c) Copyright 1996 Novell, Inc.
|
|
|
|
* (c) Copyright 1996 Digital Equipment Corp.
|
|
|
|
* (c) Copyright 1996 Fujitsu Limited
|
|
|
|
* (c) Copyright 1996 Hitachi, Ltd.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject
|
|
|
|
* to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the names of the copyright holders
|
|
|
|
* shall not be used in advertising or otherwise to promote the sale, use
|
|
|
|
* or other dealings in this Software without prior written authorization
|
|
|
|
* from said copyright holders.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
**
|
|
|
|
** *********************************************************
|
|
|
|
** *
|
|
|
|
** * File: PsInit.c
|
|
|
|
** *
|
|
|
|
** * Contents: Initialization code of Ps driver for the print server.
|
|
|
|
** *
|
|
|
|
** * Created By: Roger Helmendach (Liberty Systems)
|
|
|
|
** *
|
|
|
|
** * Copyright: Copyright 1996 The Open Group, Inc.
|
|
|
|
** *
|
|
|
|
** *********************************************************
|
2004-04-23 21:54:30 +02:00
|
|
|
**
|
2003-11-14 16:54:54 +01:00
|
|
|
********************************************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2003-11-14 17:49:22 +01:00
|
|
|
#include <unistd.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
|
|
|
#include "Ps.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "mi.h"
|
2004-04-26 13:07:03 +02:00
|
|
|
#include "micmap.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "AttrValid.h"
|
|
|
|
#include "../../mfb/mfb.h"
|
|
|
|
|
|
|
|
#include "windowstr.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "DiPrint.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
static void AllocatePsPrivates(ScreenPtr pScreen);
|
|
|
|
static int PsInitContext(XpContextPtr pCon);
|
2003-11-14 17:49:22 +01:00
|
|
|
static int PsDestroyContext(XpContextPtr pCon);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
extern Bool cfbCreateDefColormap(ScreenPtr pScreen);
|
|
|
|
|
|
|
|
int PsScreenPrivateIndex;
|
|
|
|
int PsContextPrivateIndex;
|
|
|
|
int PsPixmapPrivateIndex;
|
|
|
|
int PsWindowPrivateIndex;
|
|
|
|
|
2004-04-26 13:07:03 +02:00
|
|
|
#ifdef GLXEXT
|
|
|
|
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
|
|
|
#endif /* GLXEXT */
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
Bool
|
|
|
|
InitializePsDriver(ndx, pScreen, argc, argv)
|
|
|
|
int ndx;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
{
|
2003-11-25 20:29:01 +01:00
|
|
|
#if 0
|
2004-04-23 21:54:30 +02:00
|
|
|
int maxXres, maxYres, maxWidth, maxHeight;
|
|
|
|
int maxRes, maxDim, numBytes;
|
2003-11-14 16:54:54 +01:00
|
|
|
PsScreenPrivPtr pPriv;
|
2003-11-25 20:29:01 +01:00
|
|
|
#endif
|
2004-04-23 21:54:30 +02:00
|
|
|
char **printerNames;
|
|
|
|
int numPrinters;
|
2003-11-14 16:54:54 +01:00
|
|
|
int nVisuals;
|
|
|
|
int nDepths;
|
|
|
|
VisualPtr visuals;
|
|
|
|
DepthPtr depths;
|
2004-04-26 13:07:03 +02:00
|
|
|
VisualID defaultVisual;
|
|
|
|
int rootDepth;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register this driver's InitContext function with the print
|
|
|
|
* extension.
|
|
|
|
*/
|
|
|
|
XpRegisterInitFunc(pScreen, "XP-POSTSCRIPT", PsInitContext);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create and fill in the devPrivate for the PS driver.
|
|
|
|
*/
|
|
|
|
AllocatePsPrivates(pScreen);
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
#if 0
|
2003-11-14 16:54:54 +01:00
|
|
|
pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr;
|
2003-11-25 20:29:01 +01:00
|
|
|
pPriv->resDB = rmdb;
|
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
pScreen->defColormap = (Colormap) FakeClientID(0);
|
|
|
|
pScreen->blackPixel = 1;
|
|
|
|
pScreen->whitePixel = 0;
|
|
|
|
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
|
2003-11-14 17:49:22 +01:00
|
|
|
pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
|
|
|
|
pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
|
|
|
|
pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
|
2003-11-14 16:54:54 +01:00
|
|
|
pScreen->CreateWindow = PsCreateWindow;
|
|
|
|
pScreen->DestroyWindow = PsDestroyWindow;
|
|
|
|
pScreen->PositionWindow = PsPositionWindow;
|
|
|
|
pScreen->ChangeWindowAttributes = PsChangeWindowAttributes;
|
|
|
|
pScreen->RealizeWindow = PsMapWindow;
|
|
|
|
pScreen->UnrealizeWindow = PsUnmapWindow;
|
|
|
|
pScreen->PaintWindowBackground = PsPaintWindow;
|
|
|
|
pScreen->PaintWindowBorder = PsPaintWindow;
|
|
|
|
pScreen->CloseScreen = PsCloseScreen;
|
|
|
|
pScreen->CopyWindow = PsCopyWindow;
|
|
|
|
/* XXX Hard routine to write! */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These two are going to be VERY different...
|
|
|
|
*/
|
|
|
|
pScreen->CreatePixmap = PsCreatePixmap;
|
|
|
|
pScreen->DestroyPixmap = PsDestroyPixmap;
|
|
|
|
pScreen->RealizeFont = PsRealizeFont;
|
|
|
|
pScreen->UnrealizeFont = PsUnrealizeFont;
|
|
|
|
pScreen->CreateGC = PsCreateGC;
|
|
|
|
pScreen->CreateColormap = PsCreateColormap;
|
|
|
|
pScreen->DestroyColormap = PsDestroyColormap;
|
|
|
|
pScreen->InstallColormap = PsInstallColormap;
|
|
|
|
pScreen->UninstallColormap = PsUninstallColormap;
|
|
|
|
pScreen->ListInstalledColormaps = PsListInstalledColormaps;
|
|
|
|
pScreen->StoreColors = PsStoreColors;
|
|
|
|
pScreen->ResolveColor = PsResolveColor;
|
|
|
|
/* Will BitmapToRegion make any difference at all? */
|
|
|
|
pScreen->BitmapToRegion = mfbPixmapToRegion;
|
|
|
|
|
|
|
|
nVisuals = 2;
|
|
|
|
nDepths = 2;
|
|
|
|
visuals = (VisualPtr)xalloc(nVisuals*sizeof(VisualRec));
|
|
|
|
depths = (DepthPtr) xalloc(nDepths*sizeof(DepthRec));
|
|
|
|
|
|
|
|
visuals[0].vid = FakeClientID(0);
|
|
|
|
visuals[0].class = TrueColor;
|
|
|
|
visuals[0].bitsPerRGBValue = 8;
|
|
|
|
visuals[0].ColormapEntries = 256;
|
|
|
|
visuals[0].nplanes = 24;
|
|
|
|
visuals[0].redMask = 0x00FF0000;
|
|
|
|
visuals[0].greenMask = 0x0000FF00;
|
|
|
|
visuals[0].blueMask = 0x000000FF;
|
|
|
|
visuals[0].offsetRed = 16;
|
|
|
|
visuals[0].offsetGreen = 8;
|
|
|
|
visuals[0].offsetBlue = 0;
|
|
|
|
|
|
|
|
visuals[1].vid = FakeClientID(0);
|
|
|
|
visuals[1].class = PseudoColor;
|
2004-04-23 21:54:30 +02:00
|
|
|
visuals[1].bitsPerRGBValue = 8;
|
2003-11-14 16:54:54 +01:00
|
|
|
visuals[1].ColormapEntries = 256;
|
|
|
|
visuals[1].nplanes = 8;
|
|
|
|
visuals[1].redMask = 0x0;
|
|
|
|
visuals[1].greenMask = 0x0;
|
|
|
|
visuals[1].blueMask = 0x0;
|
|
|
|
visuals[1].offsetRed = 0x0;
|
|
|
|
visuals[1].offsetGreen = 0x0;
|
|
|
|
visuals[1].offsetBlue = 0x0;
|
|
|
|
|
|
|
|
depths[0].depth = 24;
|
|
|
|
depths[0].numVids = 1;
|
2004-04-26 13:07:03 +02:00
|
|
|
depths[0].vids = (VisualID *)xalloc(sizeof(VisualID));
|
|
|
|
depths[0].vids[0] = visuals[0].vid;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
depths[1].depth = 8;
|
|
|
|
depths[1].numVids = 1;
|
2004-04-26 13:07:03 +02:00
|
|
|
depths[1].vids = (VisualID *)xalloc(sizeof(VisualID));
|
|
|
|
depths[1].vids[0] = visuals[1].vid;
|
|
|
|
|
|
|
|
/* Defaul visual is 8bit PseudoColor */
|
|
|
|
defaultVisual = visuals[1].vid;
|
|
|
|
rootDepth = visuals[1].nplanes;
|
|
|
|
|
|
|
|
#ifdef GLXEXT
|
|
|
|
{
|
|
|
|
miInitVisualsProcPtr proc = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2004-04-26 13:07:03 +02:00
|
|
|
GlxWrapInitVisuals(&proc);
|
|
|
|
/* GlxInitVisuals ignores the last three arguments. */
|
|
|
|
proc(&visuals, &depths, &nVisuals, &nDepths,
|
|
|
|
&rootDepth, &defaultVisual, 0, 0, 0);
|
|
|
|
}
|
|
|
|
#endif /* GLXEXT */
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
miScreenInit(pScreen, (pointer)0,
|
2004-04-26 13:07:03 +02:00
|
|
|
pScreen->width, pScreen->height,
|
|
|
|
(int) (pScreen->width / (pScreen->mmWidth / 25.40)),
|
|
|
|
(int) (pScreen->height / (pScreen->mmHeight / 25.40)),
|
|
|
|
0, rootDepth, nDepths,
|
|
|
|
depths, defaultVisual, nVisuals, visuals);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
|
|
|
|
|
|
|
|
/*scalingScreenInit(pScreen);*/
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
AllocatePsPrivates(ScreenPtr pScreen)
|
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
static unsigned long PsGeneration = 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
if((unsigned long)PsGeneration != serverGeneration)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
PsScreenPrivateIndex = AllocateScreenPrivateIndex();
|
|
|
|
|
|
|
|
PsWindowPrivateIndex = AllocateWindowPrivateIndex();
|
|
|
|
AllocateWindowPrivate(pScreen, PsWindowPrivateIndex,
|
|
|
|
sizeof(PsWindowPrivRec));
|
|
|
|
|
|
|
|
PsContextPrivateIndex = XpAllocateContextPrivateIndex();
|
2004-04-23 21:54:30 +02:00
|
|
|
XpAllocateContextPrivate(PsContextPrivateIndex,
|
2003-11-14 16:54:54 +01:00
|
|
|
sizeof(PsContextPrivRec));
|
|
|
|
|
|
|
|
PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
|
|
|
|
AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
|
|
|
|
sizeof(PsPixmapPrivRec));
|
|
|
|
|
|
|
|
PsGeneration = serverGeneration;
|
|
|
|
}
|
|
|
|
pScreen->devPrivates[PsScreenPrivateIndex].ptr =
|
|
|
|
(pointer)xalloc(sizeof(PsScreenPrivRec));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PsInitContext
|
|
|
|
*
|
|
|
|
* Establish the appropriate values for a PrintContext used with the PS
|
|
|
|
* driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static char DOC_ATT_SUPP[]="document-attributes-supported";
|
|
|
|
static char DOC_ATT_VAL[]="document-format";
|
|
|
|
static char JOB_ATT_SUPP[]="job-attributes-supported";
|
|
|
|
static char JOB_ATT_VAL[]="";
|
|
|
|
static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
|
|
|
|
static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
|
|
|
|
default-input-tray default-medium plex";
|
|
|
|
|
|
|
|
static int
|
|
|
|
PsInitContext(pCon)
|
|
|
|
XpContextPtr pCon;
|
|
|
|
{
|
|
|
|
XpDriverFuncsPtr pFuncs;
|
|
|
|
PsContextPrivPtr pConPriv;
|
|
|
|
char *server, *attrStr;
|
2004-04-23 21:54:30 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* Initialize the attribute store for this printer.
|
|
|
|
*/
|
|
|
|
XpInitAttributes(pCon);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the function pointers
|
|
|
|
*/
|
|
|
|
pFuncs = &(pCon->funcs);
|
|
|
|
pFuncs->StartJob = PsStartJob;
|
|
|
|
pFuncs->EndJob = PsEndJob;
|
|
|
|
pFuncs->StartDoc = PsStartDoc;
|
|
|
|
pFuncs->EndDoc = PsEndDoc;
|
|
|
|
pFuncs->StartPage = PsStartPage;
|
|
|
|
pFuncs->EndPage = PsEndPage;
|
|
|
|
pFuncs->PutDocumentData = PsDocumentData;
|
|
|
|
pFuncs->GetDocumentData = PsGetDocumentData;
|
2003-11-14 17:49:22 +01:00
|
|
|
pFuncs->GetAttributes = PsGetAttributes;
|
|
|
|
pFuncs->SetAttributes = PsSetAttributes;
|
|
|
|
pFuncs->AugmentAttributes = PsAugmentAttributes;
|
|
|
|
pFuncs->GetOneAttribute = PsGetOneAttribute;
|
2003-11-14 16:54:54 +01:00
|
|
|
pFuncs->DestroyContext = PsDestroyContext;
|
|
|
|
pFuncs->GetMediumDimensions = PsGetMediumDimensions;
|
|
|
|
pFuncs->GetReproducibleArea = PsGetReproducibleArea;
|
|
|
|
pFuncs->SetImageResolution = PsSetImageResolution;
|
2004-04-23 21:54:30 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* Set up the context privates
|
|
|
|
*/
|
|
|
|
pConPriv =
|
|
|
|
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
|
|
|
|
2004-04-23 21:54:30 +02:00
|
|
|
memset(pConPriv, 0, sizeof(PsContextPrivRec));
|
|
|
|
pConPriv->jobFileName = (char *)NULL;
|
|
|
|
pConPriv->pJobFile = (FILE *)NULL;
|
|
|
|
pConPriv->dash = (unsigned char *)NULL;
|
|
|
|
pConPriv->validGC = 0;
|
|
|
|
pConPriv->getDocClient = (ClientPtr)NULL;
|
|
|
|
pConPriv->getDocBufSize = 0;
|
|
|
|
pConPriv->pPsOut = NULL;
|
|
|
|
pConPriv->fontInfoRecords = NULL;
|
|
|
|
pConPriv->fontTypeInfoRecords = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* document-attributes-supported
|
|
|
|
*/
|
|
|
|
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
|
|
|
|
if ((attrStr = (char *) xalloc(strlen(server) +
|
|
|
|
strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
|
2004-04-23 21:54:30 +02:00
|
|
|
+ strlen(PAGE_ATT_VAL) + 6)) == NULL)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2004-04-23 21:54:30 +02:00
|
|
|
sprintf(attrStr, "*%s:\t%s %s %s",
|
2003-11-14 16:54:54 +01:00
|
|
|
DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
|
|
|
|
XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
|
|
|
|
xfree(attrStr);
|
2004-04-23 21:54:30 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* job-attributes-supported
|
|
|
|
*/
|
|
|
|
server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
|
|
|
|
if ((attrStr = (char *) xalloc(strlen(server) + strlen(JOB_ATT_SUPP) +
|
|
|
|
strlen(JOB_ATT_VAL) + 4)) == NULL)
|
|
|
|
{
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
|
|
|
|
XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
|
|
|
|
xfree(attrStr);
|
2004-04-23 21:54:30 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* xp-page-attributes-supported
|
|
|
|
*/
|
|
|
|
server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
|
|
|
|
if ((attrStr = (char *) xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) +
|
|
|
|
strlen(PAGE_ATT_VAL) + 4)) == NULL)
|
|
|
|
{
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
sprintf(attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL);
|
|
|
|
XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
|
|
|
|
xfree(attrStr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Validate the attribute pools
|
|
|
|
*/
|
|
|
|
XpValidateAttributePool(pCon, XPPrinterAttr, &PsValidatePoolsRec);
|
|
|
|
XpValidateAttributePool(pCon, XPDocAttr, &PsValidatePoolsRec);
|
|
|
|
XpValidateAttributePool(pCon, XPJobAttr, &PsValidatePoolsRec);
|
|
|
|
XpValidateAttributePool(pCon, XPPageAttr, &PsValidatePoolsRec);
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
PsDestroyContext(pCon)
|
|
|
|
XpContextPtr pCon;
|
|
|
|
{
|
|
|
|
PsContextPrivPtr pConPriv =
|
|
|
|
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
2004-04-23 21:54:30 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if( pConPriv->pJobFile!=(FILE *)NULL )
|
|
|
|
{
|
|
|
|
fclose(pConPriv->pJobFile);
|
|
|
|
pConPriv->pJobFile = NULL;
|
|
|
|
}
|
|
|
|
if( pConPriv->jobFileName!=(char *)NULL )
|
|
|
|
{
|
|
|
|
unlink(pConPriv->jobFileName);
|
|
|
|
xfree(pConPriv->jobFileName);
|
|
|
|
pConPriv->jobFileName = (char *)NULL;
|
|
|
|
}
|
|
|
|
|
2004-04-23 21:54:30 +02:00
|
|
|
PsFreeFontInfoRecords(pConPriv);
|
|
|
|
|
|
|
|
/* Reset context to make sure we do not use any stale/invalid/obsolete data */
|
|
|
|
memset(pConPriv, 0, sizeof(PsContextPrivRec));
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*### free up visuals/depths ###*/
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
XpContextPtr
|
|
|
|
PsGetContextFromWindow(win)
|
|
|
|
WindowPtr win;
|
|
|
|
{
|
|
|
|
PsWindowPrivPtr pPriv;
|
|
|
|
|
|
|
|
while( win )
|
|
|
|
{
|
|
|
|
pPriv = (PsWindowPrivPtr)win->devPrivates[PsWindowPrivateIndex].ptr;
|
|
|
|
if( pPriv->validContext ) return pPriv->context;
|
|
|
|
win = win->parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|