[xorg-commit-diffs] xc/programs/Xserver/Xst Imakefile, NONE, 1.1.4.1 xst.h, NONE, 1.1.4.1 xst_cb.c, NONE, 1.1.4.1 xst_dropins.c, NONE, 1.1.4.1 xst_env.c, NONE, 1.1.4.1 xst_font.c, NONE, 1.1.4.1 xst_gc.c, NONE, 1.1.4.1 xst_glyph.c, NONE, 1.1.4.1 xst_init.c, NONE, 1.1.4.1 xst_line.c, NONE, 1.1.4.1 xst_panoramix.c, NONE, 1.1.4.1 xst_style.c, NONE, 1.1.4.1 xst_text.c, NONE, 1.1.4.1 xststubs.c, NONE, 1.1.4.1

Alexander Gelfenbain xorg-commit at pdx.freedesktop.org
Mon Apr 5 19:41:23 PDT 2004


Committed by: adg

Update of /cvs/xorg/xc/programs/Xserver/Xst
In directory pdx:/tmp/cvs-serv16834/programs/Xserver/Xst

Added Files:
      Tag: XORG-RELEASE-1-STSF
	Imakefile xst.h xst_cb.c xst_dropins.c xst_env.c xst_font.c 
	xst_gc.c xst_glyph.c xst_init.c xst_line.c xst_panoramix.c 
	xst_style.c xst_text.c xststubs.c 
Log Message:
Initial import of XST into the XORG-RELEASE-1-STSF branch

--- NEW FILE: Imakefile ---
XCOMM
XCOMM Copyright 2001, 2002, Sun Microsystems, Inc.
XCOMM All rights reserved.
XCOMM
XCOMM Redistribution and use in source and binary forms, with or without
XCOMM modification, are permitted provided that the following conditions
XCOMM are met:
XCOMM
XCOMM 1. Redistributions of source code must retain the above copyright
XCOMM    notice, this list of conditions and the following disclaimer.
XCOMM
XCOMM 2. Redistributions in binary form must reproduce the above copyright
XCOMM    notice, this list of conditions and the following disclaimer in the
XCOMM    documentation and/or other materials provided with the distribution.
XCOMM
XCOMM 3. Neither the name of Sun Microsystems, Inc. nor the names of its
XCOMM    contributors may be used to endorse or promote products derived from
XCOMM    this software without specific prior written permission.
XCOMM
XCOMM This software is provided "AS IS," without a warranty of any kind.
XCOMM
XCOMM ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
XCOMM INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
XCOMM PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
XCOMM SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
XCOMM LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
XCOMM MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
XCOMM IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
XCOMM PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
XCOMM INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
XCOMM THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
XCOMM SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
XCOMM DAMAGES.
XCOMM
XCOMM You acknowledge that this software is not designed, licensed or intended
XCOMM for use in the design, construction, operation or maintenance of any
XCOMM nuclear facility.
XCOMM
XCOMM

XCOMM @(#)Imakefile	1.8	03/02/05 SMI

#include <Server.tmpl>

       SRCS =   xst_init.c xst_cb.c xst_dropins.c xst_env.c xst_font.c xst_gc.c xst_glyph.c xst_line.c xst_panoramix.c xst_style.c xst_text.c xststubs.c

       OBJS =   xst_init.o xst_cb.o xst_dropins.o xst_env.o xst_font.o xst_gc.o xst_glyph.o xst_line.o xst_panoramix.o xst_style.o xst_text.o xststubs.o

#ifdef XBuildIncDir
X11_INCLUDES= -I$(XBUILDINCDIR)
#else
X11_INCLUDES= -I$(BUILDINCDIR)
#endif

   DDXSRC = $(TOP)/programs/Xserver

   STINC = -I$(TOP)/../stsf

   INCLUDES = -I../include $(X11_INCLUDES) -I$(TOP)/lib/Xst -I$(TOP)/lib -I../hw/sun \
	$(STINC)/interface $(STINC)/stsflib $(STINC)/STClientLibrary/src \
	-I$(TOP)/include/extensions -I $(TOP)/include -I../Xext -I..

EXTRA_DEFINES = $(EXT_DEFINES)

#if defined(SunArchitecture) && defined(SVR4Architecture) && defined(SharedDDX)
ANSICFLAG = -Xa
#define SharedXstRev 1
REQUIREDLIBS = $(STLIB) MathLibrary -lc
SharedLibraryObjectRule()
SharedObjectTarget(SUNWXst,SharedXstRev,$(OBJS),.,.)
InstallSharedObject(SUNWXst,SharedXstRev,$(SERVERMODULES))
InstallNonExecFile(OWconfig.Xst,$(SERVERETC))
#else
NormalLibraryTarget(xst,$(OBJS))
NormalLibraryObjectRule()
LintLibraryTarget(xst,$(SRCS))
NormalLintTarget($(SRCS))
#endif

DependTarget()


--- NEW FILE: xst.h ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* "%W%	%E% SMI" */

#ifndef _XST_H
#define _XST_H

#define DEBUG

#include "st.h"
#include "stsfutil.h"
#include "stprivate.h"
#include "stclprivate.h"

#include <inttypes.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "math.h"
#define Status int
#define Display void
#include "XST.h"
#include "XSTstr.h"
#include <stdio.h>
#include "windowstr.h"
#include "gcstruct.h"
#include "scrnintstr.h"
#include "Xst/Xst_colors.h"
#include "Xst/Xst_alpha.h"
#include "Xst/Xst_fontpath.h"
#include "pixmapstr.h"
#include "servermd.h"
#ifdef sun
#ifndef i386
#include "dpa/sundpascr.h"
#include "dpa/sundpa.h"
#endif
#endif

#define NO_CHANGE 0

#define sz_xGenericReply	32

extern RESTYPE XSTTypeEnvType;
extern RESTYPE XSTFontType;
extern RESTYPE XSTLineType;
extern RESTYPE XSTGlyphVectorType;
extern RESTYPE XSTTextType;
extern RESTYPE XSTGraphicsType;
extern RESTYPE XSTStyleType;

extern unsigned xst_alpha_table[32895];

extern int STgcPrivIndex;
extern int MATRIXgcPrivIndex;

extern PixmapPtr pPix32;
extern PixmapPtr pPix8;

extern GC *gpGC32AA;
extern GC *gpGC32BW;
extern GC *gpGC8BW;

typedef double Rational;

void XSTGetFB ( int );

struct MATRIXgcPrivData {
    STMatrixPtr mtx;
    double      TaMin, TaMax;
    uint32_t    TaTable[256];
    int         TaDirty;
    double      HLaMin, HLaMax;
    uint32_t    HLaTable[256];
    int         HLaDirty;
    double      UL1aMin, UL1aMax;
    uint32_t    UL1aTable[256];
    int         UL1aDirty;
    double      UL2aMin, UL2aMax;
    uint32_t    UL2aTable[256];
    int         UL2aDirty;
    double      STaMin, STaMax;
    uint32_t    STaTable[256];
    int         STaDirty;
    RegionRec  *r;
};
typedef struct MATRIXgcPrivData *MATRIXgcPrivPtr;

typedef struct {
    DrawablePtr     pDraw;
    ClientPtr       client;
    GC             *pGC;
    uint32_t       *TaTable;
    int             TaDirty;
    uint32_t       *HLaTable;
    int             HLaDirty;
    uint32_t       *UL1aTable;
    int             UL1aDirty;
    uint32_t       *UL2aTable;
    int             UL2aDirty;
    uint32_t       *STaTable;
    int             STaDirty;
    STGraphics      stGr;
    uint32_t        hlbgc;
    MATRIXgcPrivPtr mpriv;
    int             poly;
} STOutputDevicePrivData;

typedef struct {
        short            x;
        short            y;
        short            width;
        short            height;
        short            bytesPerRow;
        unsigned short   bitsPerPixel:15;
        unsigned short   highlighted:1;
        STRenderingMode  mode;
        byte            *source;
        STLookupTable   *clut;
	short            sx;
	short            sy;
} STCacheDataRec, *STCacheDataPtr;
#define STErrorToXError(a)	\
	( a == 0 ? client->noClientException : \
	  ( a + 20 ))

#ifndef swapll
/* byte swap a 64-bit value */
#define swapll(x, n) { \
		n = ((char *) (x))[0];\
		((char *) (x))[0] = ((char *) (x))[7];\
		((char *) (x))[7] = n;\
		n = ((char *) (x))[1];\
		((char *) (x))[1] = ((char *) (x))[6];\
		((char *) (x))[6] = n;\
		n = ((char *) (x))[2];\
		((char *) (x))[2] = ((char *) (x))[5];\
		((char *) (x))[5] = n;\
		n = ((char *) (x))[3];\
		((char *) (x))[3] = ((char *) (x))[4];\
		((char *) (x))[4] = n; }
#endif

#ifndef cpswapll
/* copy 64-bit value from src to dst byteswapping on the way */
#define cpswapll(src, dst) { \
		((char *)&(dst))[0] = ((char *) &(src))[7];\
		((char *)&(dst))[1] = ((char *) &(src))[6];\
		((char *)&(dst))[2] = ((char *) &(src))[5];\
		((char *)&(dst))[3] = ((char *) &(src))[4];\
		((char *)&(dst))[4] = ((char *) &(src))[3];\
		((char *)&(dst))[5] = ((char *) &(src))[2];\
		((char *)&(dst))[6] = ((char *) &(src))[1];\
		((char *)&(dst))[7] = ((char *) &(src))[0]; }
#endif

#endif

--- NEW FILE: xst_cb.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...5364 lines suppressed...]
		    memcpy ( gpSCdata[j], gpCI[i], sizeof ( STCacheDataRec ));
		    break;
		}
	    }
	    else if ( gnCD > 0 )
	    {
		if ( gpCD[i]->source == (byte *)(gpBLTdata[j]) )
	        {
		    memcpy ( gpSCdata[j], gpCD[i], sizeof ( STCacheDataRec ));
		    break;
	        }
	    }
	    else
		break;
	}

	if ( j == k )
	    k++;
    }
}

--- NEW FILE: xst_dropins.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* "@(#)xst_dropins.c	1.148	02/09/09 SMI" */

#include "xst.h"


/*************************************************************************/

static int
ProcSTScalerGetInfo(client)
    register ClientPtr client;
{
    Status                 result = client->noClientException;
    STStatus               st     = -1;
    STTypeEnv   	   stte;
    xSTScalerGetInfoReply *rep;
    int                	   totalBytes;
    long               	   l;
    STTag		   oTag;
    uint32_t		   ver, *oVersion    = NULL;
    STScalerFlags	   sfg, *oSFlags     = NULL;
    STFontMask             ffg, *oFFlags     = NULL;
    const char            *shn, **oShortName = NULL;
    const char            *lgn, **oLongName  = NULL;
    const char            *not, **oNotice    = NULL;
    int                    len_short         = 0;
    int                    len_long          = 0;
    int                    len_notice        = 0;

    REQUEST(xSTScalerGetInfoReq);
    REQUEST_SIZE_MATCH(xSTScalerGetInfoReq);

#ifdef DEBUG
    DebugStr(3, "ProcSTScalerGetInfo: Env = 0x%x, Scaler = 0x%x\n", stuff->Env, stuff->Scaler);
#endif

    stte = (STTypeEnv) SecurityLookupIDByType(client,
      stuff->Env, XSTTypeEnvType, SecurityReadAccess);

    if (!stte) {
        client->errorValue = stuff->Env;
        result             = BadValue;
    } else {
	    if ( stuff->mask & 1 )  oVersion   = &ver;
	    if ( stuff->mask & 2 )  oSFlags    = &sfg;
            if ( stuff->mask & 4 )  oFFlags    = &ffg;
            if ( stuff->mask & 8 )  oShortName = &shn;
            if ( stuff->mask & 16 ) oLongName  = &lgn;
            if ( stuff->mask & 32 ) oNotice    = &not;

	    st = STScalerGetInfo(stte, stuff->Scaler, &oTag, oVersion, oShortName,
				 oLongName, oNotice, oSFlags, oFFlags );
	    if (st != ST_OK) {
		result = STErrorToXError(st);	/* Unknown error! */
	    }
    }

    if ( result == client->noClientException ) {
	if ( oShortName ) len_short  = strlen ( *oShortName );
	if ( oLongName )  len_long   = strlen ( *oLongName );
	if ( oNotice )    len_notice = strlen ( *oNotice );
	totalBytes = sz_xSTScalerGetInfoReply + 3 + len_short + len_long + len_notice;

        totalBytes = (( totalBytes + 3 ) / 4 ) * 4;
    } else {
	totalBytes = sz_xSTScalerGetInfoReply;
    }

    if((rep = (xSTScalerGetInfoReply *)xalloc(totalBytes)) == (xSTScalerGetInfoReply *)NULL)
        return BadAlloc;

    rep->type           = X_Reply;
    rep->sequenceNumber = client->sequence;
    rep->length         = (totalBytes - sz_xGenericReply) >> 2;
    rep->Tag            = 0;
    rep->Version        = 0;
    rep->SFlags         = 0;
    rep->FFlags         = 0;
    rep->ShortNameLen   = len_short;
    rep->LongNameLen    = len_long;
    rep->NoticeLen      = len_notice;

    if (result == client->noClientException) {
        rep->Tag                            = (CARD32)oTag;
        if ( oVersion )   rep->Version      = (CARD32)*oVersion;
        if ( oSFlags )    rep->SFlags       = (CARD32)*oSFlags;
        if ( oFFlags )    rep->FFlags       = (CARD32)*oFFlags;
    }
    if (client->swapped) {
	short s;
        swaps(&(rep->sequenceNumber), s);
        swapl(&(rep->Tag), l);
        swapl(&(rep->Version), l);
        swapl(&(rep->SFlags), l);
        swapl(&(rep->FFlags), l);
        swapl(&(rep->ShortNameLen), l);
        swapl(&(rep->LongNameLen), l);
        swapl(&(rep->NoticeLen), l);
        swapl(&(rep->length), l);
    }

    if ( result == client->noClientException ) {
	if ( oShortName )
	    memcpy(&rep[1], *oShortName, len_short+1);
	if ( oLongName )
	    memcpy(((char *)(&rep[1]))+len_short+1, *oLongName, len_long+1);
	if ( oNotice )
	    memcpy(((char *)(&rep[1]))+len_short+len_long+2, *oNotice, len_notice+1);
    }

    WriteToClient(client, totalBytes, (char *)rep);

    xfree(rep);

    return (result);
}


static int
ProcSTScalerControl(client)
    register ClientPtr client;
{
    Status                 result      = client->noClientException;
    STStatus               st          = ST_OK;
    STTypeEnv   	   stte;
    xSTScalerControlReply *rep         = NULL;
    size_t                 repSize     = sizeof(xSTScalerControlReply);
    STSize                 oCount      = 0;
    void                  *oFromScaler = NULL;

    REQUEST(xSTScalerControlReq);
    REQUEST_AT_LEAST_SIZE(xSTScalerControlReq);

    stte = (STTypeEnv) SecurityLookupIDByType(client,
      stuff->Env, XSTTypeEnvType, SecurityReadAccess);

    if (!stte) {
        client->errorValue = stuff->Env;
        result             = BadValue;
    } else {
        void *iToScaler = (void *)&stuff[1];

        st = STScalerControl(stte, stuff->Scaler, iToScaler, stuff->count, 
                             (const void **)&oFromScaler, &oCount);

        if (st != ST_OK) {
            /* Unknown error! */
            result = STErrorToXError(st);
        }
    }

    repSize += (( oCount + 3 ) / 4 ) * 4;
    rep = (xSTScalerControlReply *) xalloc(repSize);
    if (rep == NULL)
        return BadAlloc;

    rep->type           = X_Reply;
    rep->sequenceNumber = client->sequence;
    rep->count          = 0;
    rep->length = (repSize - sz_xGenericReply) >> 2;

    if ( result == client->noClientException ) {
        rep->count  = oCount;
/***
        memcpy(&rep[sizeof(xSTScalerControlReply)], oFromScaler, oCount);
***/
        memcpy(&rep[1], oFromScaler, oCount);
    }

    if (client->swapped) {
        long l;
        short s;

        swaps(&rep->sequenceNumber, s);
        swapl(&rep->count, l);
        swapl(&rep->length, l);
    }
    WriteToClient(client, repSize, (char *) rep);

    xfree(rep);
    return(result);
}



static int
ProcSTLayoutEngineGetInfo(client)
    register ClientPtr client;
{
    Status                 result = client->noClientException;
    STStatus               st     = -1;
    STTypeEnv   	   stte;
    xSTLayoutEngineGetInfoReply *rep;
    int                	   totalBytes;
    long               	   l;
    STTag		   oTag;
    uint32_t		   ver, *oVersion    = NULL;
    STLayoutEngineFlags	   lfl, *oLEFlags    = NULL;
    const char            *shn, **oShortName = NULL;
    const char            *lgn, **oLongName  = NULL;
    const char            *not, **oNotice    = NULL;
    int                    len_short         = 0;
    int                    len_long          = 0;
    int                    len_notice        = 0;

    REQUEST(xSTLayoutEngineGetInfoReq);
    REQUEST_SIZE_MATCH(xSTLayoutEngineGetInfoReq);

#ifdef DEBUG
    DebugStr(3, "ProcSTLayoutEngineGetInfo: Env = 0x%x, LayoutEngine = 0x%x\n", stuff->Env, stuff->LayoutEngine);
#endif

    stte = (STTypeEnv) SecurityLookupIDByType(client,
      stuff->Env, XSTTypeEnvType, SecurityReadAccess);

    if (!stte) {
        client->errorValue = stuff->Env;
        result             = BadValue;
    } else {
	if ( stuff->mask & 1 )	oVersion   = &ver;
	if ( stuff->mask & 2 )	oLEFlags   = &lfl;
	if ( stuff->mask & 4 )	oShortName = &shn;
	if ( stuff->mask & 8 )	oLongName  = &lgn;
	if ( stuff->mask & 16 )	oNotice    = &not;

	st = STLayoutEngineGetInfo ( stte, stuff->LayoutEngine, &oTag, oVersion, oShortName,
				     oLongName, oNotice, oLEFlags );
	if (st != ST_OK) {
	    result = STErrorToXError(st);	/* Unknown error! */
	}
    }

    if ( result == client->noClientException ) {
	if ( oShortName ) len_short  = strlen ( *oShortName );
	if ( oLongName )  len_long   = strlen ( *oLongName );
	if ( oNotice )    len_notice = strlen ( *oNotice );
	totalBytes = sz_xSTLayoutEngineGetInfoReply + 3 + len_short + len_long + len_notice;

        totalBytes = (( totalBytes + 3 ) / 4 ) * 4;
    } else {
	totalBytes = sz_xSTLayoutEngineGetInfoReply;
    }

    if((rep = (xSTLayoutEngineGetInfoReply *)xalloc(totalBytes)) == (xSTLayoutEngineGetInfoReply *)NULL)
        return BadAlloc;

    rep->type           = X_Reply;
    rep->sequenceNumber = client->sequence;
    rep->length         = (totalBytes - sz_xGenericReply) >> 2;
    rep->Tag            = 0;
    rep->Version        = 0;
    rep->LEFlags        = 0;
    rep->ShortNameLen   = len_short;
    rep->LongNameLen    = len_long;
    rep->NoticeLen      = len_notice;

    if (result == client->noClientException) {
        rep->Tag          = (CARD32)oTag;
	if ( oVersion )   rep->Version      = (CARD32)*oVersion;
        if ( oLEFlags )   rep->LEFlags      = (CARD32)*oLEFlags;
    }
    if (client->swapped) {
	short s;
        swaps(&(rep->sequenceNumber), s);
        swapl(&(rep->Tag), l);
        swapl(&(rep->Version), l);
        swapl(&(rep->LEFlags), l);
        swapl(&(rep->ShortNameLen), l);
        swapl(&(rep->LongNameLen), l);
        swapl(&(rep->NoticeLen), l);
        swapl(&(rep->length), l);
    }

    if ( result == client->noClientException ) {
	if ( oShortName )
	{
	    memcpy(&rep[1], *oShortName, len_short+1);
	}
	if ( oLongName )
	{
	    memcpy(((char *)(&rep[1]))+len_short+1, *oLongName, len_long+1);
        }
        if ( oNotice )
	{
	    memcpy(((char *)(&rep[1]))+len_short+len_long+2, *oNotice, len_notice+1);
	}
    }

    WriteToClient(client, totalBytes, (char *)rep);

    xfree(rep);

    return (result);
}


static int
ProcSTLayoutEngineControl(client)
    register ClientPtr client;
{
    Status                       result      = client->noClientException;
    STStatus                     st          = ST_OK;
    STTypeEnv   	         stte;
    xSTLayoutEngineControlReply *rep         = NULL;
    size_t                       repSize     = sizeof(xSTLayoutEngineControlReply);
    STCount                      oCount      = 0;
    void                        *oFromLayoutEngine = NULL;

    REQUEST(xSTLayoutEngineControlReq);
    REQUEST_AT_LEAST_SIZE(xSTLayoutEngineControlReq);

    stte = (STTypeEnv) SecurityLookupIDByType(client,
      stuff->Env, XSTTypeEnvType, SecurityReadAccess);

    if (!stte) {
        client->errorValue = stuff->Env;
        result             = BadValue;
    } else {
        void *iToLayoutEngine = (void *)&stuff[1];

        st = STLayoutEngineControl(stte, stuff->LayoutEngine, iToLayoutEngine, stuff->count,
                                   (const void **)&oFromLayoutEngine, (STSize *)&oCount);

        if (st != ST_OK) {
            /* Unknown error! */
            result = STErrorToXError(st);
        }
    }

    repSize += (( oCount + 3 ) / 4 ) * 4;
    rep = (xSTLayoutEngineControlReply *) xalloc(repSize);
    if (rep == NULL)
        return BadAlloc;

    rep->type           = X_Reply;
    rep->sequenceNumber = client->sequence;
    rep->count          = 0;
    rep->length = (repSize - sz_xGenericReply) >> 2;

    if ( result == client->noClientException ) {
        rep->count  = oCount;
        memcpy(&rep[1], oFromLayoutEngine, oCount);
    }

    if (client->swapped) {
        long l;
        short s;

        swaps(&rep->sequenceNumber, s);
        swapl(&rep->count, l);
        swapl(&rep->length, l);
    }
    WriteToClient(client, repSize, (char *) rep);

    xfree(rep);
    return(result);
}



void
ProcSTDropinsInit ()
{
    extern int (*ProcSTVector[])(ClientPtr);

    ProcSTVector[X_STScalerGetInfo]       = ProcSTScalerGetInfo;
    ProcSTVector[X_STScalerControl]       = ProcSTScalerControl;
    ProcSTVector[X_STLayoutEngineGetInfo] = ProcSTLayoutEngineGetInfo;
    ProcSTVector[X_STLayoutEngineControl] = ProcSTLayoutEngineControl;
}



static int
SProcSTScalerGetInfo(client)
    register ClientPtr client;
{
    extern int (*ProcSTVector[])(ClientPtr);
    short s;
    long  l;
    REQUEST(xSTScalerGetInfoReq);
    REQUEST_SIZE_MATCH(xSTScalerGetInfoReq);
    swaps(&stuff->length, s);
    swapl(&stuff->Env, l);
    swapl(&stuff->Scaler, l);
    swapl(&stuff->mask, l);

    return (*ProcSTVector[X_STScalerGetInfo])(client);
}


static int
SProcSTScalerControl(client)
    register ClientPtr client;
{
    extern int (*ProcSTVector[])(ClientPtr);
    short s;
    long  l;
    REQUEST(xSTScalerControlReq);
    REQUEST_AT_LEAST_SIZE(xSTScalerControlReq);
    swaps(&stuff->length, s);
    swapl(&stuff->Env, l);
    swapl(&stuff->Scaler, l);
    swapl(&stuff->count, l);

    return (*ProcSTVector[X_STScalerControl])(client);
}



static int
SProcSTLayoutEngineGetInfo(client)
    register ClientPtr client;
{
    extern int (*ProcSTVector[])(ClientPtr);
    short s;
    long  l;
    REQUEST(xSTLayoutEngineGetInfoReq);
    REQUEST_SIZE_MATCH(xSTLayoutEngineGetInfoReq);
    swaps(&stuff->length, s);
    swapl(&stuff->Env, l);
    swapl(&stuff->LayoutEngine, l);
    swapl(&stuff->mask, l);

    return (*ProcSTVector[X_STLayoutEngineGetInfo])(client);
}


static int
SProcSTLayoutEngineControl(client)
    register ClientPtr client;
{
    extern int (*ProcSTVector[])(ClientPtr);
    short s;
    long  l;
    REQUEST(xSTLayoutEngineControlReq);
    REQUEST_AT_LEAST_SIZE(xSTLayoutEngineControlReq);
    swaps(&stuff->length, s);
    swapl(&stuff->Env, l);
    swapl(&stuff->LayoutEngine, l);
    swapl(&stuff->count, l);

    return (*ProcSTVector[X_STLayoutEngineControl])(client);
}



void
SProcSTDropinsInit ()
{
    extern int (*SProcSTVector[])(ClientPtr);

    SProcSTVector[X_STScalerGetInfo]       = SProcSTScalerGetInfo;
    SProcSTVector[X_STScalerControl]       = SProcSTScalerControl;
    SProcSTVector[X_STLayoutEngineGetInfo] = SProcSTLayoutEngineGetInfo;
    SProcSTVector[X_STLayoutEngineControl] = SProcSTLayoutEngineControl;
}

--- NEW FILE: xst_env.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1647 lines suppressed...]
    SProcSTVector[X_STTypeEnvDispose]              = SProcSTTypeEnvDispose;
    SProcSTVector[X_STTypeEnvSetFontFallbackPolicy]= SProcSTTypeEnvSetFontFallbackPolicy;
    SProcSTVector[X_STTypeEnvGetFontFallbackPolicy]= SProcSTTypeEnvGetFontFallbackPolicy;
    SProcSTVector[X_STTypeEnvSetFontFallbacks]     = SProcSTTypeEnvSetFontFallbacks;
    SProcSTVector[X_STTypeEnvGetFontFallbacks]     = SProcSTTypeEnvGetFontFallbacks;
    SProcSTVector[X_STTypeEnvFindFontsByName]      = SProcSTTypeEnvFindFontsByName;
    SProcSTVector[X_STTypeEnvFindFontBySignature]  = SProcSTTypeEnvFindFontBySignature;
    SProcSTVector[X_STTypeEnvCreateFont]           = SProcSTTypeEnvCreateFont;
    SProcSTVector[X_STTypeEnvFindCreateFontFromURI]= SProcSTTypeEnvFindCreateFontFromURI;
    SProcSTVector[X_STTypeEnvDestroyFont]          = SProcSTTypeEnvDestroyFont;
    SProcSTVector[X_STTypeEnvFindAllScalers]       = SProcSTTypeEnvFindAllScalers;
    SProcSTVector[X_STTypeEnvFindScaler]           = SProcSTTypeEnvFindScaler;
    SProcSTVector[X_STTypeEnvFindFontFamily]       = SProcSTTypeEnvFindFontFamily;
    SProcSTVector[X_STTypeEnvGetFontFolders]       = SProcSTTypeEnvGetFontFolders;
    SProcSTVector[X_STTypeEnvSetFontFolders]       = SProcSTTypeEnvSetFontFolders;
    SProcSTVector[X_STTypeEnvGetLocations]         = SProcSTTypeEnvGetLocations;
    SProcSTVector[X_STTypeEnvSetLocations]         = SProcSTTypeEnvSetLocations;
    SProcSTVector[X_STTypeEnvFindAllLayoutEngines] = SProcSTTypeEnvFindAllLayoutEngines;
    SProcSTVector[X_STTypeEnvFindLayoutEngine]     = SProcSTTypeEnvFindLayoutEngine;
}

--- NEW FILE: xst_font.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1269 lines suppressed...]
}


void
SProcSTFontInit ()
{
    extern int (*SProcSTVector[])(ClientPtr);

    SProcSTVector[X_STFontGetNameTags]     = SProcSTFontGetNameTags;
    SProcSTVector[X_STFontGetNameString]   = SProcSTFontGetNameString;
    SProcSTVector[X_STFontGetInfo]         = SProcSTFontGetInfo;
    SProcSTVector[X_STFontGetBaselines]    = SProcSTFontGetBaselines;
    SProcSTVector[X_STFontGetFeatures]     = SProcSTFontGetFeatures;
    SProcSTVector[X_STFontGetFontFamily]   = SProcSTFontGetFontFamily;
    SProcSTVector[X_STFontGetTypefaceName] = SProcSTFontGetTypefaceName;
    SProcSTVector[X_STFontGetSignature]    = SProcSTFontGetSignature;
    SProcSTVector[X_STFontGetData]         = SProcSTFontGetData;
    SProcSTVector[X_STFontFamilyGetName]   = SProcSTFontFamilyGetName;
    SProcSTVector[X_STFontFamilyGetFonts]  = SProcSTFontFamilyGetFonts;
}

--- NEW FILE: xst_gc.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1497 lines suppressed...]
void
SProcSTGCInit ()
{
    extern int (*SProcSTVector[])(ClientPtr);

    SProcSTVector[X_STGCSetColors]       = SProcSTGCSetColors;
    SProcSTVector[X_STGCGetColors]       = SProcSTGCGetColors;
    SProcSTVector[X_STGCSetAlphaRange]   = SProcSTGCSetAlphaRange;
    SProcSTVector[X_STGCGetAlphaRange]   = SProcSTGCGetAlphaRange;
    SProcSTVector[X_STGCGetOutputFormat] = SProcSTGCGetOutputFormat;
    SProcSTVector[X_STGCSetOutputFormat] = SProcSTGCSetOutputFormat;
    SProcSTVector[X_STGCGetMatrix]       = SProcSTGCGetMatrix;
    SProcSTVector[X_STGCSetMatrix]       = SProcSTGCSetMatrix;
    SProcSTVector[X_STGCConcatMatrix]    = SProcSTGCConcatMatrix;
    SProcSTVector[X_STGCTranslate]       = SProcSTGCTranslate;
    SProcSTVector[X_STGCScale]           = SProcSTGCScale;
    SProcSTVector[X_STGCRotate]          = SProcSTGCRotate;
    SProcSTVector[X_STGCShear]           = SProcSTGCShear;
    SProcSTVector[X_STGCSetRegion]       = SProcSTGCSetRegion;
}

--- NEW FILE: xst_glyph.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1164 lines suppressed...]
    return (*ProcSTVector[X_STGlyphVectorRender])(client);
}


void
SProcSTGlyphVectorInit ()
{
    extern int (*SProcSTVector[])(ClientPtr);

    SProcSTVector[X_STGlyphVectorNew]             = SProcSTGlyphVectorNew;
    SProcSTVector[X_STGlyphVectorNewCopy]         = SProcSTGlyphVectorNewCopy;
    SProcSTVector[X_STGlyphVectorDispose]         = SProcSTGlyphVectorDispose;
    SProcSTVector[X_STGlyphVectorGetGlyphs]       = SProcSTGlyphVectorGetGlyphs;
    SProcSTVector[X_STGlyphVectorSetGlyphs]       = SProcSTGlyphVectorSetGlyphs;
    SProcSTVector[X_STGlyphVectorReplaceGlyphs]   = SProcSTGlyphVectorReplaceGlyphs;
    SProcSTVector[X_STGlyphVectorAdjustPositions] = SProcSTGlyphVectorAdjustPositions;
    SProcSTVector[X_STGlyphVectorMeasure]         = SProcSTGlyphVectorMeasure;
    SProcSTVector[X_STGlyphVectorGetBounds]       = SProcSTGlyphVectorGetBounds;
    SProcSTVector[X_STGlyphVectorRender]          = SProcSTGlyphVectorRender;
}

--- NEW FILE: xst_init.c ---
/*
 * Copyright 2001-2003, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1238 lines suppressed...]
	int off = 0;
	STSFSetDebugLevel(&off);
#endif
    }	

#ifdef SUNSOFT
#ifdef PANORAMIX
    if ( !noPanoramiXExtension )
    {
	PanoramiXSTInit ();
    }
#endif
#endif

    pTimer = (OsTimerPtr *)xalloc ( 1 * sizeof ( OsTimerPtr ));
    pTimer[0] = NULL;

    return;
}


--- NEW FILE: xst_line.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1761 lines suppressed...]
    SProcSTVector[X_STLineNewForWidth]      = SProcSTLineNewForWidth;
    SProcSTVector[X_STLineDispose]          = SProcSTLineDispose;
    SProcSTVector[X_STLineGrow]             = SProcSTLineGrow;
    SProcSTVector[X_STLineShrink]           = SProcSTLineShrink;
    SProcSTVector[X_STLineGetOffset]        = SProcSTLineGetOffset;
    SProcSTVector[X_STLineSetMetrics]       = SProcSTLineSetMetrics;
    SProcSTVector[X_STLineGetMetrics]       = SProcSTLineGetMetrics;
    SProcSTVector[X_STLineMeasureText]      = SProcSTLineMeasureText;
    SProcSTVector[X_STLineMeasureTextImage] = SProcSTLineMeasureTextImage;
    SProcSTVector[X_STLineGetGlyphBounds]   = SProcSTLineGetGlyphBounds;
    SProcSTVector[X_STLineHitTest]          = SProcSTLineHitTest;
    SProcSTVector[X_STLinePositionToCaret]  = SProcSTLinePositionToCaret;
    SProcSTVector[X_STLineMoveCaret]        = SProcSTLineMoveCaret;
    SProcSTVector[X_STLineRender]           = SProcSTLineRender;
    SProcSTVector[X_STLineAddHighlight]     = SProcSTLineAddHighlight;
    SProcSTVector[X_STLineRemoveHighlight]  = SProcSTLineRemoveHighlight;
    SProcSTVector[X_STLineGetDesignMetrics] = SProcSTLineGetDesignMetrics;
    SProcSTVector[X_STLineGetHighlights]    = SProcSTLineGetHighlights;
    SProcSTVector[X_STLineGetStyledGlyphs]  = SProcSTLineGetStyledGlyphs;
}

--- NEW FILE: xst_panoramix.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* "@(#)xst_panoramix.c	1.1       03/02/05 SMI" */

#include "xst.h"

static int FreeXSTXinerama (pointer value, XID id);

#ifdef PANORAMIX
#include "panoramiX.h"
#ifdef SUNSOFT
#define PanoramiXRes PanoramiXList
extern int PanoramiXNumScreens;
extern PanoramiXWindow *PanoramiXWinRoot;
extern PanoramiXData *panoramiXdataPtr;
#else
#include "panoramiXsrv.h"
#endif
#endif

/******************* Exported Structures and Varaiables *******************/

extern int  (*ProcSTVector[STNumberRequests])(ClientPtr);

unsigned int panoramiXBaseGC = 0;
RESTYPE      XSTXineramaType = 0;

/********************* Local Structures and Varaiables ********************/

static int (*PanoramiXSaveSTVector[STNumberRequests])(ClientPtr);

static int
FreeXSTXinerama (pointer value, XID id)
{
    free ( value );
    return 1;
}

static int
PanoramiXProcSTLineRender (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refDraw;
    PanoramiXRes *refGC;
    int           j;

    REQUEST(xSTLineRenderReq);
    REQUEST_SIZE_MATCH(xSTLineRenderReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTLineRender: \n" );
#endif

#ifdef SUNSOFT
    if (!(refDraw = find_xid ( stuff->drawable, 0, RT_WINDOW)))
#else
    if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
#endif
        return BadDrawable;

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    panoramiXBaseGC = refGC->info[0].id;

    FOR_NSCREENS_FORWARD(j) 
    {
        stuff->drawable = refDraw->info[j].id;
        stuff->gc       = refGC->info[j].id;

        result = (*PanoramiXSaveSTVector[X_STLineRender]) ( client );

	if ( result != Success )
	    break;
    }

    panoramiXBaseGC = 0;

    return result;
}

static int
PanoramiXProcSTLineGetGlyphBounds (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTLineGetGlyphBoundsReq);
    REQUEST_SIZE_MATCH(xSTLineGetGlyphBoundsReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTLineGetGlyphBounds: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STLineGetGlyphBounds]) ( client );

    return result;
}

static int
PanoramiXProcSTGlyphVectorRender (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refDraw;
    PanoramiXRes *refGC;
    int           j;

    REQUEST(xSTGlyphVectorRenderReq);
    REQUEST_SIZE_MATCH(xSTGlyphVectorRenderReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGlyphVectorRender: \n" );
#endif

#ifdef SUNSOFT
    if (!(refDraw = find_xid ( stuff->drawable, 0, RT_WINDOW)))
#else
    if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
#endif
        return BadDrawable;

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    panoramiXBaseGC = refGC->info[0].id;

    FOR_NSCREENS_FORWARD(j) 
    {
        stuff->drawable = refDraw->info[j].id;
        stuff->gc       = refGC->info[j].id;

        result = (*PanoramiXSaveSTVector[X_STGlyphVectorRender]) ( client );

	if ( result != Success )
	    break;
    }

    panoramiXBaseGC = 0;

    return result;
}

static int
PanoramiXProcSTGlyphVectorGetBounds (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGlyphVectorGetBoundsReq);
    REQUEST_SIZE_MATCH(xSTGlyphVectorGetBoundsReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGlyphVectorGetBounds: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGlyphVectorGetBounds]) ( client );

    return result;
}

static int
PanoramiXProcSTGCSetColors (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCSetColorsReq);
    REQUEST_AT_LEAST_SIZE(xSTGCSetColorsReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCSetColors: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCSetColors]) ( client );

    return result;
}

static int
PanoramiXProcSTGCGetColors (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCGetColorsReq);
    REQUEST_SIZE_MATCH(xSTGCGetColorsReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCGetColors: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCGetColors]) ( client );

    return result;
}

static int
PanoramiXProcSTGCSetAlphaRange (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCSetAlphaRangeReq);
    REQUEST_AT_LEAST_SIZE(xSTGCSetAlphaRangeReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCSetAlphaRange: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCSetAlphaRange]) ( client );

    return result;
}

static int
PanoramiXProcSTGCGetAlphaRange (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCGetAlphaRangeReq);
    REQUEST_SIZE_MATCH(xSTGCGetAlphaRangeReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCGetAlphaRange: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCGetAlphaRange]) ( client );

    return result;
}

static int
PanoramiXProcSTGCSetOutputFormat (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCSetOutputFormatReq);
    REQUEST_SIZE_MATCH(xSTGCSetOutputFormatReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCSetOutputFormat: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCSetOutputFormat]) ( client );

    return result;
}

static int
PanoramiXProcSTGCGetOutputFormat (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCGetOutputFormatReq);
    REQUEST_SIZE_MATCH(xSTGCGetOutputFormatReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCGetOutputFormat: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCGetOutputFormat]) ( client );

    return result;
}

static int
PanoramiXProcSTGCSetMatrix (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCSetMatrixReq);
    REQUEST_SIZE_MATCH(xSTGCSetMatrixReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCSetMatrix: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCSetMatrix]) ( client );

    return result;
}

static int
PanoramiXProcSTGCGetMatrix (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCGetMatrixReq);
    REQUEST_SIZE_MATCH(xSTGCGetMatrixReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCGetMatrix: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCGetMatrix]) ( client );

    return result;
}

static int
PanoramiXProcSTGCConcatMatrix (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCConcatMatrixReq);
    REQUEST_SIZE_MATCH(xSTGCConcatMatrixReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCConcatMatrix: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCConcatMatrix]) ( client );

    return result;
}

static int
PanoramiXProcSTGCTranslate (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCTranslateReq);
    REQUEST_SIZE_MATCH(xSTGCTranslateReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCTranslate: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCTranslate]) ( client );

    return result;
}

static int
PanoramiXProcSTGCRotate (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCRotateReq);
    REQUEST_SIZE_MATCH(xSTGCRotateReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCRotate: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCRotate]) ( client );

    return result;
}

static int
PanoramiXProcSTGCScale (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCScaleReq);
    REQUEST_SIZE_MATCH(xSTGCScaleReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCScale: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCScale]) ( client );

    return result;
}

static int
PanoramiXProcSTGCShear (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCShearReq);
    REQUEST_SIZE_MATCH(xSTGCShearReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCShear: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCShear]) ( client );

    return result;
}

static int
PanoramiXProcSTGCSetRegion (ClientPtr client)
{
    Status        result     = client->noClientException;
    PanoramiXRes *refGC;

    REQUEST(xSTGCSetRegionReq);
    REQUEST_AT_LEAST_SIZE(xSTGCSetRegionReq);

#ifdef DEBUG
    DebugStr ( 3, "PanoramixProcSTGCSetRegion: \n" );
#endif

#ifdef SUNSOFT
    if (!(refGC = find_xid ( stuff->gc, 0, RT_GC)))
#else
    if (!(refGC = (PanoramiXRes *)SecurityLookupIDByClass(
                client, stuff->gc, XRT_GC, SecurityWriteAccess)))
#endif
        return BadGC;

    stuff->gc = refGC->info[0].id;

    result = (*PanoramiXSaveSTVector[X_STGCSetRegion]) ( client );

    return result;
}

void
PanoramiXSTInit ( void )
{
    int i;

    XSTXineramaType = CreateNewResourceType ( FreeXSTXinerama );

    if ( !XSTXineramaType )
    {
#ifdef DEBUG
	DebugStr ( 3, "Could not create ST Xinerama types!\n" );
#endif
        return;
    }

    for ( i = 0; i < STNumberRequests; i++ )
    {
        PanoramiXSaveSTVector[i] = ProcSTVector[i];
    }

    ProcSTVector [X_STLineRender]           = PanoramiXProcSTLineRender;
    ProcSTVector [X_STLineGetGlyphBounds]   = PanoramiXProcSTLineGetGlyphBounds;

    ProcSTVector [X_STGlyphVectorRender]    = PanoramiXProcSTGlyphVectorRender;
    ProcSTVector [X_STGlyphVectorGetBounds] = PanoramiXProcSTGlyphVectorGetBounds;

    ProcSTVector [X_STGCSetColors]          = PanoramiXProcSTGCSetColors;
    ProcSTVector [X_STGCGetColors]          = PanoramiXProcSTGCGetColors;
    ProcSTVector [X_STGCSetAlphaRange]      = PanoramiXProcSTGCSetAlphaRange;
    ProcSTVector [X_STGCGetAlphaRange]      = PanoramiXProcSTGCGetAlphaRange;
    ProcSTVector [X_STGCSetMatrix]          = PanoramiXProcSTGCSetMatrix;
    ProcSTVector [X_STGCGetMatrix]          = PanoramiXProcSTGCGetMatrix;
    ProcSTVector [X_STGCConcatMatrix]       = PanoramiXProcSTGCConcatMatrix;
    ProcSTVector [X_STGCTranslate]          = PanoramiXProcSTGCTranslate;
    ProcSTVector [X_STGCScale]              = PanoramiXProcSTGCScale;
    ProcSTVector [X_STGCRotate]             = PanoramiXProcSTGCRotate;
    ProcSTVector [X_STGCShear]              = PanoramiXProcSTGCShear;
    ProcSTVector [X_STGCSetRegion]          = PanoramiXProcSTGCSetRegion;
    ProcSTVector [X_STGCGetOutputFormat]    = PanoramiXProcSTGCGetOutputFormat;
    ProcSTVector [X_STGCSetOutputFormat]    = PanoramiXProcSTGCSetOutputFormat;
}


--- NEW FILE: xst_style.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1501 lines suppressed...]
    SProcSTVector[X_STStyleCompare]              = SProcSTStyleCompare;
    SProcSTVector[X_STStyleIsEmpty]              = SProcSTStyleIsEmpty;
    SProcSTVector[X_STStyleRemoveAttributes]     = SProcSTStyleRemoveAttributes;
    SProcSTVector[X_STStyleSetFont]              = SProcSTStyleSetFont;
    SProcSTVector[X_STStyleGetFont]              = SProcSTStyleGetFont;
    SProcSTVector[X_STStyleSetScaler]            = SProcSTStyleSetScaler;
    SProcSTVector[X_STStyleGetScaler]            = SProcSTStyleGetScaler;
    SProcSTVector[X_STStyleSetEffects]           = SProcSTStyleSetEffects;
    SProcSTVector[X_STStyleGetEffects]           = SProcSTStyleGetEffects;
    SProcSTVector[X_STStyleResetAttributes]      = SProcSTStyleResetAttributes;
    SProcSTVector[X_STStyleCopyAttributes]       = SProcSTStyleCopyAttributes;
    SProcSTVector[X_STStyleOverwriteAttributes]  = SProcSTStyleOverwriteAttributes;
    SProcSTVector[X_STStyleUnderwriteAttributes] = SProcSTStyleUnderwriteAttributes;
    SProcSTVector[X_STStyleCalculateBaselines]   = SProcSTStyleCalculateBaselines;
    SProcSTVector[X_STStyleGetDesignMetrics]     = SProcSTStyleGetDesignMetrics;
    SProcSTVector[X_STStyleSetOptions]           = SProcSTStyleSetOptions;
    SProcSTVector[X_STStyleGetOptions]           = SProcSTStyleGetOptions;
    SProcSTVector[X_STStyleSetLayoutEngine]      = SProcSTStyleSetLayoutEngine;
    SProcSTVector[X_STStyleGetLayoutEngine]      = SProcSTStyleGetLayoutEngine;
}

--- NEW FILE: xst_text.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...2119 lines suppressed...]
    SProcSTVector[X_STTextGetMetrics]       = SProcSTTextGetMetrics;
    SProcSTVector[X_STTextSetControls]      = SProcSTTextSetControls;
    SProcSTVector[X_STTextGetControls]      = SProcSTTextGetControls;
    SProcSTVector[X_STTextSetFontFallbacks] = SProcSTTextSetFontFallbacks;
    SProcSTVector[X_STTextGetFontFallbacks] = SProcSTTextGetFontFallbacks;
    SProcSTVector[X_STTextCopyAttributes]   = SProcSTTextCopyAttributes;
    SProcSTVector[X_STTextRemoveAttributes] = SProcSTTextRemoveAttributes;
    SProcSTVector[X_STTextResetAttributes]  = SProcSTTextResetAttributes;
    SProcSTVector[X_STTextSetText]          = SProcSTTextSetText;
    SProcSTVector[X_STTextGetText]          = SProcSTTextGetText;
    SProcSTVector[X_STTextUpdate]           = SProcSTTextUpdate;
    SProcSTVector[X_STTextAugmentStyle]     = SProcSTTextAugmentStyle;
    SProcSTVector[X_STTextOverwriteStyle]   = SProcSTTextOverwriteStyle;
    SProcSTVector[X_STTextUnderwriteStyle]  = SProcSTTextUnderwriteStyle;
    SProcSTVector[X_STTextSetStyle]         = SProcSTTextSetStyle;
    SProcSTVector[X_STTextGetStyle]         = SProcSTTextGetStyle;
    SProcSTVector[X_STTextGetCommonStyle]   = SProcSTTextGetCommonStyle;
    SProcSTVector[X_STTextFindMissingChars] = SProcSTTextFindMissingChars;
    SProcSTVector[X_STTextGetStyledGlyphs]  = SProcSTTextGetStyledGlyphs;
}

--- NEW FILE: xststubs.c ---
/*
 * Copyright (c) 2001 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#pragma ident   "@(#)xststubs.c	1.2	01/08/27 SMI"

typedef int Bool;

#define FALSE 0
#define TRUE !FALSE

Bool STSupported()
{
    return TRUE;
}




More information about the xorg-commit-diffs mailing list