XFree86 4.3.0.1

This commit is contained in:
Kaleb Keithley 2003-11-14 16:49:22 +00:00
parent 9508a382f8
commit d568221710
438 changed files with 42990 additions and 37822 deletions

View File

@ -21,6 +21,8 @@ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE. THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "dixstruct.h" #include "dixstruct.h"
@ -34,7 +36,7 @@ static EviPrivPtr eviPriv;
static int static int
ProcEVIQueryVersion(ClientPtr client) ProcEVIQueryVersion(ClientPtr client)
{ {
REQUEST(xEVIQueryVersionReq); /* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep; xEVIQueryVersionReply rep;
register int n; register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq); REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
@ -167,11 +169,11 @@ EVIResetProc(ExtensionEntry *extEntry)
void void
EVIExtensionInit(void) EVIExtensionInit(void)
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(EVINAME, 0, 0, if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch, ProcEVIDispatch,
SProcEVIDispatch, SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode)) EVIResetProc, StandardMinorOpcode)))
{ {
XEVIReqCode = (unsigned char)extEntry->base; XEVIReqCode = (unsigned char)extEntry->base;
eviPriv = eviDDXInit(); eviPriv = eviDDXInit();

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.9 2001/12/17 20:52:25 dawes Exp $ */
/* /*
Copyright 1996, 1998, 2001 The Open Group Copyright 1996, 1998, 2001 The Open Group
@ -74,9 +75,9 @@ static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP; static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL; static AppGroupPtr appGrpList = NULL;
extern WindowPtr* WindowTable;
extern xConnSetupPrefix connSetupPrefix; extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo; extern char* ConnectionInfo;
extern int connBlockScreenStart;
static static
int XagAppGroupFree (what, id) int XagAppGroupFree (what, id)
@ -121,7 +122,7 @@ void XagClientStateChange (pcbl, nulldata, calldata)
NewClientInfoRec* pci = (NewClientInfoRec*) calldata; NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client; ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp; AppGroupPtr pAppGrp;
XID authId; XID authId = 0;
if (!pClient->appgroup) { if (!pClient->appgroup) {
switch (pClient->clientState) { switch (pClient->clientState) {
@ -220,13 +221,13 @@ XagExtensionInit ()
{ {
ExtensionEntry* extEntry; ExtensionEntry* extEntry;
if (extEntry = AddExtension (XAGNAME, if ((extEntry = AddExtension (XAGNAME,
0, 0,
XagNumberErrors, XagNumberErrors,
ProcXagDispatch, ProcXagDispatch,
SProcXagDispatch, SProcXagDispatch,
XagResetProc, XagResetProc,
StandardMinorOpcode)) { StandardMinorOpcode))) {
XagReqCode = (unsigned char)extEntry->base; XagReqCode = (unsigned char)extEntry->base;
XagErrorBase = extEntry->errorBase; XagErrorBase = extEntry->errorBase;
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
@ -247,7 +248,7 @@ static
int ProcXagQueryVersion (client) int ProcXagQueryVersion (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST (xXagQueryVersionReq); /* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep; xXagQueryVersionReply rep;
register int n; register int n;
@ -309,8 +310,6 @@ static
void CreateConnectionInfo (pAppGrp) void CreateConnectionInfo (pAppGrp)
AppGroupPtr pAppGrp; AppGroupPtr pAppGrp;
{ {
extern int connBlockScreenStart;
xConnSetup *setup = (xConnSetup*) ConnectionInfo;
xWindowRoot* rootp; xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS]; xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS]; unsigned int rootlens[MAXSCREENS];
@ -376,7 +375,6 @@ AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
CARD32* attribs; CARD32* attribs;
{ {
AppGroupPtr pAppGrp; AppGroupPtr pAppGrp;
int i;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec)); pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) { if (pAppGrp) {
@ -570,7 +568,7 @@ int ProcXagCreateAssoc (client)
if (stuff->window_type != XagWindowTypeX11) if (stuff->window_type != XagWindowTypeX11)
#endif #endif
return BadMatch; return BadMatch;
#ifdef WIN32 /* and Mac, etc */ #if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client)) if (!LocalClient (client))
return BadAccess; return BadAccess;
#endif #endif
@ -584,7 +582,7 @@ static
int ProcXagDestroyAssoc (client) int ProcXagDestroyAssoc (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST (xXagDestroyAssocReq); /* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq); REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */ /* Macintosh, OS/2, and MS-Windows servers have some work to do here */

View File

@ -26,7 +26,9 @@ other dealings in this Software without prior written authorization
from The Open Group. from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.5 2001/12/14 19:58:48 dawes Exp $ */
#define NEED_EVENTS
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "misc.h"
@ -36,17 +38,23 @@ from The Open Group.
#include "bigreqstr.h" #include "bigreqstr.h"
static unsigned char XBigReqCode; static unsigned char XBigReqCode;
static int ProcBigReqDispatch();
static void BigReqResetProc(); static void BigReqResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static DISPATCH_PROC(ProcBigReqDispatch);
void void
BigReqExtensionInit() BigReqExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(XBigReqExtensionName, 0, 0, if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch, ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode)) BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base; XBigReqCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XBigReqExtensionName, TRUE); DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
} }

View File

@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group. in this Software without prior written authorization from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.10 2001/12/14 19:58:48 dawes Exp $ */
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
@ -35,11 +36,16 @@ in this Software without prior written authorization from The Open Group.
#include "colormapst.h" #include "colormapst.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "servermd.h" #include "servermd.h"
#include "swapreq.h"
#define _XCUP_SERVER_ #define _XCUP_SERVER_
#include "Xcupstr.h" #include "Xcupstr.h"
#include "Xfuncproto.h" #include "Xfuncproto.h"
#ifndef EXTMODULE
#include "../os/osdep.h" #include "../os/osdep.h"
#else
#include "xf86_ansic.h"
#endif
static int ProcDispatch (), SProcDispatch (); static int ProcDispatch (), SProcDispatch ();
static void ResetProc (); static void ResetProc ();
@ -121,13 +127,13 @@ XcupExtensionInit ()
{ {
ExtensionEntry* extEntry; ExtensionEntry* extEntry;
if (extEntry = AddExtension (XCUPNAME, if ((extEntry = AddExtension (XCUPNAME,
0, 0,
XcupNumberErrors, XcupNumberErrors,
ProcDispatch, ProcDispatch,
SProcDispatch, SProcDispatch,
ResetProc, ResetProc,
StandardMinorOpcode)) { StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base; ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase; ErrorBase = extEntry->errorBase;
} }
@ -146,7 +152,7 @@ static
int ProcQueryVersion (client) int ProcQueryVersion (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST (xXcupQueryVersionReq); /* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep; xXcupQueryVersionReply rep;
register int n; register int n;
@ -214,7 +220,6 @@ int ProcStoreColors (client)
int ncolors, n; int ncolors, n;
xXcupStoreColorsReply rep; xXcupStoreColorsReply rep;
xColorItem* cptr; xColorItem* cptr;
Pixel pixel;
if (!(pcmp->class & DynamicClass)) if (!(pcmp->class & DynamicClass))
return BadMatch; return BadMatch;
@ -302,7 +307,7 @@ int SProcGetReservedColormapEntries (client)
} }
static static
int SProcStoreColors (client) int SProcXcupStoreColors (client)
ClientPtr client; ClientPtr client;
{ {
register int n; register int n;
@ -331,7 +336,7 @@ int SProcDispatch (client)
case X_XcupGetReservedColormapEntries: case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client); return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors: case X_XcupStoreColors:
return SProcStoreColors (client); return SProcXcupStoreColors (client);
default: default:
return BadRequest; return BadRequest;
} }

View File

@ -27,43 +27,55 @@ Equipment Corporation.
******************************************************************/ ******************************************************************/
/*
* HISTORY
*
* @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
*/
/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "misc.h"
#include "os.h" #include "os.h"
#include "dixstruct.h" #include "dixstruct.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "opaque.h"
#define DPMS_SERVER
#include "dpms.h" #include "dpms.h"
#include "dpmsstr.h" #include "dpmsstr.h"
#include <stdio.h> #include "dpmsproc.h"
static unsigned char DPMSCode; static unsigned char DPMSCode;
static int ProcDPMSDispatch(), SProcDPMSDispatch(); static DISPATCH_PROC(ProcDPMSDispatch);
static void DPMSResetProc(); static DISPATCH_PROC(SProcDPMSDispatch);
static int ProcDPMSGetVersion(), SProcDPMSGetVersion(); static DISPATCH_PROC(ProcDPMSGetVersion);
static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts(); static DISPATCH_PROC(SProcDPMSGetVersion);
static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts(); static DISPATCH_PROC(ProcDPMSGetTimeouts);
static int ProcDPMSEnable(), ProcDPMSEnable(); static DISPATCH_PROC(SProcDPMSGetTimeouts);
static int ProcDPMSDisable(), ProcDPMSDisable(); static DISPATCH_PROC(ProcDPMSSetTimeouts);
static int ProcDPMSForceLevel(), ProcDPMSForceLevel(); static DISPATCH_PROC(SProcDPMSSetTimeouts);
static DISPATCH_PROC(ProcDPMSEnable);
extern void Swap32Write(); /* XXX should be in header file */ static DISPATCH_PROC(SProcDPMSEnable);
extern CARD32 ScreenSaverTime; static DISPATCH_PROC(ProcDPMSDisable);
extern CARD32 DPMSStandbyTime; static DISPATCH_PROC(SProcDPMSDisable);
extern CARD32 DPMSSuspendTime; static DISPATCH_PROC(ProcDPMSForceLevel);
extern CARD32 DPMSOffTime; static DISPATCH_PROC(SProcDPMSForceLevel);
extern BOOL DPMSCapableFlag; static DISPATCH_PROC(ProcDPMSInfo);
extern BOOL DPMSEnabled; static DISPATCH_PROC(SProcDPMSInfo);
extern CARD16 DPMSPowerLevel; static DISPATCH_PROC(ProcDPMSCapable);
static DISPATCH_PROC(SProcDPMSCapable);
static void DPMSResetProc(ExtensionEntry* extEntry);
void void
DPMSExtensionInit() DPMSExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(DPMSExtensionName, 0, 0, if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch, ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode)) DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base; DPMSCode = (unsigned char)extEntry->base;
return; return;
} }
@ -79,7 +91,7 @@ static int
ProcDPMSGetVersion(client) ProcDPMSGetVersion(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xDPMSGetVersionReq); /* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep; xDPMSGetVersionReply rep;
register int n; register int n;
@ -100,10 +112,9 @@ ProcDPMSGetVersion(client)
} }
static int static int
ProcDPMSCapable(client) ProcDPMSCapable(register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xDPMSCapableReq); /* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep; xDPMSCapableReply rep;
register int n; register int n;
@ -114,6 +125,9 @@ ProcDPMSCapable(client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag; rep.capable = DPMSCapableFlag;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
}
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep); WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
return(client->noClientException); return(client->noClientException);
} }
@ -122,7 +136,7 @@ static int
ProcDPMSGetTimeouts(client) ProcDPMSGetTimeouts(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xDPMSGetTimeoutsReq); /* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep; xDPMSGetTimeoutsReply rep;
register int n; register int n;
@ -150,7 +164,6 @@ ProcDPMSSetTimeouts(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xDPMSSetTimeoutsReq); REQUEST(xDPMSSetTimeoutsReq);
register int n;
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
@ -176,7 +189,7 @@ static int
ProcDPMSEnable(client) ProcDPMSEnable(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xDPMSEnableReq); /* REQUEST(xDPMSEnableReq); */
REQUEST_SIZE_MATCH(xDPMSEnableReq); REQUEST_SIZE_MATCH(xDPMSEnableReq);
@ -190,13 +203,11 @@ static int
ProcDPMSDisable(client) ProcDPMSDisable(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xDPMSDisableReq); /* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq); REQUEST_SIZE_MATCH(xDPMSDisableReq);
#ifdef DPMSExtension
DPMSSet(DPMSModeOn); DPMSSet(DPMSModeOn);
#endif
DPMSEnabled = FALSE; DPMSEnabled = FALSE;
@ -217,9 +228,7 @@ ProcDPMSForceLevel(client)
if (stuff->level == DPMSModeOn) { if (stuff->level == DPMSModeOn) {
lastDeviceEventTime.milliseconds = lastDeviceEventTime.milliseconds =
GetTimeInMillis(); GetTimeInMillis();
} } else if (stuff->level == DPMSModeStandby) {
#if 0
else if (stuff->level == DPMSModeStandby) {
lastDeviceEventTime.milliseconds = lastDeviceEventTime.milliseconds =
GetTimeInMillis() - DPMSStandbyTime; GetTimeInMillis() - DPMSStandbyTime;
} else if (stuff->level == DPMSModeSuspend) { } else if (stuff->level == DPMSModeSuspend) {
@ -232,20 +241,16 @@ ProcDPMSForceLevel(client)
client->errorValue = stuff->level; client->errorValue = stuff->level;
return BadValue; return BadValue;
} }
#endif
#ifdef DPMSExtension
DPMSSet(stuff->level); DPMSSet(stuff->level);
#endif
return(client->noClientException); return(client->noClientException);
} }
static int static int
ProcDPMSInfo(client) ProcDPMSInfo(register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xDPMSInfoReq); /* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep; xDPMSInfoReply rep;
register int n; register int n;
@ -309,8 +314,7 @@ SProcDPMSGetVersion(client)
} }
static int static int
SProcDPMSCapable(client) SProcDPMSCapable(register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xDPMSCapableReq); REQUEST(xDPMSCapableReq);
register int n; register int n;

View File

@ -26,23 +26,23 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation. Equipment Corporation.
******************************************************************/ ******************************************************************/
/* $XFree86: xc/programs/Xserver/Xext/dpmsstubs.c,v 3.4 2001/01/17 22:13:15 dawes Exp $ */
typedef int Bool; typedef int Bool;
#define FALSE 0 #define FALSE 0
Bool DPMSSupported() Bool DPMSSupported(void)
{ {
return FALSE; return FALSE;
} }
int DPSMGet(level) int DPSMGet(int *level)
int *level;
{ {
return -1; return -1;
} }
void DPMSSet(level) void DPMSSet(int level)
{ {
} }

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.14 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group
@ -27,29 +28,29 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */ /* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
#include <stdio.h>
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "window.h"
#include "os.h" #include "os.h"
#include "windowstr.h" #include "windowstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "pixmapstr.h" #include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "dixstruct.h" #include "dixstruct.h"
#include "resource.h" #include "resource.h"
#include "opaque.h" #include "opaque.h"
#include "sleepuntil.h"
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#include "multibufst.h" #include "multibufst.h"
#include "regionstr.h"
#include "gcstruct.h" #ifdef EXTMODULE
#include "inputstr.h" #include "xf86_ansic.h"
#ifndef WIN32 #else
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#ifdef PANORAMIX
#include "panoramiX.h"
#endif #endif
/* given an OtherClientPtr obj, get the ClientPtr */ /* given an OtherClientPtr obj, get the ClientPtr */
@ -60,121 +61,99 @@ in this Software without prior written authorization from The Open Group.
#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask) #define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
#ifdef PANORAMIX
extern int PanoramiXNumScreens;
extern Bool noPanoramiXExtension;
extern PanoramiXWindow *PanoramiXWinRoot;
extern PanoramiXPmap *PanoramiXPmapRoot;
extern PanoramiXData *panoramiXdataPtr;
#endif
/* The _Multibuffer and _Multibuffers structures below refer to each other,
* so we need this forward declaration
*/
typedef struct _Multibuffers *MultibuffersPtr;
/*
* per-Multibuffer data
*/
typedef struct _Multibuffer {
MultibuffersPtr pMultibuffers; /* associated window data */
Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */
Mask otherEventMask; /* mask of all other clients event masks */
OtherClients *otherClients; /* other clients that want events */
int number; /* index of this buffer into array */
int side; /* always Mono */
int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */
PixmapPtr pPixmap; /* associated pixmap */
} MultibufferRec, *MultibufferPtr;
/*
* per-window data
*/
typedef struct _Multibuffers {
WindowPtr pWindow; /* associated window */
int numMultibuffer; /* count of buffers */
int refcnt; /* ref count for delete */
int displayedMultibuffer; /* currently active buffer */
int updateAction; /* Undefined, Background, Untouched, Copied */
int updateHint; /* Frequent, Intermittent, Static */
int windowMode; /* always Mono */
TimeStamp lastUpdate; /* time of last update */
unsigned short width, height; /* last known window size */
short x, y; /* for static gravity */
MultibufferPtr buffers; /* array of numMultibuffer buffers */
} MultibuffersRec;
/*
* per-screen data
*/
typedef struct _MultibufferScreen {
Bool (*PositionWindow)();
} MultibufferScreenRec, *MultibufferScreenPtr;
/*
* per display-image-buffers request data.
*/
typedef struct _DisplayRequest {
struct _DisplayRequest *next;
TimeStamp activateTime;
ClientPtr pClient;
XID id;
} DisplayRequestRec, *DisplayRequestPtr;
static unsigned char MultibufferReqCode; static unsigned char MultibufferReqCode;
static int MultibufferEventBase; static int MultibufferEventBase;
static int MultibufferErrorBase; static int MultibufferErrorBase;
int MultibufferScreenIndex = -1; int MultibufferScreenIndex = -1;
int MultibufferWindowIndex = -1; int MultibufferWindowIndex = -1;
static void PerformDisplayRequest (); static void PerformDisplayRequest (
static void DisposeDisplayRequest (); #if NeedFunctionPrototypes
static Bool QueueDisplayRequest (); MultibuffersPtr * /* ppMultibuffers */,
MultibufferPtr * /* pMultibuffer */,
int /* nbuf */
#endif
);
static Bool QueueDisplayRequest (
#if NeedFunctionPrototypes
ClientPtr /* client */,
TimeStamp /* activateTime */
#endif
);
static void BumpTimeStamp (); static void BumpTimeStamp (
#if NeedFunctionPrototypes
void MultibufferExpose (); TimeStamp * /* ts */,
void MultibufferUpdate (); CARD32 /* inc */
static void AliasMultibuffer (); #endif
int CreateImageBuffers (); );
void DestroyImageBuffers ();
int DisplayImageBuffers ();
static void RecalculateMultibufferOtherEvents ();
static int EventSelectForMultibuffer();
static void AliasMultibuffer (
#if NeedFunctionPrototypes
MultibuffersPtr /* pMultibuffers */,
int /* i */
#endif
);
static void RecalculateMultibufferOtherEvents (
#if NeedFunctionPrototypes
MultibufferPtr /* pMultibuffer */
#endif
);
static int EventSelectForMultibuffer(
#if NeedFunctionPrototypes
MultibufferPtr /* pMultibuffer */,
ClientPtr /* client */,
Mask /* mask */
#endif
);
/* /*
* The Pixmap associated with a buffer can be found as a resource * The Pixmap associated with a buffer can be found as a resource
* with this type * with this type
*/ */
RESTYPE MultibufferDrawableResType; RESTYPE MultibufferDrawableResType;
static int MultibufferDrawableDelete (); static int MultibufferDrawableDelete (
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/* /*
* The per-buffer data can be found as a resource with this type. * The per-buffer data can be found as a resource with this type.
* the resource id of the per-buffer data is the same as the resource * the resource id of the per-buffer data is the same as the resource
* id of the pixmap * id of the pixmap
*/ */
static RESTYPE MultibufferResType; static RESTYPE MultibufferResType;
static int MultibufferDelete (); static int MultibufferDelete (
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/* /*
* The per-window data can be found as a resource with this type, * The per-window data can be found as a resource with this type,
* using the window resource id * using the window resource id
*/ */
static RESTYPE MultibuffersResType; static RESTYPE MultibuffersResType;
static int MultibuffersDelete (); static int MultibuffersDelete (
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/* /*
* Clients other than the buffer creator attach event masks in * Clients other than the buffer creator attach event masks in
* OtherClient structures; each has a resource of this type. * OtherClient structures; each has a resource of this type.
*/ */
static RESTYPE OtherClientResType; static RESTYPE OtherClientResType;
static int OtherClientDelete (); static int OtherClientDelete (
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/**************** /****************
* MultibufferExtensionInit * MultibufferExtensionInit
@ -183,10 +162,70 @@ static int OtherClientDelete ();
* *
****************/ ****************/
static int ProcMultibufferDispatch(), SProcMultibufferDispatch(); extern DISPATCH_PROC(ProcGetBufferAttributes);
static void MultibufferResetProc();
static void SClobberNotifyEvent(), SUpdateNotifyEvent(); static DISPATCH_PROC(ProcClearImageBufferArea);
static Bool MultibufferPositionWindow(); static DISPATCH_PROC(ProcCreateImageBuffers);
static DISPATCH_PROC(ProcDestroyImageBuffers);
static DISPATCH_PROC(ProcDisplayImageBuffers);
static DISPATCH_PROC(ProcGetBufferInfo);
static DISPATCH_PROC(ProcGetBufferVersion);
static DISPATCH_PROC(ProcGetMBufferAttributes);
static DISPATCH_PROC(ProcMultibufferDispatch);
static DISPATCH_PROC(ProcSetBufferAttributes);
static DISPATCH_PROC(ProcSetMBufferAttributes);
static DISPATCH_PROC(SProcClearImageBufferArea);
static DISPATCH_PROC(SProcCreateImageBuffers);
static DISPATCH_PROC(SProcDestroyImageBuffers);
static DISPATCH_PROC(SProcDisplayImageBuffers);
static DISPATCH_PROC(SProcGetBufferAttributes);
static DISPATCH_PROC(SProcGetBufferInfo);
static DISPATCH_PROC(SProcGetBufferVersion);
static DISPATCH_PROC(SProcGetMBufferAttributes);
static DISPATCH_PROC(SProcMultibufferDispatch);
static DISPATCH_PROC(SProcSetBufferAttributes);
static DISPATCH_PROC(SProcSetMBufferAttributes);
static void MultibufferResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static void SClobberNotifyEvent(
#if NeedFunctionPrototypes
xMbufClobberNotifyEvent * /* from */,
xMbufClobberNotifyEvent * /* to */
# endif
);
static void SUpdateNotifyEvent(
#if NeedFunctionPrototypes
xMbufUpdateNotifyEvent * /* from */,
xMbufUpdateNotifyEvent * /* to */
#endif
);
static Bool MultibufferPositionWindow(
#if NeedFunctionPrototypes
WindowPtr /* pWin */,
int /* x */,
int /* y */
#endif
);
static void SetupBackgroundPainter (
#if NeedFunctionPrototypes
WindowPtr /* pWin */,
GCPtr /* pGC */
#endif
);
static int DeliverEventsToMultibuffer (
#if NeedFunctionPrototypes
MultibufferPtr /* pMultibuffer */,
xEvent * /* pEvents */,
int /* count */,
Mask /* filter */
#endif
);
void void
MultibufferExtensionInit() MultibufferExtensionInit()
@ -243,8 +282,8 @@ MultibufferExtensionInit()
MultibufferReqCode = (unsigned char)extEntry->base; MultibufferReqCode = (unsigned char)extEntry->base;
MultibufferEventBase = extEntry->eventBase; MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase; MultibufferErrorBase = extEntry->errorBase;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = SClobberNotifyEvent; EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = SUpdateNotifyEvent; EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
} }
} }
@ -275,7 +314,6 @@ static int
ProcGetBufferVersion (client) ProcGetBufferVersion (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xMbufGetBufferVersionReq);
xMbufGetBufferVersionReply rep; xMbufGetBufferVersionReply rep;
register int n; register int n;
@ -331,8 +369,8 @@ SetupBackgroundPainter (pWin, pGC)
case BackgroundPixmap: case BackgroundPixmap:
gcvalues[0] = (pointer) FillTiled; gcvalues[0] = (pointer) FillTiled;
gcvalues[1] = (pointer) background.pixmap; gcvalues[1] = (pointer) background.pixmap;
gcvalues[2] = (pointer) ts_x_origin; gcvalues[2] = (pointer)(long) ts_x_origin;
gcvalues[3] = (pointer) ts_y_origin; gcvalues[3] = (pointer)(long) ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin; gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break; break;
@ -430,80 +468,8 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
return Success; return Success;
} }
#ifdef PANORAMIX
static int static int
ProcPanoramiXCreateImageBuffers (client)
register ClientPtr client;
{
REQUEST(xMbufCreateImageBuffersReq);
register int result;
int i, j, k, len;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
PanoramiXWindow *next;
PanoramiXWindow *pPanoramiXids;
PanoramiXWindow *pPanoramiXPrev_ids;
PanoramiXPmap *local;
PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
CARD32 *value, *orig_ids;
XID *ids;
XID ID;
DrawablePtr pDrawable;
REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
IF_RETURN(!pPanoramiXWin, BadRequest);
len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
orig_ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
if (!ids)
return BadAlloc;
memcpy((char *)orig_ids, (char *) &stuff[1], len * sizeof(XID));
value = (CARD32 *)&stuff[1];
/* New resources are pixmaps */
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->window = pPanoramiXWin->info[j].id;
for (i = 0; i < len; i++) {
ids[i] = (XID)orig_ids[i];
/* These will be MultibufferDrawableResType & MultibufferResType */
pPanoramiXPmap = PanoramiXPmapRoot;
PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
if (!pPanoramiXPmap) {
local = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
for (k = 0; k <= PanoramiXNumScreens - 1; k++) {
ID = k ? FakeClientID(client->index) : ids[i];
local->info[k].id = ID;
}
local->FreeMe = FALSE;
PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
pPanoramiXPmap->next = local;
value[i] = local->info[j].id;
}else
value[i] = pPanoramiXPmap->info[j].id;
}
if (!j)
noPanoramiXExtension = TRUE;
result = ProcCreateImageBuffers (client);
noPanoramiXExtension = FALSE;
BREAK_IF(result != Success);
}
if (result != Success) {
if (ids)
Xfree(ids);
if (orig_ids)
Xfree(orig_ids);
if (local)
Xfree(local);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
static int
#endif
ProcCreateImageBuffers (client) ProcCreateImageBuffers (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -565,10 +531,7 @@ ProcCreateImageBuffers (client)
swapl(&rep.length, n); swapl(&rep.length, n);
swaps(&rep.numberBuffer, n); swaps(&rep.numberBuffer, n);
} }
#ifdef PANORAMIX WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
if (noPanoramiXExtension)
#endif
WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
return (client->noClientException); return (client->noClientException);
} }
@ -585,16 +548,6 @@ ProcDisplayImageBuffers (client)
CARD32 minDelay; CARD32 minDelay;
TimeStamp activateTime, bufferTime; TimeStamp activateTime, bufferTime;
#ifdef PANORAMIX
WindowPtr pWndw;
PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
MultibufferPtr *pScrn0Multibuffer;
MultibuffersPtr *ppScrn0Multibuffers;
int k;
int panoramiX_buf = 0;
Bool FoundScreen;
#endif
REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq); REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2); nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
@ -602,23 +555,6 @@ ProcDisplayImageBuffers (client)
return Success; return Success;
minDelay = stuff->minDelay; minDelay = stuff->minDelay;
ids = (XID *) &stuff[1]; ids = (XID *) &stuff[1];
#ifdef PANORAMIX
if (!noPanoramiXExtension)
{
int maxbuf = 0;
maxbuf = nbuf * PanoramiXNumScreens;
ppScrn0Multibuffers = (MultibuffersPtr *) xalloc(maxbuf * sizeof (MultibuffersPtr));
pScrn0Multibuffer = (MultibufferPtr *) xalloc (maxbuf * sizeof(MultibufferPtr));
if (!ppScrn0Multibuffers || !pScrn0Multibuffer)
{
if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
xfree (ppScrn0Multibuffers);
xfree (pScrn0Multibuffer);
client->errorValue = 0;
return BadAlloc;
}
}
#endif
ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr)); ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr)); pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer) if (!ppMultibuffers || !pMultibuffer)
@ -632,81 +568,6 @@ ProcDisplayImageBuffers (client)
activateTime.milliseconds = 0; activateTime.milliseconds = 0;
for (i = 0; i < nbuf; i++) for (i = 0; i < nbuf; i++)
{ {
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
pPanoramiXPmap = PanoramiXPmapRoot;
PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
if (!pPanoramiXPmap){
if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
xfree (ppMultibuffers);
xfree (pMultibuffer);
client->errorValue = ids[i];
return MultibufferErrorBase + MultibufferBadBuffer;
}
FoundScreen = FALSE;
pScrn0Multibuffer[panoramiX_buf] = (MultibufferPtr)
LookupIDByType (ids[i], MultibufferResType);
ppScrn0Multibuffers[i] = pScrn0Multibuffer[i]->pMultibuffers;
pWndw = ppScrn0Multibuffers[i]->pWindow;
for (k = 0; (k < PanoramiXNumScreens && !FoundScreen); k++) {
pMultibuffer[panoramiX_buf] = (MultibufferPtr)
LookupIDByType (pPanoramiXPmap->info[k].id, MultibufferResType);
if (!pMultibuffer[i])
{
if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
xfree (ppMultibuffers);
xfree (pMultibuffer);
client->errorValue = ids[i];
return MultibufferErrorBase + MultibufferBadBuffer;
}
ppMultibuffers[panoramiX_buf] = pMultibuffer[panoramiX_buf]->pMultibuffers;
/* Figure out where the buffer resides, which screens */
if ( ((pWndw->drawable.x < 0) &&
(pWndw->drawable.x + pWndw->drawable.width < 0))
|| ( (pWndw->drawable.x >
panoramiXdataPtr[k].x + panoramiXdataPtr[k].width) &&
(pWndw->drawable.x + pWndw->drawable.width >
panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)))
/* its not on screen - k -, try next screen */
continue;
if ( ((pWndw->drawable.y < 0) &&
(pWndw->drawable.y + pWndw->drawable.height < 0))
|| ( (pWndw->drawable.y >
panoramiXdataPtr[k].y + panoramiXdataPtr[k].height) &&
(pWndw->drawable.y + pWndw->drawable.height >
panoramiXdataPtr[k].y + panoramiXdataPtr[k].height)))
/* its not on screen - k -, try next screen */
continue;
/* The window resides on screen k, which means we need to
keep the buffer information for this screen */
panoramiX_buf++;
/* Is it only on this screen, or does it enter onto another
screen */
if ( ((pWndw->drawable.x + pWndw->drawable.width) <=
(panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)) &&
((pWndw->drawable.y + pWndw->drawable.height) <=
(panoramiXdataPtr[k].y +
panoramiXdataPtr[k].height )) )
FoundScreen = TRUE;
} /* for each screen k */
for (j = 0; j < i; j++)
{
if (ppScrn0Multibuffers[i] == ppScrn0Multibuffers[j])
{
if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
DEALLOCATE_LOCAL(ppScrn0Multibuffers);
DEALLOCATE_LOCAL(pScrn0Multibuffer);
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
client->errorValue = ids[i];
return BadMatch;
}
}
bufferTime = ppScrn0Multibuffers[i]->lastUpdate;
}else {
#endif
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
MultibufferResType); MultibufferResType);
if (!pMultibuffer[i]) if (!pMultibuffer[i])
@ -728,9 +589,6 @@ MultibufferResType);
} }
} }
bufferTime = ppMultibuffers[i]->lastUpdate; bufferTime = ppMultibuffers[i]->lastUpdate;
#ifdef PANORAMIX
}
#endif
BumpTimeStamp (&bufferTime, minDelay); BumpTimeStamp (&bufferTime, minDelay);
if (CompareTimeStamps (bufferTime, activateTime) == LATER) if (CompareTimeStamps (bufferTime, activateTime) == LATER)
activateTime = bufferTime; activateTime = bufferTime;
@ -742,54 +600,15 @@ MultibufferResType);
; ;
} }
else else
#ifdef PANORAMIX
if (!noPanoramiXExtension){
PerformDisplayRequest (ppMultibuffers, pMultibuffer, panoramiX_buf);
}else
#endif
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf); PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
#ifdef PANORAMIX
if (!noPanoramiXExtension){
DEALLOCATE_LOCAL(ppScrn0Multibuffers);
DEALLOCATE_LOCAL(pScrn0Multibuffer);
}
#endif
DEALLOCATE_LOCAL(ppMultibuffers); DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer); DEALLOCATE_LOCAL(pMultibuffer);
return Success; return Success;
} }
#ifdef PANORAMIX
static int static int
ProcPanoramiXDestroyImageBuffers (client)
ClientPtr client;
{
REQUEST (xMbufDestroyImageBuffersReq);
WindowPtr pWin;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
IF_RETURN(!pPanoramiXWin, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->window = pPanoramiXWin->info[j].id;
result = ProcDestroyImageBuffers (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
static int
#endif
ProcDestroyImageBuffers (client) ProcDestroyImageBuffers (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -803,34 +622,7 @@ ProcDestroyImageBuffers (client)
return Success; return Success;
} }
#ifdef PANORAMIX
static int static int
ProcPanoramiXSetMBufferAttributes (client)
ClientPtr client;
{
REQUEST (xMbufSetMBufferAttributesReq);
WindowPtr pWin;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_SIZE_MATCH (xMbufSetMBufferAttributesReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
IF_RETURN(!pPanoramiXWin, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->window = pPanoramiXWin->info[j].id;
result = ProcSetMBufferAttributes (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
static int
#endif
ProcSetMBufferAttributes (client) ProcSetMBufferAttributes (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -839,7 +631,7 @@ ProcSetMBufferAttributes (client)
MultibuffersPtr pMultibuffers; MultibuffersPtr pMultibuffers;
int len; int len;
Mask vmask; Mask vmask;
Mask index; Mask index2;
CARD32 updateHint; CARD32 updateHint;
XID *vlist; XID *vlist;
@ -857,9 +649,9 @@ ProcSetMBufferAttributes (client)
vlist = (XID *) &stuff[1]; vlist = (XID *) &stuff[1];
while (vmask) while (vmask)
{ {
index = (Mask) lowbit (vmask); index2 = (Mask) lowbit (vmask);
vmask &= ~index; vmask &= ~index2;
switch (index) switch (index2)
{ {
case MultibufferWindowUpdateHint: case MultibufferWindowUpdateHint:
updateHint = (CARD32) *vlist; updateHint = (CARD32) *vlist;
@ -936,7 +728,7 @@ ProcSetBufferAttributes (client)
REQUEST(xMbufSetBufferAttributesReq); REQUEST(xMbufSetBufferAttributesReq);
MultibufferPtr pMultibuffer; MultibufferPtr pMultibuffer;
int len; int len;
Mask vmask, index; Mask vmask, index2;
XID *vlist; XID *vlist;
Mask eventMask; Mask eventMask;
int result; int result;
@ -952,9 +744,9 @@ ProcSetBufferAttributes (client)
vlist = (XID *) &stuff[1]; vlist = (XID *) &stuff[1];
while (vmask) while (vmask)
{ {
index = (Mask) lowbit (vmask); index2 = (Mask) lowbit (vmask);
vmask &= ~index; vmask &= ~index2;
switch (index) switch (index2)
{ {
case MultibufferBufferEventMask: case MultibufferBufferEventMask:
eventMask = (Mask) *vlist; eventMask = (Mask) *vlist;
@ -971,6 +763,7 @@ ProcSetBufferAttributes (client)
return Success; return Success;
} }
int
ProcGetBufferAttributes (client) ProcGetBufferAttributes (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -1150,34 +943,13 @@ ProcMultibufferDispatch (client)
case X_MbufGetBufferVersion: case X_MbufGetBufferVersion:
return ProcGetBufferVersion (client); return ProcGetBufferVersion (client);
case X_MbufCreateImageBuffers: case X_MbufCreateImageBuffers:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXCreateImageBuffers (client);
else
return ProcCreateImageBuffers (client);
#else
return ProcCreateImageBuffers (client); return ProcCreateImageBuffers (client);
#endif
case X_MbufDisplayImageBuffers: case X_MbufDisplayImageBuffers:
return ProcDisplayImageBuffers (client); return ProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers: case X_MbufDestroyImageBuffers:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXDestroyImageBuffers (client);
else
return ProcDestroyImageBuffers (client);
#else
return ProcDestroyImageBuffers (client); return ProcDestroyImageBuffers (client);
#endif
case X_MbufSetMBufferAttributes: case X_MbufSetMBufferAttributes:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXSetMBufferAttributes (client);
else
return ProcSetMBufferAttributes (client);
#else
return ProcSetMBufferAttributes (client); return ProcSetMBufferAttributes (client);
#endif
case X_MbufGetMBufferAttributes: case X_MbufGetMBufferAttributes:
return ProcGetMBufferAttributes (client); return ProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes: case X_MbufSetBufferAttributes:
@ -1447,8 +1219,6 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
if (pExposed) if (pExposed)
{ {
RegionPtr pWinSize; RegionPtr pWinSize;
ScreenPtr pScreen = pWin->drawable.pScreen;
extern RegionPtr CreateUnclippedWinSize();
pWinSize = CreateUnclippedWinSize (pWin); pWinSize = CreateUnclippedWinSize (pWin);
/* pExposed is window-relative, but at this point /* pExposed is window-relative, but at this point
@ -1456,13 +1226,13 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
* window-relative so that region ops involving * window-relative so that region ops involving
* pExposed and pWinSize behave sensibly. * pExposed and pWinSize behave sensibly.
*/ */
REGION_TRANSLATE(pScreen, pWinSize, REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
-pWin->drawable.x, -pWin->drawable.x, -pWin->drawable.y);
-pWin->drawable.y); REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize); pExposed, pWinSize);
REGION_DESTROY(pScreen, pWinSize); REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
MultibufferExpose (pPrevMultibuffer, pExposed); MultibufferExpose (pPrevMultibuffer, pExposed);
REGION_DESTROY(pScreen, pExposed); REGION_DESTROY(pWin->drawable.pScreen, pExposed);
} }
graphicsExpose = FALSE; graphicsExpose = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE); DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
@ -1590,8 +1360,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
return 0; return 0;
/* maybe send event to owner */ /* maybe send event to owner */
if (attempt = TryClientEvents( if ((attempt = TryClientEvents(
bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
{ {
if (attempt > 0) if (attempt > 0)
deliveries++; deliveries++;
@ -1602,8 +1372,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
/* maybe send event to other clients */ /* maybe send event to other clients */
for (other = pMultibuffer->otherClients; other; other=other->next) for (other = pMultibuffer->otherClients; other; other=other->next)
{ {
if (attempt = TryClientEvents( if ((attempt = TryClientEvents(
rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
{ {
if (attempt > 0) if (attempt > 0)
deliveries++; deliveries++;
@ -1664,15 +1434,15 @@ MultibufferExpose (pMultibuffer, pRegion)
/* send UpdateNotify event */ /* send UpdateNotify event */
void void
MultibufferUpdate (pMultibuffer, time) MultibufferUpdate (pMultibuffer, time2)
MultibufferPtr pMultibuffer; MultibufferPtr pMultibuffer;
CARD32 time; CARD32 time2;
{ {
xMbufUpdateNotifyEvent event; xMbufUpdateNotifyEvent event;
event.type = MultibufferEventBase + MultibufferUpdateNotify; event.type = MultibufferEventBase + MultibufferUpdateNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id; event.buffer = pMultibuffer->pPixmap->drawable.id;
event.timeStamp = time; event.timeStamp = time2;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event, (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
1, (Mask)MultibufferUpdateNotifyMask); 1, (Mask)MultibufferUpdateNotifyMask);
} }

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/* /*
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group
@ -28,6 +29,7 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */ /* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_EVENTS
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "misc.h"
@ -40,17 +42,28 @@ in this Software without prior written authorization from The Open Group.
extern Bool permitOldBugs; extern Bool permitOldBugs;
static unsigned char MITReqCode; static unsigned char MITReqCode;
static int ProcMITDispatch(), SProcMITDispatch();
static void MITResetProc(); static void MITResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static DISPATCH_PROC(ProcMITDispatch);
static DISPATCH_PROC(ProcMITGetBugMode);
static DISPATCH_PROC(ProcMITSetBugMode);
static DISPATCH_PROC(SProcMITDispatch);
static DISPATCH_PROC(SProcMITGetBugMode);
static DISPATCH_PROC(SProcMITSetBugMode);
void void
MITMiscExtensionInit() MITMiscExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(MITMISCNAME, 0, 0, if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch, ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode)) MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base; MITReqCode = (unsigned char)extEntry->base;
} }
@ -81,7 +94,6 @@ static int
ProcMITGetBugMode(client) ProcMITGetBugMode(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xMITGetBugModeReq);
xMITGetBugModeReply rep; xMITGetBugModeReply rep;
register int n; register int n;

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital dealings in this Software without prior written authorization from Digital
Equipment Corporation. Equipment Corporation.
******************************************************************/ ******************************************************************/
/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.8 2001/08/23 13:01:36 alanh Exp $ */
#include <stdio.h> #include <stdio.h>
#include "X.h" #include "X.h"
@ -44,20 +45,16 @@ Equipment Corporation.
#endif #endif
#include "panoramiX.h" #include "panoramiX.h"
#include "panoramiXproto.h" #include "panoramiXproto.h"
#include "panoramiXsrv.h"
#include "globals.h"
/*
/* /*
* External references for data variables * External references for data variables
*/ */
extern Bool noPanoramiXExtension;
extern Bool PanoramiXVisibilityNotifySent;
extern WindowPtr *WindowTable;
extern int defaultBackingStore;
extern char *ConnectionInfo; extern char *ConnectionInfo;
extern int connBlockScreenStart; extern int connBlockScreenStart;
extern int (* ProcVector[256]) ();
#if NeedFunctionPrototypes #if NeedFunctionPrototypes
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr) #define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
@ -68,50 +65,38 @@ extern int (* ProcVector[256]) ();
PROC_EXTERN(ProcPanoramiXQueryVersion); PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState); PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount); PROC_EXTERN(ProcPanoramiXGetScreenCount);
PROC_EXTERN(PropPanoramiXGetScreenSize); PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaIsActive);
PROC_EXTERN(ProcXineramaQueryScreens);
static int static int
#if NeedFunctionPrototypes
SProcPanoramiXQueryVersion (ClientPtr client) SProcPanoramiXQueryVersion (ClientPtr client)
#else
SProcPanoramiXQueryVersion (client)
register ClientPtr client;
#endif
{ {
register int n; REQUEST(xPanoramiXQueryVersionReq);
REQUEST(xPanoramiXQueryVersionReq); register int n;
swaps(&stuff->length,n); swaps(&stuff->length,n);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client); return ProcPanoramiXQueryVersion(client);
} }
static int static int
#if NeedFunctionPrototypes
SProcPanoramiXGetState(ClientPtr client) SProcPanoramiXGetState(ClientPtr client)
#else
SProcPanoramiXGetState(client)
register ClientPtr client;
#endif
{ {
REQUEST(xPanoramiXGetStateReq); REQUEST(xPanoramiXGetStateReq);
register int n; register int n;
swaps (&stuff->length, n); swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
return ProcPanoramiXGetState(client);
} }
static int static int
#if NeedFunctionPrototypes
SProcPanoramiXGetScreenCount(ClientPtr client) SProcPanoramiXGetScreenCount(ClientPtr client)
#else
SProcPanoramixGetScreenCount(client)
register ClientPtr client;
#endif
{ {
REQUEST(xPanoramiXGetScreenCountReq); REQUEST(xPanoramiXGetScreenCountReq);
register int n; register int n;
swaps (&stuff->length, n); swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@ -119,29 +104,43 @@ SProcPanoramixGetScreenCount(client)
} }
static int static int
#if NeedFunctionPrototypes
SProcPanoramiXGetScreenSize(ClientPtr client) SProcPanoramiXGetScreenSize(ClientPtr client)
#else
SProcPanoramiXGetScreenSize(client)
register ClientPtr client;
#endif
{ {
REQUEST(xPanoramiXGetScreenSizeReq); REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin; register int n;
register int n;
swaps (&stuff->length, n); swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
return ProcPanoramiXGetScreenSize(client); return ProcPanoramiXGetScreenSize(client);
} }
static int
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int int
#if NeedFunctionPrototypes
SProcPanoramiXDispatch (ClientPtr client) SProcPanoramiXDispatch (ClientPtr client)
#else
SProcPanoramiXDispatch (client)
ClientPtr client;
#endif
{ REQUEST(xReq); { REQUEST(xReq);
switch (stuff->data) switch (stuff->data)
{ {
@ -153,6 +152,10 @@ SProcPanoramiXDispatch (client)
return SProcPanoramiXGetScreenCount(client); return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize: case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client); return SProcPanoramiXGetScreenSize(client);
return BadRequest; case X_XineramaIsActive:
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return SProcXineramaQueryScreens(client);
} }
return BadRequest;
} }

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group. in this Software without prior written authorization from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.11 2002/05/31 18:45:53 dawes Exp $ */
#include "dixstruct.h" #include "dixstruct.h"
#include "extnsionst.h" #include "extnsionst.h"
@ -50,7 +51,7 @@ extern unsigned char LbxReqCode;
#ifndef DEFAULTPOLICYFILE #ifndef DEFAULTPOLICYFILE
# define DEFAULTPOLICYFILE NULL # define DEFAULTPOLICYFILE NULL
#endif #endif
#ifdef WIN32 #if defined(WIN32) || defined(__CYGWIN__)
#include <X11/Xos.h> #include <X11/Xos.h>
#undef index #undef index
#endif #endif
@ -82,9 +83,6 @@ int (*SwappedUntrustedProcVector[256])(
#endif #endif
); );
extern int ProcBadRequest();
/* SecurityAudit /* SecurityAudit
* *
* Arguments: * Arguments:
@ -150,7 +148,7 @@ SecurityDeleteAuthorization(value, id)
/* send revoke events */ /* send revoke events */
while (pEventClient = pAuth->eventClients) while ((pEventClient = pAuth->eventClients))
{ {
/* send revocation event event */ /* send revocation event event */
ClientPtr client = rClient(pEventClient); ClientPtr client = rClient(pEventClient);
@ -318,7 +316,7 @@ static int
ProcSecurityQueryVersion(client) ProcSecurityQueryVersion(client)
ClientPtr client; ClientPtr client;
{ {
REQUEST(xSecurityQueryVersionReq); /* REQUEST(xSecurityQueryVersionReq); */
xSecurityQueryVersionReply rep; xSecurityQueryVersionReply rep;
/* paranoia: this "can't happen" because this extension is hidden /* paranoia: this "can't happen" because this extension is hidden
@ -395,7 +393,6 @@ ProcSecurityGenerateAuthorization(client)
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */ Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */ SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */ int err; /* error to return from this function */
int status; /* return value from os functions */
XID authId; /* authorization ID assigned by os layer */ XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */ xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */ unsigned int trustLevel; /* trust level of new auth */
@ -788,7 +785,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
Bool untrusted_got_event; Bool untrusted_got_event;
Bool found_event_window; Bool found_event_window;
Mask eventmask; Mask eventmask;
int reqtype; int reqtype = 0;
/* trusted clients always allowed to do anything */ /* trusted clients always allowed to do anything */
if (client->trustLevel == XSecurityClientTrusted) if (client->trustLevel == XSecurityClientTrusted)
@ -1361,8 +1358,11 @@ SecurityFreePropertyAccessList()
} }
} /* SecurityFreePropertyAccessList */ } /* SecurityFreePropertyAccessList */
#ifndef __UNIXOS2__
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') ) #define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
#else
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
#endif
static char * static char *
SecuritySkipWhitespace(p) SecuritySkipWhitespace(p)
@ -1441,7 +1441,6 @@ SecurityParsePropertyAccessRule(p)
char action = SecurityDefaultAction; char action = SecurityDefaultAction;
char readAction, writeAction, destroyAction; char readAction, writeAction, destroyAction;
PropertyAccessPtr pacl, prev, cur; PropertyAccessPtr pacl, prev, cur;
ATOM atom;
char *mustHaveProperty = NULL; char *mustHaveProperty = NULL;
char *mustHaveValue = NULL; char *mustHaveValue = NULL;
Bool invalid; Bool invalid;
@ -1641,7 +1640,11 @@ SecurityLoadPropertyAccessList()
if (!SecurityPolicyFile) if (!SecurityPolicyFile)
return; return;
#ifndef __UNIXOS2__
f = fopen(SecurityPolicyFile, "r"); f = fopen(SecurityPolicyFile, "r");
#else
f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
#endif
if (!f) if (!f)
{ {
ErrorF("error opening security policy file %s\n", ErrorF("error opening security policy file %s\n",
@ -1969,7 +1972,7 @@ SecurityExtensionInit()
SecurityEventBase = extEntry->eventBase; SecurityEventBase = extEntry->eventBase;
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
SwapSecurityAuthorizationRevokedEvent; (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
/* initialize untrusted proc vectors */ /* initialize untrusted proc vectors */

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.16 2001/12/14 19:58:50 dawes Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group
@ -27,7 +28,6 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shape.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */ /* $Xorg: shape.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
#include <stdio.h>
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "misc.h"
@ -43,26 +43,101 @@ in this Software without prior written authorization from The Open Group.
#include "shapestr.h" #include "shapestr.h"
#include "regionstr.h" #include "regionstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
typedef RegionPtr (*CreateDftPtr)(
#if NeedNestedPrototypes
WindowPtr /* pWin */
#endif
);
static int ShapeFreeClient(
#if NeedFunctionPrototypes
pointer /* data */,
XID /* id */
#endif
);
static int ShapeFreeEvents(
#if NeedFunctionPrototypes
pointer /* data */,
XID /* id */
#endif
);
static void SendShapeNotify(
#if NeedFunctionPrototypes
WindowPtr /* pWin */,
int /* which */
#endif
);
static void ShapeResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static void SShapeNotifyEvent(
#if NeedFunctionPrototypes
xShapeNotifyEvent * /* from */,
xShapeNotifyEvent * /* to */
#endif
);
static int
RegionOperate (
#if NeedFunctionPrototypes
ClientPtr /* client */,
WindowPtr /* pWin */,
int /* kind */,
RegionPtr * /* destRgnp */,
RegionPtr /* srcRgn */,
int /* op */,
int /* xoff */,
int /* yoff */,
CreateDftPtr /* create */
#endif
);
#if NeedFunctionPrototypes
#define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */)
#else
#define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */)
#endif
static CREATE_PROC(CreateBoundingShape);
static CREATE_PROC(CreateClipShape);
#undef CREATE_PROC
static DISPATCH_PROC(ProcShapeCombine);
static DISPATCH_PROC(ProcShapeDispatch);
static DISPATCH_PROC(ProcShapeGetRectangles);
static DISPATCH_PROC(ProcShapeInputSelected);
static DISPATCH_PROC(ProcShapeMask);
static DISPATCH_PROC(ProcShapeOffset);
static DISPATCH_PROC(ProcShapeQueryExtents);
static DISPATCH_PROC(ProcShapeQueryVersion);
static DISPATCH_PROC(ProcShapeRectangles);
static DISPATCH_PROC(ProcShapeSelectInput);
static DISPATCH_PROC(SProcShapeCombine);
static DISPATCH_PROC(SProcShapeDispatch);
static DISPATCH_PROC(SProcShapeGetRectangles);
static DISPATCH_PROC(SProcShapeInputSelected);
static DISPATCH_PROC(SProcShapeMask);
static DISPATCH_PROC(SProcShapeOffset);
static DISPATCH_PROC(SProcShapeQueryExtents);
static DISPATCH_PROC(SProcShapeQueryVersion);
static DISPATCH_PROC(SProcShapeRectangles);
static DISPATCH_PROC(SProcShapeSelectInput);
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
#include "panoramiXsrv.h"
#endif #endif
static int ShapeFreeClient(), ShapeFreeEvents();
static void SendShapeNotify();
static int ProcShapeDispatch(), SProcShapeDispatch();
static void ShapeResetProc(), SShapeNotifyEvent();
static unsigned char ShapeReqCode = 0; static unsigned char ShapeReqCode = 0;
static int ShapeEventBase = 0; static int ShapeEventBase = 0;
static RESTYPE ClientType, EventType; /* resource types for event masks */ static RESTYPE ClientType, EventType; /* resource types for event masks */
#ifdef PANORAMIX
extern int PanoramiXNumScreens;
extern Bool noPanoramiXExtension;
extern PanoramiXWindow *PanoramiXWinRoot;
extern PanoramiXPmap *PanoramiXPmapRoot;
#endif
/* /*
* each window has a list of clients requesting * each window has a list of clients requesting
* ShapeNotify events. Each client has a resource * ShapeNotify events. Each client has a resource
@ -91,7 +166,7 @@ typedef struct _ShapeEvent {
void void
ShapeExtensionInit() ShapeExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
ClientType = CreateNewResourceType(ShapeFreeClient); ClientType = CreateNewResourceType(ShapeFreeClient);
EventType = CreateNewResourceType(ShapeFreeEvents); EventType = CreateNewResourceType(ShapeFreeEvents);
@ -102,7 +177,7 @@ ShapeExtensionInit()
{ {
ShapeReqCode = (unsigned char)extEntry->base; ShapeReqCode = (unsigned char)extEntry->base;
ShapeEventBase = extEntry->eventBase; ShapeEventBase = extEntry->eventBase;
EventSwapVector[ShapeEventBase] = SShapeNotifyEvent; EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
} }
} }
@ -113,7 +188,7 @@ ExtensionEntry *extEntry;
{ {
} }
static static int
RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
ClientPtr client; ClientPtr client;
WindowPtr pWin; WindowPtr pWin;
@ -121,7 +196,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
RegionPtr *destRgnp, srcRgn; RegionPtr *destRgnp, srcRgn;
int op; int op;
int xoff, yoff; int xoff, yoff;
RegionPtr (*create)(); /* creates a reasonable *destRgnp */ CreateDftPtr create; /* creates a reasonable *destRgnp */
{ {
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen = pWin->drawable.pScreen;
@ -133,7 +208,31 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
REGION_DESTROY(pScreen, srcRgn); REGION_DESTROY(pScreen, srcRgn);
return Success; return Success;
} }
switch (op) {
/* May/30/2001:
* The shape.PS specs say if src is None, existing shape is to be
* removed (and so the op-code has no meaning in such removal);
* see shape.PS, page 3, ShapeMask.
*/
if (srcRgn == NULL) {
if (*destRgnp != NULL) {
REGION_DESTROY (pScreen, *destRgnp);
*destRgnp = 0;
/* go on to remove shape and generate ShapeNotify */
}
else {
/* May/30/2001:
* The target currently has no shape in effect, so nothing to
* do here. The specs say that ShapeNotify is generated whenever
* the client region is "modified"; since no modification is done
* here, we do not generate that event. The specs does not say
* "it is an error to request removal when there is no shape in
* effect", so we return good status.
*/
return Success;
}
}
else switch (op) {
case ShapeSet: case ShapeSet:
if (*destRgnp) if (*destRgnp)
REGION_DESTROY(pScreen, *destRgnp); REGION_DESTROY(pScreen, *destRgnp);
@ -204,7 +303,6 @@ static int
ProcShapeQueryVersion (client) ProcShapeQueryVersion (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xShapeQueryVersionReq);
xShapeQueryVersionReply rep; xShapeQueryVersionReply rep;
register int n; register int n;
@ -228,42 +326,8 @@ ProcShapeQueryVersion (client)
* ProcShapeRectangles * ProcShapeRectangles
* *
*****************/ *****************/
#ifdef PANORAMIX
static int static int
ProcPanoramiXShapeRectangles (client)
register ClientPtr client;
{
WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype;
RegionPtr srcRgn;
RegionPtr *destRgn;
RegionPtr (*createDefault)();
int destBounding;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
IF_RETURN(!pPanoramiXWin, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id;
result = ProcShapeRectangles (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
static int
#endif
ProcShapeRectangles (client) ProcShapeRectangles (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -274,7 +338,7 @@ ProcShapeRectangles (client)
int nrects, ctype; int nrects, ctype;
RegionPtr srcRgn; RegionPtr srcRgn;
RegionPtr *destRgn; RegionPtr *destRgn;
RegionPtr (*createDefault)(); CreateDftPtr createDefault;
int destBounding; int destBounding;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
@ -324,49 +388,37 @@ ProcShapeRectangles (client)
stuff->xOff, stuff->yOff, createDefault); stuff->xOff, stuff->yOff, createDefault);
} }
/**************
* ProcShapeMask
**************/
#ifdef PANORAMIX #ifdef PANORAMIX
static int static int
ProcPanoramiXShapeMask (client) ProcPanoramiXShapeRectangles (client)
register ClientPtr client; register ClientPtr client;
{ {
WindowPtr pWin; REQUEST(xShapeRectanglesReq);
ScreenPtr pScreen; PanoramiXRes *win;
REQUEST(xShapeMaskReq); int j, result = 0;
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
RegionPtr (*createDefault)();
int destBounding;
register int result; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
PanoramiXPmap *pPmap = PanoramiXPmapRoot;
REQUEST_SIZE_MATCH (xShapeMaskReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest); client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
IF_RETURN(!pPanoramiXWin, BadRequest); return BadWindow;
PANORAMIXFIND_ID(pPmap, stuff->src);
IF_RETURN(!pPmap, BadRequest); FOR_NSCREENS(j) {
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) { stuff->dest = win->info[j].id;
stuff->dest = pPanoramiXWin->info[j].id; result = ProcShapeRectangles (client);
stuff->src = pPmap->info[j].id;
result = ProcShapeMask (client);
BREAK_IF(result != Success); BREAK_IF(result != Success);
} }
return (result); return (result);
} }
#endif #endif
#ifdef PANORAMIX
int /**************
#else * ProcShapeMask
**************/
static int static int
#endif
ProcShapeMask (client) ProcShapeMask (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -376,7 +428,7 @@ ProcShapeMask (client)
RegionPtr srcRgn; RegionPtr srcRgn;
RegionPtr *destRgn; RegionPtr *destRgn;
PixmapPtr pPixmap; PixmapPtr pPixmap;
RegionPtr (*createDefault)(); CreateDftPtr createDefault;
int destBounding; int destBounding;
REQUEST_SIZE_MATCH (xShapeMaskReq); REQUEST_SIZE_MATCH (xShapeMaskReq);
@ -425,45 +477,45 @@ ProcShapeMask (client)
stuff->xOff, stuff->yOff, createDefault); stuff->xOff, stuff->yOff, createDefault);
} }
/************
* ProcShapeCombine
************/
#ifdef PANORAMIX #ifdef PANORAMIX
static int static int
ProcPanoramiXShapeCombine (client) ProcPanoramiXShapeMask (client)
register ClientPtr client; register ClientPtr client;
{ {
WindowPtr pSrcWin, pDestWin; REQUEST(xShapeMaskReq);
ScreenPtr pScreen; PanoramiXRes *win, *pmap;
REQUEST(xShapeCombineReq); int j, result = 0;
RegionPtr srcRgn;
RegionPtr *destRgn;
RegionPtr (*createDefault)();
RegionPtr (*createSrc)();
RegionPtr tmp;
int destBounding;
register int result; REQUEST_SIZE_MATCH (xShapeMaskReq);
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_AT_LEAST_SIZE (xShapeCombineReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest); client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
IF_RETURN(!pPanoramiXWin, BadRequest); return BadWindow;
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id; if(stuff->src != None) {
result = ProcShapeCombine (client); if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->src, XRT_PIXMAP, SecurityReadAccess)))
return BadPixmap;
} else
pmap = NULL;
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
if(pmap)
stuff->src = pmap->info[j].id;
result = ProcShapeMask (client);
BREAK_IF(result != Success); BREAK_IF(result != Success);
} }
return (result); return (result);
} }
#endif #endif
#ifdef PANORAMIX
int /************
#else * ProcShapeCombine
************/
static int static int
#endif
ProcShapeCombine (client) ProcShapeCombine (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -472,8 +524,8 @@ ProcShapeCombine (client)
REQUEST(xShapeCombineReq); REQUEST(xShapeCombineReq);
RegionPtr srcRgn; RegionPtr srcRgn;
RegionPtr *destRgn; RegionPtr *destRgn;
RegionPtr (*createDefault)(); CreateDftPtr createDefault;
RegionPtr (*createSrc)(); CreateDftPtr createSrc;
RegionPtr tmp; RegionPtr tmp;
int destBounding; int destBounding;
@ -539,40 +591,41 @@ ProcShapeCombine (client)
stuff->xOff, stuff->yOff, createDefault); stuff->xOff, stuff->yOff, createDefault);
} }
/*************
* ProcShapeOffset
*************/
#ifdef PANORAMIX #ifdef PANORAMIX
static int static int
ProcPanoramiXShapeOffset (client) ProcPanoramiXShapeCombine (client)
register ClientPtr client; register ClientPtr client;
{ {
WindowPtr pWin; REQUEST(xShapeCombineReq);
ScreenPtr pScreen; PanoramiXRes *win, *win2;
REQUEST(xShapeOffsetReq); int j, result = 0;
RegionPtr srcRgn;
register int result; REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest); client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
IF_RETURN(!pPanoramiXWin, BadRequest); return BadWindow;
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id; if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
result = ProcShapeOffset (client); client, stuff->src, XRT_WINDOW, SecurityReadAccess)))
return BadWindow;
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
stuff->src = win2->info[j].id;
result = ProcShapeCombine (client);
BREAK_IF(result != Success); BREAK_IF(result != Success);
} }
return (result); return (result);
} }
#endif #endif
#ifdef PANORAMIX /*************
int * ProcShapeOffset
#else *************/
static int static int
#endif
ProcShapeOffset (client) ProcShapeOffset (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -607,6 +660,32 @@ ProcShapeOffset (client)
return Success; return Success;
} }
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset (client)
register ClientPtr client;
{
REQUEST(xShapeOffsetReq);
PanoramiXRes *win;
int j, result = 0;
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ProcShapeOffset (client);
if(result != Success) break;
}
return (result);
}
#endif
static int static int
ProcShapeQueryExtents (client) ProcShapeQueryExtents (client)
register ClientPtr client; register ClientPtr client;
@ -616,6 +695,7 @@ ProcShapeQueryExtents (client)
xShapeQueryExtentsReply rep; xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents; BoxRec extents, *pExtents;
register int n; register int n;
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client); pWin = LookupWindow (stuff->window, client);
@ -626,9 +706,9 @@ ProcShapeQueryExtents (client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.boundingShaped = (wBoundingShape(pWin) != 0); rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.clipShaped = (wClipShape(pWin) != 0); rep.clipShaped = (wClipShape(pWin) != 0);
if (wBoundingShape(pWin)) { if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin)); pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents; extents = *pExtents;
} else { } else {
extents.x1 = -wBorderWidth (pWin); extents.x1 = -wBorderWidth (pWin);
@ -640,9 +720,9 @@ ProcShapeQueryExtents (client)
rep.yBoundingShape = extents.y1; rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1; rep.widthBoundingShape = extents.x2 - extents.x1;
rep.heightBoundingShape = extents.y2 - extents.y1; rep.heightBoundingShape = extents.y2 - extents.y1;
if (wClipShape(pWin)) { if ((region = wClipShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin)); pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents; extents = *pExtents;
} else { } else {
extents.x1 = 0; extents.x1 = 0;
@ -1001,37 +1081,29 @@ ProcShapeDispatch (client)
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
return ProcPanoramiXShapeRectangles (client); return ProcPanoramiXShapeRectangles (client);
else else
return ProcShapeRectangles (client);
#else
return ProcShapeRectangles (client);
#endif #endif
return ProcShapeRectangles (client);
case X_ShapeMask: case X_ShapeMask:
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
return ProcPanoramiXShapeMask (client); return ProcPanoramiXShapeMask (client);
else else
return ProcShapeMask (client);
#else
return ProcShapeMask (client);
#endif #endif
return ProcShapeMask (client);
case X_ShapeCombine: case X_ShapeCombine:
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
return ProcPanoramiXShapeCombine (client); return ProcPanoramiXShapeCombine (client);
else else
return ProcShapeCombine (client);
#else
return ProcShapeCombine (client);
#endif #endif
return ProcShapeCombine (client);
case X_ShapeOffset: case X_ShapeOffset:
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
return ProcPanoramiXShapeOffset (client); return ProcPanoramiXShapeOffset (client);
else else
return ProcShapeOffset (client);
#else
return ProcShapeOffset (client);
#endif #endif
return ProcShapeOffset (client);
case X_ShapeQueryExtents: case X_ShapeQueryExtents:
return ProcShapeQueryExtents (client); return ProcShapeQueryExtents (client);
case X_ShapeSelectInput: case X_ShapeSelectInput:

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.36 2002/04/03 19:51:11 herrb Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group
@ -29,8 +30,15 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shm.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */ /* $Xorg: shm.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
#include <sys/types.h> #include <sys/types.h>
#ifndef Lynx
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#else
#include <ipc.h>
#include <shm.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
#include "X.h" #include "X.h"
@ -48,6 +56,14 @@ in this Software without prior written authorization from The Open Group.
#define _XSHM_SERVER_ #define _XSHM_SERVER_
#include "shmstr.h" #include "shmstr.h"
#include "Xfuncproto.h" #include "Xfuncproto.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
typedef struct _ShmDesc { typedef struct _ShmDesc {
struct _ShmDesc *next; struct _ShmDesc *next;
@ -58,21 +74,57 @@ typedef struct _ShmDesc {
unsigned long size; unsigned long size;
} ShmDescRec, *ShmDescPtr; } ShmDescRec, *ShmDescPtr;
static void miShmPutImage(), fbShmPutImage(); static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
static PixmapPtr fbShmCreatePixmap(); static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
static int ProcShmDispatch(), SProcShmDispatch(); static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(); static int ShmDetachSegment(
static void ShmResetProc(), SShmCompletionEvent(); #if NeedFunctionPrototypes
pointer /* value */,
XID /* shmseg */
#endif
);
static void ShmResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static void SShmCompletionEvent(
#if NeedFunctionPrototypes
xShmCompletionEvent * /* from */,
xShmCompletionEvent * /* to */
#endif
);
static Bool ShmDestroyPixmap (PixmapPtr pPixmap);
static DISPATCH_PROC(ProcShmAttach);
static DISPATCH_PROC(ProcShmCreatePixmap);
static DISPATCH_PROC(ProcShmDetach);
static DISPATCH_PROC(ProcShmDispatch);
static DISPATCH_PROC(ProcShmGetImage);
static DISPATCH_PROC(ProcShmPutImage);
static DISPATCH_PROC(ProcShmQueryVersion);
static DISPATCH_PROC(SProcShmAttach);
static DISPATCH_PROC(SProcShmCreatePixmap);
static DISPATCH_PROC(SProcShmDetach);
static DISPATCH_PROC(SProcShmDispatch);
static DISPATCH_PROC(SProcShmGetImage);
static DISPATCH_PROC(SProcShmPutImage);
static DISPATCH_PROC(SProcShmQueryVersion);
static unsigned char ShmReqCode; static unsigned char ShmReqCode;
static int ShmCompletionCode; int ShmCompletionCode;
static int BadShmSegCode; int BadShmSegCode;
static RESTYPE ShmSegType, ShmPixType; RESTYPE ShmSegType;
static ShmDescPtr Shmsegs; static ShmDescPtr Shmsegs;
static Bool sharedPixmaps; static Bool sharedPixmaps;
static int pixmapFormat; static int pixmapFormat;
static int shmPixFormat[MAXSCREENS]; static int shmPixFormat[MAXSCREENS];
static ShmFuncsPtr shmFuncs[MAXSCREENS]; static ShmFuncsPtr shmFuncs[MAXSCREENS];
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
#ifdef PIXPRIV
static int shmPixmapPrivate;
#endif
static ShmFuncs miFuncs = {NULL, miShmPutImage}; static ShmFuncs miFuncs = {NULL, miShmPutImage};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
@ -106,20 +158,60 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
} \ } \
} }
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/signal.h>
static Bool badSysCall = FALSE;
static void
SigSysHandler(signo)
int signo;
{
badSysCall = TRUE;
}
static Bool CheckForShmSyscall()
{
void (*oldHandler)();
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
oldHandler = signal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
/* Clean up */
if (shmid != -1)
{
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
}
signal(SIGSYS, oldHandler);
return(!badSysCall);
}
#endif
void void
ShmExtensionInit() ShmExtensionInit()
{ {
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
int i; int i;
#ifdef INTERNAL_VS_EXTERNAL_PADDING #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
if (!CheckForShmSyscall())
{
ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
return;
}
#endif
sharedPixmaps = xFalse; sharedPixmaps = xFalse;
pixmapFormat = 0; pixmapFormat = 0;
#else
sharedPixmaps = xTrue;
pixmapFormat = shmPixFormat[0];
for (i = 0; i < screenInfo.numScreens; i++)
{ {
sharedPixmaps = xTrue;
pixmapFormat = shmPixFormat[0];
for (i = 0; i < screenInfo.numScreens; i++)
{
if (!shmFuncs[i]) if (!shmFuncs[i])
shmFuncs[i] = &miFuncs; shmFuncs[i] = &miFuncs;
if (!shmFuncs[i]->CreatePixmap) if (!shmFuncs[i]->CreatePixmap)
@ -129,13 +221,29 @@ ShmExtensionInit()
sharedPixmaps = xFalse; sharedPixmaps = xFalse;
pixmapFormat = 0; pixmapFormat = 0;
} }
} }
if (!pixmapFormat) if (!pixmapFormat)
pixmapFormat = ZPixmap; pixmapFormat = ZPixmap;
if (sharedPixmaps)
{
for (i = 0; i < screenInfo.numScreens; i++)
{
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
#ifdef PIXPRIV
shmPixmapPrivate = AllocatePixmapPrivateIndex();
for (i = 0; i < screenInfo.numScreens; i++)
{
if (!AllocatePixmapPrivate(screenInfo.screens[i],
shmPixmapPrivate, 0))
return;
}
#endif #endif
}
}
ShmSegType = CreateNewResourceType(ShmDetachSegment); ShmSegType = CreateNewResourceType(ShmDetachSegment);
ShmPixType = CreateNewResourceType(ShmDetachSegment); if (ShmSegType &&
if (ShmSegType && ShmPixType &&
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
ProcShmDispatch, SProcShmDispatch, ProcShmDispatch, SProcShmDispatch,
ShmResetProc, StandardMinorOpcode))) ShmResetProc, StandardMinorOpcode)))
@ -143,7 +251,7 @@ ShmExtensionInit()
ShmReqCode = (unsigned char)extEntry->base; ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase; ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase; BadShmSegCode = extEntry->errorBase;
EventSwapVector[ShmCompletionCode] = SShmCompletionEvent; EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
} }
} }
@ -177,6 +285,41 @@ ShmSetPixmapFormat(pScreen, format)
shmPixFormat[pScreen->myNum] = format; shmPixFormat[pScreen->myNum] = format;
} }
static Bool
ShmDestroyPixmap (PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
Bool ret;
if (pPixmap->refcnt == 1)
{
ShmDescPtr shmdesc;
#ifdef PIXPRIV
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
#else
char *base = (char *) pPixmap->devPrivate.ptr;
if (base != (pointer) (pPixmap + 1))
{
for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next)
{
if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size)
break;
}
}
else
shmdesc = 0;
#endif
if (shmdesc)
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
}
pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum];
ret = (*pScreen->DestroyPixmap) (pPixmap);
destroyPixmap[pScreen->myNum] = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
return ret;
}
void void
ShmRegisterFbFuncs(pScreen) ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen; ScreenPtr pScreen;
@ -188,7 +331,6 @@ static int
ProcShmQueryVersion(client) ProcShmQueryVersion(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xShmQueryVersionReq);
xShmQueryVersionReply rep; xShmQueryVersionReply rep;
register int n; register int n;
@ -214,6 +356,47 @@ ProcShmQueryVersion(client)
return (client->noClientException); return (client->noClientException);
} }
/*
* Simulate the access() system call for a shared memory segement,
* using the credentials from the client if available
*/
static int
shm_access(ClientPtr client, struct ipc_perm *perm, int readonly)
{
int uid, gid;
mode_t mask;
if (LocalClientCred(client, &uid, &gid) != -1) {
/* User id 0 always gets access */
if (uid == 0) {
return 0;
}
/* Check the owner */
if (perm->uid == uid || perm->cuid == uid) {
mask = S_IRUSR;
if (!readonly) {
mask |= S_IWUSR;
}
return (perm->mode & mask) == mask ? 0 : -1;
}
/* Check the group */
if (perm->gid == gid || perm->cgid == gid) {
mask = S_IRGRP;
if (!readonly) {
mask |= S_IWGRP;
}
return (perm->mode & mask) == mask ? 0 : -1;
}
}
/* Otherwise, check everyone else */
mask = S_IROTH;
if (!readonly) {
mask |= S_IWOTH;
}
return (perm->mode & mask) == mask ? 0 : -1;
}
static int static int
ProcShmAttach(client) ProcShmAttach(client)
register ClientPtr client; register ClientPtr client;
@ -252,6 +435,17 @@ ProcShmAttach(client)
xfree(shmdesc); xfree(shmdesc);
return BadAccess; return BadAccess;
} }
/* The attach was performed with root privs. We must
* do manual checking of access rights for the credentials
* of the client */
if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
xfree(shmdesc);
return BadAccess;
}
shmdesc->shmid = stuff->shmid; shmdesc->shmid = stuff->shmid;
shmdesc->refcnt = 1; shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly; shmdesc->writable = !stuff->readOnly;
@ -342,7 +536,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pPixmap; PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
/*XXX*/depth, PixmapBytePad(w, depth), (pointer)data); BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
if (!pPixmap) if (!pPixmap)
return; return;
if (format == XYBitmap) if (format == XYBitmap)
@ -358,6 +552,251 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
data); data);
} }
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(register ClientPtr client)
{
int j, result = 0, orig_x, orig_y;
PanoramiXRes *draw, *gc;
Bool sendEvent, isRoot;
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->gc, XRT_GC, SecurityReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
orig_x = stuff->dstX;
orig_y = stuff->dstY;
sendEvent = stuff->sendEvent;
stuff->sendEvent = 0;
FOR_NSCREENS(j) {
if(!j) stuff->sendEvent = sendEvent;
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
stuff->dstX = orig_x - panoramiXdataPtr[j].x;
stuff->dstY = orig_y - panoramiXdataPtr[j].y;
}
result = ProcShmPutImage(client);
if(result != client->noClientException) break;
}
return(result);
}
static int
ProcPanoramiXShmGetImage(ClientPtr client)
{
PanoramiXRes *draw;
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDraw;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int i, x, y, w, h, format;
Mask plane = 0, planemask;
long lenPer = 0, length, widthBytesLine;
Bool isRoot;
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
return(BadValue);
}
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
return BadDrawable;
if (draw->type == XRT_PIXMAP)
return ProcShmGetImage(client);
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
x = stuff->x;
y = stuff->y;
w = stuff->width;
h = stuff->height;
format = stuff->format;
planemask = stuff->planeMask;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
if(isRoot) {
if( /* check for being onscreen */
x < 0 || x + w > PanoramiXPixWidth ||
y < 0 || y + h > PanoramiXPixHeight )
return(BadMatch);
} else {
if( /* check for being onscreen */
panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
/* check for being inside of border */
x < - wBorderWidth((WindowPtr)pDraw) ||
x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
y < -wBorderWidth((WindowPtr)pDraw) ||
y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
return(BadMatch);
}
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
xgi.visual = wVisual(((WindowPtr)pDraw));
xgi.type = X_Reply;
xgi.length = 0;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
if(format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
} else {
widthBytesLine = PixmapBytePad(w, 1);
lenPer = widthBytesLine * h;
plane = ((Mask)1) << (pDraw->depth - 1);
length = lenPer * Ones(planemask & (plane | (plane - 1)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
if (length == 0) {/* nothing to do */ }
else if (format == ZPixmap) {
XineramaGetImageData(drawables, x, y, w, h, format, planemask,
shmdesc->addr + stuff->offset,
widthBytesLine, isRoot);
} else {
length = stuff->offset;
for (; plane; plane >>= 1) {
if (planemask & plane) {
XineramaGetImageData(drawables, x, y, w, h,
format, plane, shmdesc->addr + length,
widthBytesLine, isRoot);
length += lenPer;
}
}
}
if (client->swapped) {
register int n;
swaps(&xgi.sequenceNumber, n);
swapl(&xgi.length, n);
swapl(&xgi.visual, n);
swapl(&xgi.size, n);
}
WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
return(client->noClientException);
}
static int
ProcPanoramiXShmCreatePixmap(client)
register ClientPtr client;
{
ScreenPtr pScreen = NULL;
PixmapPtr pMap = NULL;
DrawablePtr pDraw;
DepthPtr pDepth;
int i, j, result;
ShmDescPtr shmdesc;
REQUEST(xShmCreatePixmapReq);
PanoramiXRes *newPix;
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
client->errorValue = stuff->pid;
if (!sharedPixmaps)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (!stuff->width || !stuff->height)
{
client->errorValue = 0;
return BadValue;
}
if (stuff->depth != 1)
{
pDepth = pDraw->pScreen->allowedDepths;
for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
if (pDepth->depth == stuff->depth)
goto CreatePmap;
client->errorValue = stuff->depth;
return BadValue;
}
CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset,
PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
client);
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
newPix->u.pix.shared = TRUE;
newPix->info[0].id = stuff->pid;
for(j = 1; j < PanoramiXNumScreens; j++)
newPix->info[j].id = FakeClientID(client->index);
result = (client->noClientException);
FOR_NSCREENS(j) {
pScreen = screenInfo.screens[j];
pMap = (*shmFuncs[j]->CreatePixmap)(pScreen,
stuff->width, stuff->height, stuff->depth,
shmdesc->addr + stuff->offset);
if (pMap) {
#ifdef PIXPRIV
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
(*pScreen->DestroyPixmap)(pMap);
result = BadAlloc;
break;
}
} else {
result = BadAlloc;
break;
}
}
if(result == BadAlloc) {
while(j--) {
(*pScreen->DestroyPixmap)(pMap);
FreeResource(newPix->info[j].id, RT_NONE);
}
xfree(newPix);
} else
AddResource(stuff->pid, XRT_PIXMAP, newPix);
return result;
}
#endif
static int static int
ProcShmPutImage(client) ProcShmPutImage(client)
register ClientPtr client; register ClientPtr client;
@ -365,11 +804,6 @@ ProcShmPutImage(client)
register GCPtr pGC; register GCPtr pGC;
register DrawablePtr pDraw; register DrawablePtr pDraw;
long length; long length;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
long lengthProto;
char *tmpImage;
int tmpAlloced = 0;
#endif
ShmDescPtr shmdesc; ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq); REQUEST(xShmPutImageReq);
@ -383,9 +817,6 @@ ProcShmPutImage(client)
if (stuff->depth != 1) if (stuff->depth != 1)
return BadMatch; return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1); length = PixmapBytePad(stuff->totalWidth, 1);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
#endif
} }
else if (stuff->format == XYPixmap) else if (stuff->format == XYPixmap)
{ {
@ -393,19 +824,12 @@ ProcShmPutImage(client)
return BadMatch; return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1); length = PixmapBytePad(stuff->totalWidth, 1);
length *= stuff->depth; length *= stuff->depth;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
lengthProto *= stuff->depth;
#endif
} }
else if (stuff->format == ZPixmap) else if (stuff->format == ZPixmap)
{ {
if (pDraw->depth != stuff->depth) if (pDraw->depth != stuff->depth)
return BadMatch; return BadMatch;
length = PixmapBytePad(stuff->totalWidth, stuff->depth); length = PixmapBytePad(stuff->totalWidth, stuff->depth);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth);
#endif
} }
else else
{ {
@ -413,13 +837,8 @@ ProcShmPutImage(client)
return BadValue; return BadValue;
} }
#ifdef INTERNAL_VS_EXTERNAL_PADDING
VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight,
client);
#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
client); client);
#endif
if (stuff->srcX > stuff->totalWidth) if (stuff->srcX > stuff->totalWidth)
{ {
client->errorValue = stuff->srcX; client->errorValue = stuff->srcX;
@ -441,63 +860,6 @@ ProcShmPutImage(client)
return BadValue; return BadValue;
} }
#ifdef INTERNAL_VS_EXTERNAL_PADDING
/* handle 64 bit case where protocol may pad to 32 and we want 64
* In this case, length is what the server wants and lengthProto is
* what the protocol thinks it is. If the the two are different,
* copy the protocol version (i.e. the memory shared between the
* server and the client) to a version with a scanline pad of 64.
*/
if (length != lengthProto)
{
register int i;
char * stuffptr, /* pointer into protocol data */
* tmpptr; /* new location to copy to */
if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
return (BadAlloc);
tmpAlloced = 1;
bzero(tmpImage,length*stuff->totalHeight);
if (stuff->format == XYPixmap)
{
int lineBytes = PixmapBytePad(stuff->totalWidth, 1);
int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1);
int depth = stuff->depth;
stuffptr = shmdesc->addr + stuff->offset ;
tmpptr = tmpImage;
for (i = 0; i < stuff->totalHeight*stuff->depth;
stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
bcopy(stuffptr,tmpptr,lineBytesProto);
}
else
{
for (i = 0,
stuffptr = shmdesc->addr + stuff->offset,
tmpptr=tmpImage;
i < stuff->totalHeight;
stuffptr += lengthProto,tmpptr += length, i++)
bcopy(stuffptr,tmpptr,lengthProto);
}
}
/* handle 64-bit case where stuff is not 64-bit aligned
*/
else if ((unsigned long)(shmdesc->addr+stuff->offset) &
(sizeof(long)-1))
{
if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
return (BadAlloc);
tmpAlloced = 1;
bcopy((char *)(shmdesc->addr+stuff->offset),
tmpImage,
length*stuff->totalHeight);
}
else
tmpImage = (char *)(shmdesc->addr+stuff->offset);
#endif
if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
((stuff->format != ZPixmap) && ((stuff->format != ZPixmap) &&
(stuff->srcX < screenInfo.bitmapScanlinePad) && (stuff->srcX < screenInfo.bitmapScanlinePad) &&
@ -509,11 +871,7 @@ ProcShmPutImage(client)
stuff->dstX, stuff->dstY, stuff->dstX, stuff->dstY,
stuff->totalWidth, stuff->srcHeight, stuff->totalWidth, stuff->srcHeight,
stuff->srcX, stuff->format, stuff->srcX, stuff->format,
#ifdef INTERNAL_VS_EXTERNAL_PADDING
tmpImage +
#else
shmdesc->addr + stuff->offset + shmdesc->addr + stuff->offset +
#endif
(stuff->srcY * length)); (stuff->srcY * length));
else else
(*shmFuncs[pDraw->pScreen->myNum]->PutImage)( (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
@ -522,12 +880,7 @@ ProcShmPutImage(client)
stuff->srcX, stuff->srcY, stuff->srcX, stuff->srcY,
stuff->srcWidth, stuff->srcHeight, stuff->srcWidth, stuff->srcHeight,
stuff->dstX, stuff->dstY, stuff->dstX, stuff->dstY,
#ifdef INTERNAL_VS_EXTERNAL_PADDING
tmpImage);
#else
shmdesc->addr + stuff->offset); shmdesc->addr + stuff->offset);
#endif
if (stuff->sendEvent) if (stuff->sendEvent)
{ {
@ -543,12 +896,7 @@ ProcShmPutImage(client)
WriteEventsToClient(client, 1, (xEvent *) &ev); WriteEventsToClient(client, 1, (xEvent *) &ev);
} }
#ifdef INTERNAL_VS_EXTERNAL_PADDING return (client->noClientException);
if (tmpAlloced)
DEALLOCATE_LOCAL(tmpImage);
#endif
return (client->noClientException);
} }
@ -558,17 +906,11 @@ ProcShmGetImage(client)
register ClientPtr client; register ClientPtr client;
{ {
register DrawablePtr pDraw; register DrawablePtr pDraw;
long lenPer, length; long lenPer = 0, length;
Mask plane; Mask plane = 0;
xShmGetImageReply xgi; xShmGetImageReply xgi;
ShmDescPtr shmdesc; ShmDescPtr shmdesc;
int n; int n;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
long widthBytesLine,widthBytesLineProto;
long lenPerProto,lengthProto;
char *tmpImage;
int tmpAlloced = 0;
#endif
REQUEST(xShmGetImageReq); REQUEST(xShmGetImageReq);
@ -616,43 +958,18 @@ ProcShmGetImage(client)
xgi.depth = pDraw->depth; xgi.depth = pDraw->depth;
if(stuff->format == ZPixmap) if(stuff->format == ZPixmap)
{ {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
length = widthBytesLine * stuff->height;
widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
lengthProto = widthBytesLineProto * stuff->height;
#else
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
#endif
} }
else else
{ {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
widthBytesLine = PixmapBytePad(stuff->width, 1);
lenPer = widthBytesLine * stuff->height;
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
widthBytesLineProto = PixmapBytePadProto(stuff->width, 1);
lenPerProto = widthBytesLineProto * stuff->height;
lengthProto = lenPerProto * Ones(stuff->planeMask &
(plane | (plane - 1)));
#else
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
plane = ((Mask)1) << (pDraw->depth - 1); plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */ /* only planes asked for */
length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
#endif
} }
#ifdef INTERNAL_VS_EXTERNAL_PADDING
VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client);
xgi.size = lengthProto;
#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length; xgi.size = length;
#endif
if (length == 0) if (length == 0)
{ {
@ -660,105 +977,25 @@ ProcShmGetImage(client)
} }
else if (stuff->format == ZPixmap) else if (stuff->format == ZPixmap)
{ {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
/* check for protocol/server padding differences.
*/
if ((widthBytesLine != widthBytesLineProto) ||
((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1)))
{
/* temp stuff for 64 bit alignment stuff */
register char * bufPtr, * protoPtr;
register int i;
if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
return (BadAlloc);
tmpAlloced = 1;
(*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
tmpImage);
/* for 64-bit server, convert image to pad to 32 bits
*/
bzero(shmdesc->addr + stuff->offset,lengthProto);
for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset;
i < stuff->height;
bufPtr += widthBytesLine,protoPtr += widthBytesLineProto,
i++)
bcopy(bufPtr,protoPtr,widthBytesLineProto);
}
else
{
(*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
}
#else
(*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height, stuff->width, stuff->height,
stuff->format, stuff->planeMask, stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset); shmdesc->addr + stuff->offset);
#endif
} }
else else
{ {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
/* check for protocol/server padding differences.
*/
if ((widthBytesLine != widthBytesLineProto) ||
((unsigned long)shmdesc->addr + stuff->offset &
(sizeof(long)-1)))
{
if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
return (BadAlloc);
tmpAlloced = 1;
}
#endif
length = stuff->offset; length = stuff->offset;
for (; plane; plane >>= 1) for (; plane; plane >>= 1)
{ {
if (stuff->planeMask & plane) if (stuff->planeMask & plane)
{ {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
if ((widthBytesLine != widthBytesLineProto) ||
((unsigned long)shmdesc->addr + stuff->offset &
(sizeof(long)-1)))
{
/* get image for each plane.
*/
(*pDraw->pScreen->GetImage)(pDraw,
stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, plane,
tmpImage);
/* for 64-bit server, convert image to pad to 32 bits */
bzero(shmdesc->addr+length, widthBytesLine);
bcopy(tmpImage, shmdesc->addr+length, widthBytesLineProto);
/* increment length */
length += lenPerProto;
}
else /* no diff between protocol and server */
{
(*pDraw->pScreen->GetImage)(pDraw,
stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
length += lenPer;
}
#else
(*pDraw->pScreen->GetImage)(pDraw, (*pDraw->pScreen->GetImage)(pDraw,
stuff->x, stuff->y, stuff->x, stuff->y,
stuff->width, stuff->height, stuff->width, stuff->height,
stuff->format, plane, stuff->format, plane,
shmdesc->addr + length); shmdesc->addr + length);
length += lenPer; length += lenPer;
#endif
} }
} }
} }
@ -771,11 +1008,6 @@ ProcShmGetImage(client)
} }
WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
if (tmpAlloced)
DEALLOCATE_LOCAL(tmpImage);
#endif
return(client->noClientException); return(client->noClientException);
} }
@ -794,8 +1026,10 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
return NullPixmap; return NullPixmap;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
/*XXX*/depth, PixmapBytePad(width, depth), (pointer)addr)) BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
(*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap; return NullPixmap;
}
return pPixmap; return pPixmap;
} }
@ -841,14 +1075,15 @@ CreatePmap:
shmdesc->addr + stuff->offset); shmdesc->addr + stuff->offset);
if (pMap) if (pMap)
{ {
#ifdef PIXPRIV
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid; pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
{ {
shmdesc->refcnt++; return(client->noClientException);
if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc))
return(client->noClientException);
FreeResource(stuff->pid, RT_NONE);
} }
} }
return (BadAlloc); return (BadAlloc);
@ -868,11 +1103,23 @@ ProcShmDispatch (client)
case X_ShmDetach: case X_ShmDetach:
return ProcShmDetach(client); return ProcShmDetach(client);
case X_ShmPutImage: case X_ShmPutImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmPutImage(client);
#endif
return ProcShmPutImage(client); return ProcShmPutImage(client);
case X_ShmGetImage: case X_ShmGetImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmGetImage(client);
#endif
return ProcShmGetImage(client); return ProcShmGetImage(client);
case X_ShmCreatePixmap: case X_ShmCreatePixmap:
return ProcShmCreatePixmap(client); #ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmCreatePixmap(client);
#endif
return ProcShmCreatePixmap(client);
default: default:
return BadRequest; return BadRequest;
} }

View File

@ -25,9 +25,11 @@ in this Software without prior written authorization from The Open Group.
* *
* Author: Keith Packard, MIT X Consortium * Author: Keith Packard, MIT X Consortium
*/ */
/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
/* dixsleep.c - implement millisecond timeouts for X clients */ /* dixsleep.c - implement millisecond timeouts for X clients */
#include "sleepuntil.h"
#include "X.h" #include "X.h"
#include "Xmd.h" #include "Xmd.h"
#include "misc.h" #include "misc.h"
@ -41,7 +43,13 @@ typedef struct _Sertafied {
TimeStamp revive; TimeStamp revive;
ClientPtr pClient; ClientPtr pClient;
XID id; XID id;
void (*notifyFunc)(); void (*notifyFunc)(
#if NeedNestedPrototypes
ClientPtr /* client */,
pointer /* closure */
#endif
);
pointer closure; pointer closure;
} SertafiedRec, *SertafiedPtr; } SertafiedRec, *SertafiedPtr;
@ -49,11 +57,35 @@ static SertafiedPtr pPending;
static RESTYPE SertafiedResType; static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered; static Bool BlockHandlerRegistered;
static int SertafiedGeneration; static int SertafiedGeneration;
static void ClientAwaken();
static int SertafiedDelete();
static void SertafiedBlockHandler();
static void SertafiedWakeupHandler();
static void ClientAwaken(
#if NeedFunctionPrototypes
ClientPtr /* client */,
pointer /* closure */
#endif
);
static int SertafiedDelete(
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
static void SertafiedBlockHandler(
#if NeedFunctionPrototypes
pointer /* data */,
OSTimePtr /* wt */,
pointer /* LastSelectMask */
#endif
);
static void SertafiedWakeupHandler(
#if NeedFunctionPrototypes
pointer /* data */,
int /* i */,
pointer /* LastSelectMask */
#endif
);
int
ClientSleepUntil (client, revive, notifyFunc, closure) ClientSleepUntil (client, revive, notifyFunc, closure)
ClientPtr client; ClientPtr client;
TimeStamp *revive; TimeStamp *revive;
@ -152,7 +184,7 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pointer LastSelectMask; pointer LastSelectMask;
{ {
SertafiedPtr pReq, pNext; SertafiedPtr pReq, pNext;
unsigned long newdelay, olddelay; unsigned long delay;
TimeStamp now; TimeStamp now;
if (!pPending) if (!pPending)
@ -177,8 +209,8 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pReq = pPending; pReq = pPending;
if (!pReq) if (!pReq)
return; return;
newdelay = pReq->revive.milliseconds - now.milliseconds; delay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay (wt, newdelay); AdjustWaitForDelay (wt, delay);
} }
static void static void

View File

@ -50,10 +50,10 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.11 2001/12/14 19:58:51 dawes Exp $ */
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
#include <stdio.h>
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "Xmd.h" #include "Xmd.h"
@ -67,6 +67,15 @@ PERFORMANCE OF THIS SOFTWARE.
#include "sync.h" #include "sync.h"
#include "syncstr.h" #include "syncstr.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#else
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
#endif
/* /*
* Local Global Variables * Local Global Variables
*/ */
@ -87,13 +96,254 @@ static SyncCounter **SysCounterList = NULL;
#define XSyncCAAllTrigger \ #define XSyncCAAllTrigger \
(XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType) (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
static void SyncComputeBracketValues( static int
FreeAlarm(
#if NeedFunctionPrototypes #if NeedFunctionPrototypes
SyncCounter * /* pCounter */, pointer /* addr */,
Bool /* startOver */ XID /* id */
#endif #endif
); );
static int
FreeAlarmClient(
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
static int
FreeAwait(
#if NeedFunctionPrototypes
pointer /* addr */,
XID /* id */
#endif
);
static void
ServertimeBracketValues(
#if NeedFunctionPrototypes
pointer /* pCounter */,
CARD64 * /* pbracket_less */,
CARD64 * /* pbracket_greater */
#endif
);
static void
ServertimeQueryValue(
#if NeedFunctionPrototypes
pointer /* pCounter */,
CARD64 * /* pValue_return */
#endif
);
static void
ServertimeWakeupHandler(
#if NeedFunctionPrototypes
pointer /* env */,
int /* rc */,
pointer /* LastSelectMask */
#endif
);
static int
SyncInitTrigger(
#if NeedFunctionPrototypes
ClientPtr /* client */,
SyncTrigger * /* pTrigger */,
XSyncCounter /* counter */,
Mask /* changes */
#endif
);
static void
SAlarmNotifyEvent(
#if NeedFunctionPrototypes
xSyncAlarmNotifyEvent * /* from */,
xSyncAlarmNotifyEvent * /* to */
#endif
);
static void
SCounterNotifyEvent(
#if NeedFunctionPrototypes
xSyncCounterNotifyEvent * /* from */,
xSyncCounterNotifyEvent * /* to */
#endif
);
static void
ServertimeBlockHandler(
#if NeedFunctionPrototypes
pointer /* env */,
struct timeval ** /* wt */,
pointer /* LastSelectMask */
#endif
);
static int
SyncAddTriggerToCounter(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */
#endif
);
extern void
SyncAlarmCounterDestroyed(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */
#endif
);
static void
SyncAlarmTriggerFired(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */
#endif
);
static void
SyncAwaitTriggerFired(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */
#endif
);
static int
SyncChangeAlarmAttributes(
#if NeedFunctionPrototypes
ClientPtr /* client */,
SyncAlarm * /* pAlarm */,
Mask /* mask */,
CARD32 * /* values */
#endif
);
static Bool
SyncCheckTriggerNegativeComparison(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */,
CARD64 /* oldval */
#endif
);
static Bool
SyncCheckTriggerNegativeTransition(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */,
CARD64 /* oldval */
#endif
);
static Bool
SyncCheckTriggerPositiveComparison(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */,
CARD64 /* oldval */
#endif
);
static Bool
SyncCheckTriggerPositiveTransition(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */,
CARD64 /* oldval */
#endif
);
static SyncCounter *
SyncCreateCounter(
#if NeedFunctionPrototypes
ClientPtr /* client */,
XSyncCounter /* id */,
CARD64 /* initialvalue */
#endif
);
static void SyncComputeBracketValues(
#if NeedFunctionPrototypes
SyncCounter * /* pCounter */,
Bool /* startOver */
#endif
);
static void
SyncDeleteTriggerFromCounter(
#if NeedFunctionPrototypes
SyncTrigger * /* pTrigger */
#endif
);
static Bool
SyncEventSelectForAlarm(
#if NeedFunctionPrototypes
SyncAlarm * /* pAlarm */,
ClientPtr /* client */,
Bool /* wantevents */
#endif
);
static void
SyncInitServerTime(
#if NeedFunctionPrototypes
void
#endif
);
static void
SyncResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static void
SyncSendAlarmNotifyEvents(
#if NeedFunctionPrototypes
SyncAlarm * /* pAlarm */
#endif
);
static void
SyncSendCounterNotifyEvents(
#if NeedFunctionPrototypes
ClientPtr /* client */,
SyncAwait ** /* ppAwait */,
int /* num_events */
#endif
);
static DISPATCH_PROC(ProcSyncAwait);
static DISPATCH_PROC(ProcSyncChangeAlarm);
static DISPATCH_PROC(ProcSyncChangeCounter);
static DISPATCH_PROC(ProcSyncCreateAlarm);
static DISPATCH_PROC(ProcSyncCreateCounter);
static DISPATCH_PROC(ProcSyncDestroyAlarm);
static DISPATCH_PROC(ProcSyncDestroyCounter);
static DISPATCH_PROC(ProcSyncDispatch);
static DISPATCH_PROC(ProcSyncGetPriority);
static DISPATCH_PROC(ProcSyncInitialize);
static DISPATCH_PROC(ProcSyncListSystemCounters);
static DISPATCH_PROC(ProcSyncQueryAlarm);
static DISPATCH_PROC(ProcSyncQueryCounter);
static DISPATCH_PROC(ProcSyncSetCounter);
static DISPATCH_PROC(ProcSyncSetPriority);
static DISPATCH_PROC(SProcSyncAwait);
static DISPATCH_PROC(SProcSyncChangeAlarm);
static DISPATCH_PROC(SProcSyncChangeCounter);
static DISPATCH_PROC(SProcSyncCreateAlarm);
static DISPATCH_PROC(SProcSyncCreateCounter);
static DISPATCH_PROC(SProcSyncDestroyAlarm);
static DISPATCH_PROC(SProcSyncDestroyCounter);
static DISPATCH_PROC(SProcSyncDispatch);
static DISPATCH_PROC(SProcSyncGetPriority);
static DISPATCH_PROC(SProcSyncInitialize);
static DISPATCH_PROC(SProcSyncListSystemCounters);
static DISPATCH_PROC(SProcSyncQueryAlarm);
static DISPATCH_PROC(SProcSyncQueryCounter);
static DISPATCH_PROC(SProcSyncSetCounter);
static DISPATCH_PROC(SProcSyncSetPriority);
/* Each counter maintains a simple linked list of triggers that are /* Each counter maintains a simple linked list of triggers that are
* interested in the counter. The two functions below are used to * interested in the counter. The two functions below are used to
* delete and add triggers on this list. * delete and add triggers on this list.
@ -462,26 +712,26 @@ SyncAlarmTriggerFired(pTrigger)
{ {
Bool overflow; Bool overflow;
CARD64 oldvalue; CARD64 oldvalue;
SyncTrigger *pTrigger = &pAlarm->trigger; SyncTrigger *paTrigger = &pAlarm->trigger;
/* "The alarm is updated by repeatedly adding delta to the /* "The alarm is updated by repeatedly adding delta to the
* value of the trigger and re-initializing it until it * value of the trigger and re-initializing it until it
* becomes FALSE." * becomes FALSE."
*/ */
oldvalue = pTrigger->test_value; oldvalue = paTrigger->test_value;
/* XXX really should do something smarter here */ /* XXX really should do something smarter here */
do do
{ {
XSyncValueAdd(&pTrigger->test_value, pTrigger->test_value, XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
pAlarm->delta, &overflow); pAlarm->delta, &overflow);
} while (!overflow && } while (!overflow &&
(*pTrigger->CheckTrigger)(pTrigger, (*paTrigger->CheckTrigger)(paTrigger,
pTrigger->pCounter->value)); paTrigger->pCounter->value));
new_test_value = pTrigger->test_value; new_test_value = paTrigger->test_value;
pTrigger->test_value = oldvalue; paTrigger->test_value = oldvalue;
/* "If this update would cause value to fall outside the range /* "If this update would cause value to fall outside the range
* for an INT64...no change is made to value (test-value) and * for an INT64...no change is made to value (test-value) and
@ -710,7 +960,6 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
Mask mask; Mask mask;
CARD32 *values; CARD32 *values;
{ {
SyncAlarmClientList *pClients;
int status; int status;
XSyncCounter counter; XSyncCounter counter;
Mask origmask = mask; Mask origmask = mask;
@ -719,9 +968,9 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
while (mask) while (mask)
{ {
int index = lowbit(mask); int index2 = lowbit(mask);
mask &= ~index; mask &= ~index2;
switch (index) switch (index2)
{ {
case XSyncCACounter: case XSyncCACounter:
mask &= ~XSyncCACounter; mask &= ~XSyncCACounter;
@ -998,7 +1247,6 @@ FreeAlarm(addr, id)
XID id; XID id;
{ {
SyncAlarm *pAlarm = (SyncAlarm *) addr; SyncAlarm *pAlarm = (SyncAlarm *) addr;
SyncAlarmClientList *pClient;
pAlarm->state = XSyncAlarmDestroyed; pAlarm->state = XSyncAlarmDestroyed;
@ -1139,7 +1387,6 @@ static int
ProcSyncInitialize(client) ProcSyncInitialize(client)
ClientPtr client; ClientPtr client;
{ {
REQUEST(xSyncInitializeReq);
xSyncInitializeReply rep; xSyncInitializeReply rep;
int n; int n;
@ -1166,10 +1413,9 @@ static int
ProcSyncListSystemCounters(client) ProcSyncListSystemCounters(client)
ClientPtr client; ClientPtr client;
{ {
REQUEST(xSyncListSystemCountersReq);
xSyncListSystemCountersReply rep; xSyncListSystemCountersReply rep;
int i, len; int i, len;
xSyncSystemCounter *list, *walklist; xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq); REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
@ -1318,7 +1564,6 @@ ProcSyncCreateCounter(client)
ClientPtr client; ClientPtr client;
{ {
REQUEST(xSyncCreateCounterReq); REQUEST(xSyncCreateCounterReq);
SyncCounter *pCounter;
CARD64 initial; CARD64 initial;
REQUEST_SIZE_MATCH(xSyncCreateCounterReq); REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
@ -1440,9 +1685,8 @@ ProcSyncAwait(client)
{ {
REQUEST(xSyncAwaitReq); REQUEST(xSyncAwaitReq);
int len, items; int len, items;
int n, i; int i;
xSyncWaitCondition *pProtocolWaitConds; xSyncWaitCondition *pProtocolWaitConds;
int ret;
SyncAwaitUnion *pAwaitUnion; SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait; SyncAwait *pAwait;
int status; int status;
@ -1606,7 +1850,6 @@ ProcSyncCreateAlarm(client)
REQUEST(xSyncCreateAlarmReq); REQUEST(xSyncCreateAlarmReq);
SyncAlarm *pAlarm; SyncAlarm *pAlarm;
int status; int status;
int i;
unsigned long len, vmask; unsigned long len, vmask;
SyncTrigger *pTrigger; SyncTrigger *pTrigger;
@ -2063,8 +2306,6 @@ static int
SProcSyncDispatch(client) SProcSyncDispatch(client)
ClientPtr client; ClientPtr client;
{ {
int n;
REQUEST(xReq); REQUEST(xReq);
switch (stuff->data) switch (stuff->data)
@ -2154,8 +2395,6 @@ SyncResetProc(extEntry)
} }
static void SyncInitServerTime();
/* /*
* ** Initialise the extension. * ** Initialise the extension.
*/ */
@ -2188,8 +2427,8 @@ SyncExtensionInit()
SyncReqCode = extEntry->base; SyncReqCode = extEntry->base;
SyncEventBase = extEntry->eventBase; SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase; SyncErrorBase = extEntry->errorBase;
EventSwapVector[SyncEventBase + XSyncCounterNotify] = SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
EventSwapVector[SyncEventBase + XSyncAlarmNotify] = SAlarmNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
/* /*
* Although SERVERTIME is implemented by the OS layer, we initialise it * Although SERVERTIME is implemented by the OS layer, we initialise it
@ -2211,9 +2450,6 @@ SyncExtensionInit()
*/ */
#ifndef WIN32
#include <sys/time.h>
#endif
static pointer ServertimeCounter; static pointer ServertimeCounter;
static XSyncValue Now; static XSyncValue Now;

View File

@ -26,28 +26,44 @@ other dealings in this Software without prior written authorization
from The Open Group. from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "misc.h" #include "misc.h"
#include "os.h" #include "os.h"
#include "dixstruct.h" #include "dixstruct.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "swaprep.h"
#include "xcmiscstr.h" #include "xcmiscstr.h"
static unsigned char XCMiscCode; static unsigned char XCMiscCode;
static int ProcXCMiscDispatch(), SProcXCMiscDispatch();
static void XCMiscResetProc(); static void XCMiscResetProc(
extern void Swap32Write(); /* XXX should be in header file */ #if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static DISPATCH_PROC(ProcXCMiscDispatch);
static DISPATCH_PROC(ProcXCMiscGetVersion);
static DISPATCH_PROC(ProcXCMiscGetXIDList);
static DISPATCH_PROC(ProcXCMiscGetXIDRange);
static DISPATCH_PROC(SProcXCMiscDispatch);
static DISPATCH_PROC(SProcXCMiscGetVersion);
static DISPATCH_PROC(SProcXCMiscGetXIDList);
static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void void
XCMiscExtensionInit() XCMiscExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(XCMiscExtensionName, 0, 0, if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch, ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode)) XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base; XCMiscCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XCMiscExtensionName, TRUE); DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
} }
@ -63,7 +79,6 @@ static int
ProcXCMiscGetVersion(client) ProcXCMiscGetVersion(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xXCMiscGetVersionReq);
xXCMiscGetVersionReply rep; xXCMiscGetVersionReply rep;
register int n; register int n;
@ -86,7 +101,6 @@ static int
ProcXCMiscGetXIDRange(client) ProcXCMiscGetXIDRange(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xXCMiscGetXIDRangeReq);
xXCMiscGetXIDRangeReply rep; xXCMiscGetXIDRangeReply rep;
register int n; register int n;
XID min_id, max_id; XID min_id, max_id;
@ -137,7 +151,7 @@ ProcXCMiscGetXIDList(client)
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep); WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
if (count) if (count)
{ {
client->pSwapReplyFunc = Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids); WriteSwappedDataToClient(client, count * sizeof(XID), pids);
} }
DEALLOCATE_LOCAL(pids); DEALLOCATE_LOCAL(pids);

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group. from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.7 2001/12/14 19:58:51 dawes Exp $ */
#include "X.h" #include "X.h"
#define NEED_EVENTS #define NEED_EVENTS
@ -37,6 +38,8 @@ from The Open Group.
#include "windowstr.h" #include "windowstr.h"
#include "inputstr.h" #include "inputstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#define _XTEST_SERVER_ #define _XTEST_SERVER_
#include "XTest.h" #include "XTest.h"
#include "xteststr.h" #include "xteststr.h"
@ -44,27 +47,49 @@ from The Open Group.
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#define EXTENSION_EVENT_BASE 64 #define EXTENSION_EVENT_BASE 64
#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */ #endif /* XINPUT */
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
static unsigned char XTestReqCode; static unsigned char XTestReqCode;
static int ProcXTestDispatch(), SProcXTestDispatch();
static void XTestResetProc();
static int XTestSwapFakeInput();
CursorPtr GetSpriteCursor();
WindowPtr GetCurrentRootWindow();
#ifdef XINPUT #ifdef XINPUT
extern int DeviceValuator; extern int DeviceValuator;
DeviceIntPtr LookupDeviceIntRec();
#endif /* XINPUT */ #endif /* XINPUT */
static void XTestResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static int XTestSwapFakeInput(
#if NeedFunctionPrototypes
ClientPtr /* client */,
xReq * /* req */
#endif
);
static DISPATCH_PROC(ProcXTestCompareCursor);
static DISPATCH_PROC(ProcXTestDispatch);
static DISPATCH_PROC(ProcXTestFakeInput);
static DISPATCH_PROC(ProcXTestGetVersion);
static DISPATCH_PROC(ProcXTestGrabControl);
static DISPATCH_PROC(SProcXTestCompareCursor);
static DISPATCH_PROC(SProcXTestDispatch);
static DISPATCH_PROC(SProcXTestFakeInput);
static DISPATCH_PROC(SProcXTestGetVersion);
static DISPATCH_PROC(SProcXTestGrabControl);
void void
XTestExtensionInit() XTestExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
if (extEntry = AddExtension(XTestExtensionName, 0, 0, if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch, ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode)) XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base; XTestReqCode = (unsigned char)extEntry->base;
} }
@ -79,7 +104,6 @@ static int
ProcXTestGetVersion(client) ProcXTestGetVersion(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xXTestGetVersionReq);
xXTestGetVersionReply rep; xXTestGetVersionReply rep;
register int n; register int n;
@ -142,12 +166,12 @@ ProcXTestFakeInput(client)
int nev; int nev;
int n; int n;
xEvent *ev; xEvent *ev;
DeviceIntPtr dev; DeviceIntPtr dev = NULL;
WindowPtr root; WindowPtr root;
int type; int type;
#ifdef XINPUT #ifdef XINPUT
Bool extension = FALSE; Bool extension = FALSE;
deviceValuator *dv; deviceValuator *dv = NULL;
int base; int base;
int *values; int *values;
#endif /* XINPUT */ #endif /* XINPUT */
@ -468,7 +492,7 @@ XTestSwapFakeInput(client, req)
register int nev; register int nev;
register xEvent *ev; register xEvent *ev;
xEvent sev; xEvent sev;
void (*proc)(), NotImplemented(); EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++) for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
@ -476,7 +500,7 @@ XTestSwapFakeInput(client, req)
/* Swap event */ /* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177]; proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */ /* no swapping proc; invalid event type? */
if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) { if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type; client->errorValue = ev->u.u.type;
return BadValue; return BadValue;
} }

View File

@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California. University of California.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.5 2001/12/14 19:58:52 dawes Exp $ */
/*************************************************************** /***************************************************************
* include files * include files
@ -70,6 +71,8 @@ University of California.
#define XTestSERVER_SIDE #define XTestSERVER_SIDE
#include "xtestext1.h" #include "xtestext1.h"
#include "xtest1dd.h"
/*************************************************************** /***************************************************************
* defines * defines
***************************************************************/ ***************************************************************/
@ -96,8 +99,6 @@ extern int XTestFakeAckType;
/* /*
* used in the WriteReplyToClient macro * used in the WriteReplyToClient macro
*/ */
extern void (* ReplySwapVector[256]) ();
extern int exclusive_steal; extern int exclusive_steal;
/*************************************************************** /***************************************************************
@ -286,24 +287,62 @@ KeyCode xtest_command_key = 0;
* function declarations * function declarations
***************************************************************/ ***************************************************************/
void flush_input_actions(); static void parse_key_fake(
void XTestStealJumpData(); #if NeedFunctionPrototypes
void XTestGenerateEvent(); XTestKeyInfo * /* fkey */
void XTestGetPointerPos(); #endif
void XTestJumpPointer(); );
static void parse_motion_fake(
#if NeedFunctionPrototypes
XTestMotionInfo * /* fmotion */
#endif
);
static void parse_jump_fake(
#if NeedFunctionPrototypes
XTestJumpInfo * /* fjump */
#endif
);
static void parse_delay_fake(
#if NeedFunctionPrototypes
XTestDelayInfo * /* tevent */
#endif
);
static void send_ack(
#if NeedFunctionPrototypes
ClientPtr /* client */
#endif
);
static void start_play_clock(
#if NeedFunctionPrototypes
void
#endif
);
static void compute_action_time(
#if NeedFunctionPrototypes
struct timeval * /* rtime */
#endif
);
static int find_residual_time(
#if NeedFunctionPrototypes
struct timeval * /* rtime */
#endif
);
static void parse_key_fake(); static CARD16 check_time_event(
static void parse_motion_fake(); #if NeedFunctionPrototypes
static void parse_jump_fake(); void
static void parse_delay_fake(); #endif
static void send_ack(); );
static void start_play_clock(); static CARD32 current_ms(
static void compute_action_time(); #if NeedFunctionPrototypes
static int find_residual_time(); struct timeval * /* otime */
#endif
static CARD16 check_time_event(); );
static CARD32 current_ms(); static int there_is_room(
static int there_is_room(); #if NeedFunctionPrototypes
int /* actsize */
#endif
);
/****************************************************************************** /******************************************************************************
* *
@ -450,8 +489,8 @@ XTestStealJumpData(jx, jy, dev_type)
/* /*
* the x and y coordinates to jump to * the x and y coordinates to jump to
*/ */
short jx; int jx;
short jy; int jy;
/* /*
* which device caused the jump * which device caused the jump
*/ */
@ -527,7 +566,7 @@ current_ms(otime)
struct timeval *otime; struct timeval *otime;
{ {
struct timeval tval; struct timeval tval;
unsigned long ctime; unsigned long the_ms;
unsigned long sec; unsigned long sec;
unsigned long usec; unsigned long usec;
@ -556,8 +595,8 @@ struct timeval *otime;
* compute the number of milliseconds contained in * compute the number of milliseconds contained in
* 'sec' seconds and 'usec' microseconds * 'sec' seconds and 'usec' microseconds
*/ */
ctime = (sec * 1000000 + usec) / 1000; the_ms = (sec * 1000000L + usec) / 1000L;
return (ctime); return (the_ms);
} }
/****************************************************************************** /******************************************************************************
@ -673,8 +712,8 @@ XTestStealMotionData(dx, dy, dev_type, mx, my)
/* /*
* the x and y delta motion of the locator * the x and y delta motion of the locator
*/ */
short dx; int dx;
short dy; int dy;
/* /*
* which locator did the moving * which locator did the moving
*/ */
@ -682,8 +721,8 @@ int dev_type;
/* /*
* the x and y position of the locator before the delta motion * the x and y position of the locator before the delta motion
*/ */
short mx; int mx;
short my; int my;
{ {
/* /*
* pointer to a XTestMOTION_ACTION input action * pointer to a XTestMOTION_ACTION input action
@ -791,20 +830,20 @@ XTestStealKeyData(keycode, keystate, dev_type, locx, locy)
/* /*
* which key/button moved * which key/button moved
*/ */
CARD8 keycode; unsigned keycode;
/* /*
* whether the key/button was pressed or released * whether the key/button was pressed or released
*/ */
char keystate; int keystate;
/* /*
* which device caused the input action * which device caused the input action
*/ */
int dev_type; int dev_type;
/* /*
* the x and y coordinates of the locator when the action happenned * the x and y coordinates of the locator when the action happenned
*/ */
short locx; int locx;
short locy; int locy;
{ {
/* /*
* pointer to key/button motion input action * pointer to key/button motion input action
@ -814,7 +853,7 @@ short locy;
* time delta from previous event * time delta from previous event
*/ */
CARD16 tchar; CARD16 tchar;
char keytrans; char keytrans = 0;
/* /*
* update the logical position of the locator if the physical position * update the logical position of the locator if the physical position
@ -1445,8 +1484,8 @@ struct timeval *rtime;
* the current time. * the current time.
*/ */
static int static int
find_residual_time(rtime) find_residual_time(the_residual)
struct timeval *rtime; struct timeval *the_residual;
{ {
/* /*
* if > 0, there is time to wait. If < 0, then don't wait * if > 0, there is time to wait. If < 0, then don't wait
@ -1507,8 +1546,8 @@ struct timeval *rtime;
} }
else else
{ {
rtime->tv_usec = pusec - busec; the_residual->tv_usec = pusec - busec;
rtime->tv_sec = 0; the_residual->tv_sec = 0;
} }
} }
else else
@ -1519,14 +1558,14 @@ struct timeval *rtime;
* 'borrow' a second's worth of microseconds * 'borrow' a second's worth of microseconds
* from the seconds left to wait * from the seconds left to wait
*/ */
rtime->tv_usec = 1000000 - busec + pusec; the_residual->tv_usec = 1000000 - busec + pusec;
psec--; psec--;
rtime->tv_sec = psec - bsec; the_residual->tv_sec = psec - bsec;
} }
else else
{ {
rtime->tv_sec = psec - bsec; the_residual->tv_sec = psec - bsec;
rtime->tv_usec = pusec - busec; the_residual->tv_usec = pusec - busec;
} }
} }
} }
@ -1540,8 +1579,8 @@ struct timeval *rtime;
/* /*
* set the time to wait to 0 * set the time to wait to 0
*/ */
rtime->tv_sec = 0; the_residual->tv_sec = 0;
rtime->tv_usec = 0; the_residual->tv_usec = 0;
} }
return(wait); return(wait);
} }

View File

@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California. University of California.
*/ */
/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.3 2001/12/14 19:58:52 dawes Exp $ */
/***************************************************************************** /*****************************************************************************
* include files * include files
@ -72,6 +73,8 @@ University of California.
#define XTestSERVER_SIDE #define XTestSERVER_SIDE
#include "xtestext1.h" #include "xtestext1.h"
#include "xtest1dd.h"
/***************************************************************************** /*****************************************************************************
* defines * defines
****************************************************************************/ ****************************************************************************/
@ -80,10 +83,6 @@ University of California.
* externals * externals
****************************************************************************/ ****************************************************************************/
/*
* holds the addresses of the routines that handle byte-swapping of replys
*/
extern void (* ReplySwapVector[256]) ();
/* /*
* id of client using XTestGetInput * id of client using XTestGetInput
* *
@ -137,31 +136,44 @@ static XID current_client_id;
* function declarations * function declarations
****************************************************************************/ ****************************************************************************/
static int ProcXTestDispatch(); static DISPATCH_PROC(ProcXTestDispatch);
static int SProcXTestDispatch(); static DISPATCH_PROC(SProcXTestDispatch);
static void XTestResetProc(); static DISPATCH_PROC(ProcTestFakeInput);
static int ProcTestFakeInput(); static DISPATCH_PROC(SProcTestFakeInput);
static int SProcTestFakeInput(); static DISPATCH_PROC(ProcTestGetInput);
static int ProcTestGetInput(); static DISPATCH_PROC(SProcTestGetInput);
static int SProcTestGetInput(); static DISPATCH_PROC(ProcTestStopInput);
static int ProcTestStopInput(); static DISPATCH_PROC(SProcTestStopInput);
static int SProcTestStopInput(); static DISPATCH_PROC(ProcTestReset);
static int ProcTestReset(); static DISPATCH_PROC(SProcTestReset);
static int SProcTestReset(); static DISPATCH_PROC(ProcTestQueryInputSize);
static int ProcTestQueryInputSize(); static DISPATCH_PROC(SProcTestQueryInputSize);
static int SProcTestQueryInputSize();
static void SReplyXTestDispatch();
static void SEventXTestDispatch();
void NotImplemented();
void abort_play_back(); static void XTestResetProc(
void return_input_array_size(); #if NeedFunctionPrototypes
void steal_input(); ExtensionEntry * /* unused */
void stop_stealing_input(); #endif
void flush_input_actions(); );
void parse_fake_input(); static void SReplyXTestDispatch(
#if NeedFunctionPrototypes
ClientPtr /* client_ptr */,
int /* size */,
char * /* reply_ptr */
#endif
);
static void SEventXTestDispatch(
#if NeedFunctionPrototypes
xEvent * /* from */,
xEvent * /* to */
#endif
);
static int XTestCurrentClientGone(); static int XTestCurrentClientGone(
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/***************************************************************************** /*****************************************************************************
* *
@ -180,10 +192,6 @@ XTestExtension1Init()
* holds the pointer to the extension entry structure * holds the pointer to the extension entry structure
*/ */
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
/*
* This routine adds the extension to the server extension table.
*/
ExtensionEntry *AddExtension();
extEntry = AddExtension(XTestEXTENSION_NAME, extEntry = AddExtension(XTestEXTENSION_NAME,
XTestEVENT_COUNT, XTestEVENT_COUNT,
@ -213,7 +221,7 @@ XTestExtension1Init()
* install the routine to handle byte-swapping the replies * install the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table * for this extension in the ReplySwapVector table
*/ */
ReplySwapVector[XTestReqCode] = SReplyXTestDispatch; ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
/* /*
* install the routine to handle byte-swapping the events * install the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table * for this extension in the EventSwapVector table
@ -647,7 +655,6 @@ static int
ProcTestStopInput(client) ProcTestStopInput(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xTestStopInputReq);
REQUEST_SIZE_MATCH(xTestStopInputReq); REQUEST_SIZE_MATCH(xTestStopInputReq);
if (on_steal_input && (current_xtest_client == client)) if (on_steal_input && (current_xtest_client == client))
{ {
@ -686,7 +693,6 @@ static int
ProcTestReset(client) ProcTestReset(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xTestResetReq);
REQUEST_SIZE_MATCH(xTestResetReq); REQUEST_SIZE_MATCH(xTestResetReq);
on_steal_input = FALSE; on_steal_input = FALSE;
exclusive_steal = FALSE; exclusive_steal = FALSE;
@ -711,7 +717,6 @@ static int
ProcTestQueryInputSize(client) ProcTestQueryInputSize(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xTestQueryInputSizeReq);
REQUEST_SIZE_MATCH(xTestQueryInputSizeReq); REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
/* /*
* defined in xtest1dd.c * defined in xtest1dd.c
@ -728,14 +733,16 @@ ProcTestQueryInputSize(client)
* connected to it. It must put eveything back the way it was before * connected to it. It must put eveything back the way it was before
* this extension was installed. * this extension was installed.
*/ */
/*ARGSUSED*/
static void static void
XTestResetProc() XTestResetProc(unused)
ExtensionEntry * unused;
{ {
/* /*
* remove the routine to handle byte-swapping the replies * remove the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table * for this extension in the ReplySwapVector table
*/ */
ReplySwapVector[XTestReqCode] = NotImplemented; ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
/* /*
* remove the routine to handle byte-swapping the events * remove the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table * for this extension in the EventSwapVector table
@ -755,7 +762,7 @@ XTestResetProc()
/***************************************************************************** /*****************************************************************************
* *
* ProcTestQueryInputSize * PXTestCurrentClientGone
* *
* This routine is called when a client that has asked for input actions * This routine is called when a client that has asked for input actions
* to be sent to it "goes away". This routine must clean up the * to be sent to it "goes away". This routine must clean up the

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/allowev.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,10 +61,12 @@ SOFTWARE.
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
extern int IReqCode; #include "extnsionst.h"
extern int BadDevice; #include "extinit.h" /* LookupDeviceIntRec */
extern void (* ReplySwapVector[256]) (); #include "exglobals.h"
DeviceIntPtr LookupDeviceIntRec();
#include "allowev.h"
#include "dixevents.h"
/*********************************************************************** /***********************************************************************
* *
@ -96,7 +99,6 @@ ProcXAllowDeviceEvents(client)
{ {
TimeStamp time; TimeStamp time;
DeviceIntPtr thisdev; DeviceIntPtr thisdev;
void AllowSome ();
REQUEST(xAllowDeviceEventsReq); REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgdctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,11 +60,13 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" /* control constants */ #include "XIproto.h" /* control constants */
#include "XIstubs.h"
extern int IReqCode; #include "extnsionst.h"
extern int BadDevice, DeviceBusy; #include "extinit.h" /* LookupDeviceIntRec */
extern void (* ReplySwapVector[256]) (); #include "exglobals.h"
DeviceIntPtr LookupDeviceIntRec();
#include "chgdctl.h"
/*********************************************************************** /***********************************************************************
* *
@ -91,10 +94,12 @@ SProcXChangeDeviceControl(client)
* *
*/ */
int
ProcXChangeDeviceControl(client) ProcXChangeDeviceControl(client)
ClientPtr client; ClientPtr client;
{ {
int i, len, status; unsigned len;
int i, status;
DeviceIntPtr dev; DeviceIntPtr dev;
xDeviceResolutionCtl *r; xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep; xChangeDeviceControlReply rep;
@ -150,7 +155,7 @@ ProcXChangeDeviceControl(client)
BadValue); BadValue);
return Success; return Success;
} }
status = ChangeDeviceControl(client, dev, r); status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
if (status == Success) if (status == Success)
{ {
a = &dev->valuator->axes[r->first_valuator]; a = &dev->valuator->axes[r->first_valuator];
@ -195,6 +200,7 @@ ProcXChangeDeviceControl(client)
* *
*/ */
void
SRepXChangeDeviceControl (client, size, rep) SRepXChangeDeviceControl (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgfctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -60,11 +61,13 @@ SOFTWARE.
#include "XI.h" #include "XI.h"
#include "XIproto.h" /* control constants */ #include "XIproto.h" /* control constants */
#define DO_ALL (-1) #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "chgfctl.h"
extern int BadDevice;
DeviceIntPtr LookupDeviceIntRec(); #define DO_ALL (-1)
/*********************************************************************** /***********************************************************************
* *
@ -92,10 +95,11 @@ SProcXChangeFeedbackControl(client)
* *
*/ */
int
ProcXChangeFeedbackControl(client) ProcXChangeFeedbackControl(client)
ClientPtr client; ClientPtr client;
{ {
int len; unsigned len;
DeviceIntPtr dev; DeviceIntPtr dev;
KbdFeedbackPtr k; KbdFeedbackPtr k;
PtrFeedbackPtr p; PtrFeedbackPtr p;
@ -128,7 +132,7 @@ ProcXChangeFeedbackControl(client)
for (k=dev->kbdfeed; k; k=k->next) for (k=dev->kbdfeed; k; k=k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id) if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
{ {
ChangeKbdFeedback (client, dev, stuff->mask, k, &stuff[1]); ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -142,7 +146,7 @@ ProcXChangeFeedbackControl(client)
for (p=dev->ptrfeed; p; p=p->next) for (p=dev->ptrfeed; p; p=p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id) if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
{ {
ChangePtrFeedback (client, dev, stuff->mask, p, &stuff[1]); ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -163,7 +167,7 @@ ProcXChangeFeedbackControl(client)
for (s=dev->stringfeed; s; s=s->next) for (s=dev->stringfeed; s; s=s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id) if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
{ {
ChangeStringFeedback (client, dev, stuff->mask,s,&stuff[1]); ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -178,7 +182,7 @@ ProcXChangeFeedbackControl(client)
for (i=dev->intfeed; i; i=i->next) for (i=dev->intfeed; i; i=i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id) if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
{ {
ChangeIntegerFeedback (client, dev,stuff->mask,i,&stuff[1]); ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -192,7 +196,7 @@ ProcXChangeFeedbackControl(client)
for (l=dev->leds; l; l=l->next) for (l=dev->leds; l; l=l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id) if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
{ {
ChangeLedFeedback (client, dev, stuff->mask, l, &stuff[1]); ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -206,7 +210,7 @@ ProcXChangeFeedbackControl(client)
for (b=dev->bell; b; b=b->next) for (b=dev->bell; b; b=b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id) if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
{ {
ChangeBellFeedback (client, dev, stuff->mask, b, &stuff[1]); ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]);
return Success; return Success;
} }
break; break;
@ -224,6 +228,7 @@ ProcXChangeFeedbackControl(client)
* *
*/ */
int
ChangeKbdFeedback (client, dev, mask, k, f) ChangeKbdFeedback (client, dev, mask, k, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -332,7 +337,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (mask & DvAutoRepeatMode) if (mask & DvAutoRepeatMode)
{ {
int index = (key >> 3); int inx = (key >> 3);
int kmask = (1 << (key & 7)); int kmask = (1 << (key & 7));
t = (CARD8) f->auto_repeat_mode; t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff) if (t == AutoRepeatModeOff)
@ -340,24 +345,24 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = FALSE; kctrl.autoRepeat = FALSE;
else else
kctrl.autoRepeats[index] &= ~kmask; kctrl.autoRepeats[inx] &= ~kmask;
} }
else if (t == AutoRepeatModeOn) else if (t == AutoRepeatModeOn)
{ {
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = TRUE; kctrl.autoRepeat = TRUE;
else else
kctrl.autoRepeats[index] |= kmask; kctrl.autoRepeats[inx] |= kmask;
} }
else if (t == AutoRepeatModeDefault) else if (t == AutoRepeatModeDefault)
{ {
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat; kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else else
kctrl.autoRepeats[index] &= ~kmask; kctrl.autoRepeats[inx] &= ~kmask;
kctrl.autoRepeats[index] = kctrl.autoRepeats[inx] =
(kctrl.autoRepeats[index] & ~kmask) | (kctrl.autoRepeats[inx] & ~kmask) |
(defaultKeyboardControl.autoRepeats[index] & kmask); (defaultKeyboardControl.autoRepeats[inx] & kmask);
} }
else else
{ {
@ -379,6 +384,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
* *
*/ */
int
ChangePtrFeedback (client, dev, mask, p, f) ChangePtrFeedback (client, dev, mask, p, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -460,6 +466,7 @@ ChangePtrFeedback (client, dev, mask, p, f)
* *
*/ */
int
ChangeIntegerFeedback (client, dev, mask, i, f) ChangeIntegerFeedback (client, dev, mask, i, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -486,6 +493,7 @@ ChangeIntegerFeedback (client, dev, mask, i, f)
* *
*/ */
int
ChangeStringFeedback (client, dev, mask, s, f) ChangeStringFeedback (client, dev, mask, s, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -495,7 +503,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
{ {
register char n; register char n;
register long *p; register long *p;
int i, j, len; int i, j;
KeySym *syms, *sup_syms; KeySym *syms, *sup_syms;
syms = (KeySym *) (f+1); syms = (KeySym *) (f+1);
@ -543,6 +551,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
* *
*/ */
int
ChangeBellFeedback (client, dev, mask, b, f) ChangeBellFeedback (client, dev, mask, b, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -617,6 +626,7 @@ ChangeBellFeedback (client, dev, mask, b, f)
* *
*/ */
int
ChangeLedFeedback (client, dev, mask, l, f) ChangeLedFeedback (client, dev, mask, l, f)
ClientPtr client; ClientPtr client;
DeviceIntPtr dev; DeviceIntPtr dev;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgkbd.c,v 3.6 2001/12/14 19:58:54 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,14 +60,16 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "XIstubs.h"
#include "globals.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
extern int IReqCode; #include "exevents.h"
extern int BadDevice; #include "exglobals.h"
extern int ChangeDeviceNotify;
extern Mask ChangeDeviceNotifyMask; #include "chgkbd.h"
extern InputInfo inputInfo; #include "chgptr.h"
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -93,6 +96,7 @@ SProcXChangeKeyboardDevice(client)
* *
*/ */
int
ProcXChangeKeyboardDevice (client) ProcXChangeKeyboardDevice (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -104,7 +108,6 @@ ProcXChangeKeyboardDevice (client)
KeyClassPtr k; KeyClassPtr k;
xChangeKeyboardDeviceReply rep; xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev; changeDeviceNotify ev;
extern Bool Must_have_memory;
REQUEST(xChangeKeyboardDeviceReq); REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
@ -169,14 +172,14 @@ ProcXChangeKeyboardDevice (client)
for (i=0; i<df->traceSize; i++) for (i=0; i<df->traceSize; i++)
df->trace[i] = xf->trace[i]; df->trace[i] = xf->trace[i];
RegisterOtherDevice (xkbd); RegisterOtherDevice (xkbd);
RegisterKeyboardDevice ((DevicePtr)dev); RegisterKeyboardDevice (dev);
ev.type = ChangeDeviceNotify; ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid; ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.request = NewKeyboard; ev.request = NewKeyboard;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1); SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode, SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client); k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
@ -195,6 +198,7 @@ ProcXChangeKeyboardDevice (client)
* *
*/ */
void
SRepXChangeKeyboardDevice (client, size, rep) SRepXChangeKeyboardDevice (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgkmap.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode; #include "chgkmap.h"
extern int BadDevice;
extern int DeviceMappingNotify;
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -99,6 +101,7 @@ SProcXChangeDeviceKeyMapping(client)
* *
*/ */
int
ProcXChangeDeviceKeyMapping(client) ProcXChangeDeviceKeyMapping(client)
register ClientPtr client; register ClientPtr client;
{ {
@ -120,7 +123,7 @@ ProcXChangeDeviceKeyMapping(client)
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify, ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode, stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
&stuff[1]); (KeySym *)&stuff[1]);
if (ret != Success) if (ret != Success)
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0, SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgprop.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,11 +61,14 @@ SOFTWARE.
#include "windowstr.h" #include "windowstr.h"
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
extern int BadMode; #include "exevents.h"
extern int BadClass; #include "exglobals.h"
extern int IReqCode;
DeviceIntPtr LookupDeviceIntRec(); #include "chgprop.h"
#include "grabdev.h"
/*********************************************************************** /***********************************************************************
* *
@ -100,6 +104,7 @@ SProcXChangeDeviceDontPropagateList(client)
* *
*/ */
int
ProcXChangeDeviceDontPropagateList (client) ProcXChangeDeviceDontPropagateList (client)
register ClientPtr client; register ClientPtr client;
{ {

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/chgptr.c,v 3.7 2001/12/14 19:58:55 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -56,21 +57,21 @@ SOFTWARE.
#define NEED_REPLIES #define NEED_REPLIES
#include "X.h" /* for inputstr.h */ #include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */ #include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */ #include "XIstubs.h"
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */ #include "scrnintstr.h" /* screen structure */
extern int IReqCode; #include "extnsionst.h"
extern int BadDevice; #include "extinit.h" /* LookupDeviceIntRec */
extern int ChangeDeviceNotify;
extern Mask ChangeDeviceNotifyMask; #include "dixevents.h"
extern InputInfo inputInfo; #include "exevents.h"
extern ScreenInfo screenInfo; #include "exglobals.h"
extern WindowPtr *WindowTable;
extern void (* ReplySwapVector[256]) (); #include "chgptr.h"
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -97,6 +98,7 @@ SProcXChangePointerDevice(client)
* *
*/ */
int
ProcXChangePointerDevice (client) ProcXChangePointerDevice (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -157,14 +159,14 @@ ProcXChangePointerDevice (client)
if (!dev->ptrfeed) if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA); InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
RegisterOtherDevice (xptr); RegisterOtherDevice (xptr);
RegisterPointerDevice ((DevicePtr)dev); RegisterPointerDevice (dev);
ev.type = ChangeDeviceNotify; ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid; ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.request = NewPointer; ev.request = NewPointer;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1); SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingPointer, 0, 0, client); SendMappingNotify (MappingPointer, 0, 0, client);
rep.status = 0; rep.status = 0;
@ -175,6 +177,7 @@ ProcXChangePointerDevice (client)
return Success; return Success;
} }
void
DeleteFocusClassDeviceStruct(dev) DeleteFocusClassDeviceStruct(dev)
DeviceIntPtr dev; DeviceIntPtr dev;
{ {
@ -189,6 +192,7 @@ DeleteFocusClassDeviceStruct(dev)
* *
*/ */
void
SendEventToAllWindows (dev, mask, ev, count) SendEventToAllWindows (dev, mask, ev, count)
DeviceIntPtr dev; DeviceIntPtr dev;
Mask mask; Mask mask;
@ -214,6 +218,7 @@ SendEventToAllWindows (dev, mask, ev, count)
* *
*/ */
void
FindInterestedChildren (dev, p1, mask, ev, count) FindInterestedChildren (dev, p1, mask, ev, count)
DeviceIntPtr dev; DeviceIntPtr dev;
WindowPtr p1; WindowPtr p1;
@ -239,6 +244,7 @@ FindInterestedChildren (dev, p1, mask, ev, count)
* *
*/ */
void
SRepXChangePointerDevice (client, size, rep) SRepXChangePointerDevice (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/closedev.c,v 3.4 2001/12/14 19:58:55 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -61,13 +62,12 @@ SOFTWARE.
#include "scrnintstr.h" /* screen structure */ #include "scrnintstr.h" /* screen structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern ScreenInfo screenInfo; #include "closedev.h"
extern WindowPtr *WindowTable;
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -137,6 +137,7 @@ ProcXCloseDevice(client)
* *
*/ */
void
DeleteEventsFromChildren(dev, p1, client) DeleteEventsFromChildren(dev, p1, client)
DeviceIntPtr dev; DeviceIntPtr dev;
WindowPtr p1; WindowPtr p1;
@ -160,6 +161,7 @@ DeleteEventsFromChildren(dev, p1, client)
* *
*/ */
void
DeleteDeviceEvents (dev, pWin, client) DeleteDeviceEvents (dev, pWin, client)
DeviceIntPtr dev; DeviceIntPtr dev;
WindowPtr pWin; WindowPtr pWin;
@ -169,7 +171,7 @@ DeleteDeviceEvents (dev, pWin, client)
OtherInputMasks *pOthers; OtherInputMasks *pOthers;
GrabPtr grab, next; GrabPtr grab, next;
if (pOthers=wOtherInputMasks(pWin)) if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others; for (others=pOthers->inputClients; others;
others = others->next) others = others->next)
if (SameClient(others,client)) if (SameClient(others,client))

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/devbell.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "devbell.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -89,6 +90,7 @@ SProcXDeviceBell(client)
* *
*/ */
int
ProcXDeviceBell (client) ProcXDeviceBell (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -99,7 +101,7 @@ ProcXDeviceBell (client)
int newpercent; int newpercent;
CARD8 class; CARD8 class;
pointer ctrl; pointer ctrl;
void (*proc)(); BellProcPtr proc;
REQUEST(xDeviceBellReq); REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq); REQUEST_SIZE_MATCH(xDeviceBellReq);

View File

@ -44,6 +44,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/exevents.c,v 3.10 2001/12/14 19:58:55 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -62,6 +63,14 @@ SOFTWARE.
#include "windowstr.h" #include "windowstr.h"
#include "miscstruct.h" #include "miscstruct.h"
#include "region.h" #include "region.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */
#include "chgptr.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0) #define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \ #define AllModifiersMask ( \
@ -72,24 +81,17 @@ SOFTWARE.
#define Motion_Filter(class) (DevicePointerMotionMask | \ #define Motion_Filter(class) (DevicePointerMotionMask | \
(class)->state | (class)->motionMask) (class)->state | (class)->motionMask)
void ActivateKeyboardGrab(); static Bool ShouldFreeInputMasks(
void DeactivateKeyboardGrab(); #if NeedFunctionPrototypes
void ProcessOtherEvent(); WindowPtr /* pWin */,
void RecalculateDeviceDeliverableEvents(); Bool /* ignoreSelectedEvents */
static Bool ShouldFreeInputMasks(); #endif
static Bool MakeInputMasks (); );
extern int DeviceKeyPress; static Bool MakeInputMasks (
extern int DeviceButtonPress; #if NeedFunctionPrototypes
extern int DeviceValuator; WindowPtr /* pWin */
extern Mask DevicePointerMotionMask; #endif
extern Mask DeviceMappingNotifyMask; );
extern Mask DeviceButtonMotionMask;
extern Mask DeviceButtonGrabMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask PropagateMask[];
extern WindowPtr GetSpriteWindow();
extern InputInfo inputInfo;
extern int RT_INPUTCLIENT;
/************************************************************************** /**************************************************************************
* *
@ -99,47 +101,40 @@ extern int RT_INPUTCLIENT;
void void
RegisterOtherDevice (device) RegisterOtherDevice (device)
DevicePtr device; DeviceIntPtr device;
{ {
device->processInputProc = ProcessOtherEvent; device->public.processInputProc = ProcessOtherEvent;
device->realInputProc = ProcessOtherEvent; device->public.realInputProc = ProcessOtherEvent;
((DeviceIntPtr)device)->ActivateGrab = ActivateKeyboardGrab; (device)->ActivateGrab = ActivateKeyboardGrab;
((DeviceIntPtr)device)->DeactivateGrab = DeactivateKeyboardGrab; (device)->DeactivateGrab = DeactivateKeyboardGrab;
} }
extern int DeviceMotionNotify;
/*ARGSUSED*/ /*ARGSUSED*/
void void
ProcessOtherEvent (xE, other, count) ProcessOtherEvent (xE, other, count)
deviceKeyButtonPointer *xE; xEventPtr xE;
register DeviceIntPtr other; register DeviceIntPtr other;
int count; int count;
{ {
extern int DeviceKeyRelease;
extern int DeviceButtonRelease;
extern int ProximityIn;
extern int ProximityOut;
register BYTE *kptr; register BYTE *kptr;
register int i; register int i;
register CARD16 modifiers; register CARD16 modifiers;
register CARD16 mask; register CARD16 mask;
GrabPtr grab = other->grab; GrabPtr grab = other->grab;
Bool deactivateDeviceGrab = FALSE; Bool deactivateDeviceGrab = FALSE;
int key, bit, rootX, rootY; int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button; ButtonClassPtr b = other->button;
KeyClassPtr k = other->key; KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator; ValuatorClassPtr v = other->valuator;
void NoticeEventTime();
deviceValuator *xV = (deviceValuator *) xE; deviceValuator *xV = (deviceValuator *) xE;
if (xE->type != DeviceValuator) { if (xE->u.u.type != DeviceValuator) {
GetSpritePosition(&rootX, &rootY); GetSpritePosition(&rootX, &rootY);
xE->root_x = rootX; xE->u.keyButtonPointer.rootX = rootX;
xE->root_y = rootY; xE->u.keyButtonPointer.rootY = rootY;
key = xE->detail; key = xE->u.u.detail;
NoticeEventTime(xE); NoticeEventTime(xE);
xE->state = inputInfo.keyboard->key->state | xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state; inputInfo.pointer->button->state;
bit = 1 << (key & 7); bit = 1 << (key & 7);
} }
@ -186,7 +181,7 @@ ProcessOtherEvent (xE, other, count)
} }
} }
if (xE->type == DeviceKeyPress) if (xE->u.u.type == DeviceKeyPress)
{ {
modifiers = k->modifierMap[key]; modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3]; kptr = &k->down[key >> 3];
@ -194,9 +189,9 @@ ProcessOtherEvent (xE, other, count)
{ {
if (!modifiers) if (!modifiers)
{ {
xE->type = DeviceKeyRelease; xE->u.u.type = DeviceKeyRelease;
ProcessOtherEvent(xE, other, count); ProcessOtherEvent(xE, other, count);
xE->type = DeviceKeyPress; xE->u.u.type = DeviceKeyPress;
/* release can have side effects, don't fall through */ /* release can have side effects, don't fall through */
ProcessOtherEvent(xE, other, count); ProcessOtherEvent(xE, other, count);
} }
@ -222,7 +217,7 @@ ProcessOtherEvent (xE, other, count)
return; return;
} }
} }
else if (xE->type == DeviceKeyRelease) else if (xE->u.u.type == DeviceKeyRelease)
{ {
kptr = &k->down[key >> 3]; kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */ if (!(*kptr & bit)) /* guard against duplicates */
@ -249,7 +244,7 @@ ProcessOtherEvent (xE, other, count)
if (other->fromPassiveGrab && (key == other->activatingKey)) if (other->fromPassiveGrab && (key == other->activatingKey))
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
} }
else if (xE->type == DeviceButtonPress) else if (xE->u.u.type == DeviceButtonPress)
{ {
kptr = &b->down[key >> 3]; kptr = &b->down[key >> 3];
*kptr |= bit; *kptr |= bit;
@ -257,18 +252,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
b->buttonsDown++; b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask; b->motionMask = DeviceButtonMotionMask;
xE->detail = b->map[key]; xE->u.u.detail = b->map[key];
if (xE->detail == 0) if (xE->u.u.detail == 0)
return; return;
if (xE->detail <= 5) if (xE->u.u.detail <= 5)
b->state |= (Button1Mask >> 1) << xE->detail; b->state |= (Button1Mask >> 1) << xE->u.u.detail;
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify); SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!grab) if (!grab)
if (CheckDeviceGrabs(other, xE, 0, count)) if (CheckDeviceGrabs(other, xE, 0, count))
return; return;
} }
else if (xE->type == DeviceButtonRelease) else if (xE->u.u.type == DeviceButtonRelease)
{ {
kptr = &b->down[key >> 3]; kptr = &b->down[key >> 3];
*kptr &= ~bit; *kptr &= ~bit;
@ -276,18 +271,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
if (!--b->buttonsDown) if (!--b->buttonsDown)
b->motionMask = 0; b->motionMask = 0;
xE->detail = b->map[key]; xE->u.u.detail = b->map[key];
if (xE->detail == 0) if (xE->u.u.detail == 0)
return; return;
if (xE->detail <= 5) if (xE->u.u.detail <= 5)
b->state &= ~((Button1Mask >> 1) << xE->detail); b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify); SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!b->state && other->fromPassiveGrab) if (!b->state && other->fromPassiveGrab)
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
} }
else if (xE->type == ProximityIn) else if (xE->u.u.type == ProximityIn)
other->valuator->mode &= ~OutOfProximity; other->valuator->mode &= ~OutOfProximity;
else if (xE->type == ProximityOut) else if (xE->u.u.type == ProximityOut)
other->valuator->mode |= OutOfProximity; other->valuator->mode |= OutOfProximity;
if (grab) if (grab)
@ -302,9 +297,9 @@ ProcessOtherEvent (xE, other, count)
(*other->DeactivateGrab)(other); (*other->DeactivateGrab)(other);
} }
InitProximityClassDeviceStruct(dev) int
DeviceIntPtr dev; InitProximityClassDeviceStruct( DeviceIntPtr dev)
{ {
register ProximityClassPtr proxc; register ProximityClassPtr proxc;
proxc = (ProximityClassPtr)xalloc(sizeof(ProximityClassRec)); proxc = (ProximityClassPtr)xalloc(sizeof(ProximityClassRec));
@ -312,15 +307,17 @@ InitProximityClassDeviceStruct(dev)
return FALSE; return FALSE;
dev->proximity = proxc; dev->proximity = proxc;
return TRUE; return TRUE;
} }
InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res) void
DeviceIntPtr dev; InitValuatorAxisStruct( DeviceIntPtr dev,
int axnum; int axnum,
int minval; int minval,
int maxval; int maxval,
int resolution; int resolution,
{ int min_res,
int max_res )
{
register AxisInfoPtr ax = dev->valuator->axes + axnum; register AxisInfoPtr ax = dev->valuator->axes + axnum;
ax->min_value = minval; ax->min_value = minval;
@ -328,18 +325,27 @@ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res)
ax->resolution = resolution; ax->resolution = resolution;
ax->min_resolution = min_res; ax->min_resolution = min_res;
ax->max_resolution = max_res; ax->max_resolution = max_res;
} }
static void FixDeviceStateNotify (dev, ev, k, b, v, first) static void
#if NeedFunctionPrototypes
FixDeviceStateNotify (
DeviceIntPtr dev,
deviceStateNotify *ev,
KeyClassPtr k,
ButtonClassPtr b,
ValuatorClassPtr v,
int first)
#else
FixDeviceStateNotify (dev, ev, k, b, v, first)
DeviceIntPtr dev; DeviceIntPtr dev;
deviceStateNotify *ev; deviceStateNotify *ev;
KeyClassPtr k; KeyClassPtr k;
ButtonClassPtr b; ButtonClassPtr b;
ValuatorClassPtr v; ValuatorClassPtr v;
int first; int first;
{ #endif
extern int DeviceStateNotify; {
ev->type = DeviceStateNotify; ev->type = DeviceStateNotify;
ev->deviceid = dev->id; ev->deviceid = dev->id;
ev->time = currentTime.milliseconds; ev->time = currentTime.milliseconds;
@ -376,12 +382,21 @@ static void FixDeviceStateNotify (dev, ev, k, b, v, first)
} }
} }
static void FixDeviceValuator (dev, ev, v, first) static void
#if NeedFunctionPrototypes
FixDeviceValuator (
DeviceIntPtr dev,
deviceValuator *ev,
ValuatorClassPtr v,
int first)
#else
FixDeviceValuator (dev, ev, v, first)
DeviceIntPtr dev; DeviceIntPtr dev;
deviceValuator *ev; deviceValuator *ev;
ValuatorClassPtr v; ValuatorClassPtr v;
int first; int first;
{ #endif
{
int nval = v->numAxes - first; int nval = v->numAxes - first;
ev->type = DeviceValuator; ev->type = DeviceValuator;
@ -400,18 +415,12 @@ static void FixDeviceValuator (dev, ev, v, first)
first += ev->num_valuators; first += ev->num_valuators;
} }
void
DeviceFocusEvent(dev, type, mode, detail, pWin) DeviceFocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev; DeviceIntPtr dev;
int type, mode, detail; int type, mode, detail;
register WindowPtr pWin; register WindowPtr pWin;
{ {
extern int DeviceFocusIn;
extern int DeviceFocusOut;
extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify;
extern int DeviceValuatorStateNotify;
extern Mask DeviceStateNotifyMask;
extern Mask DeviceFocusChangeMask;
deviceFocus event; deviceFocus event;
if (type == FocusIn) if (type == FocusIn)
@ -426,15 +435,13 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
event.window = pWin->drawable.id; event.window = pWin->drawable.id;
event.time = currentTime.milliseconds; event.time = currentTime.milliseconds;
(void) (void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1,
DeliverEventsToWindow(pWin, &event, 1, DeviceFocusChangeMask, NullGrab, DeviceFocusChangeMask, NullGrab, dev->id);
dev->id);
if ((type == DeviceFocusIn) && if ((type == DeviceFocusIn) &&
(wOtherInputMasks(pWin)) && (wOtherInputMasks(pWin)) &&
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask)) (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
{ {
int i,j;
int evcount = 1; int evcount = 1;
deviceStateNotify *ev, *sev; deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev; deviceKeyStateNotify *kev;
@ -518,19 +525,34 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
nval -= 3; nval -= 3;
if (nval > 0) { if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS; (ev-1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, ev++, v, first); FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
} }
} }
(void) DeliverEventsToWindow(pWin, sev, evcount, DeviceStateNotifyMask, (void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount,
NullGrab, dev->id); DeviceStateNotifyMask, NullGrab, dev->id);
xfree (sev); xfree (sev);
} }
} }
int int
#if NeedFunctionPrototypes
GrabButton(
ClientPtr client,
DeviceIntPtr dev,
BYTE this_device_mode,
BYTE other_devices_mode,
CARD16 modifiers,
DeviceIntPtr modifier_device,
CARD8 button,
Window grabWindow,
BOOL ownerEvents,
Cursor rcursor,
Window rconfineTo,
Mask eventMask)
#else
GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers, GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, button, grabWindow, ownerEvents, rcursor, rconfineTo, modifier_device, button, grabWindow, ownerEvents, rcursor, rconfineTo,
eventMask) eventMask)
@ -546,11 +568,10 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
Cursor rcursor; Cursor rcursor;
Window rconfineTo; Window rconfineTo;
Mask eventMask; Mask eventMask;
#endif
{ {
WindowPtr pWin, confineTo; WindowPtr pWin, confineTo;
CursorPtr cursor; CursorPtr cursor;
GrabPtr CreateGrab();
GrabPtr grab; GrabPtr grab;
if ((this_device_mode != GrabModeSync) && if ((this_device_mode != GrabModeSync) &&
@ -609,6 +630,19 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
} }
int int
#if NeedFunctionPrototypes
GrabKey(
ClientPtr client,
DeviceIntPtr dev,
BYTE this_device_mode,
BYTE other_devices_mode,
CARD16 modifiers,
DeviceIntPtr modifier_device,
CARD8 key,
Window grabWindow,
BOOL ownerEvents,
Mask mask)
#else
GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers, GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, key, grabWindow, ownerEvents, mask) modifier_device, key, grabWindow, ownerEvents, mask)
ClientPtr client; ClientPtr client;
@ -621,10 +655,9 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
Window grabWindow; Window grabWindow;
BOOL ownerEvents; BOOL ownerEvents;
Mask mask; Mask mask;
#endif
{ {
WindowPtr pWin; WindowPtr pWin;
GrabPtr CreateGrab();
GrabPtr grab; GrabPtr grab;
KeyClassPtr k = dev->key; KeyClassPtr k = dev->key;
@ -673,8 +706,6 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
return AddPassiveGrabToList(grab); return AddPassiveGrabToList(grab);
} }
extern Mask DevicePointerMotionHintMask;
int int
SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks) SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
DeviceIntPtr dev; DeviceIntPtr dev;
@ -803,7 +834,7 @@ RecalculateDeviceDeliverableEvents(pWin)
pChild = pWin; pChild = pWin;
while (1) while (1)
{ {
if (inputMasks = wOtherInputMasks(pChild)) if ((inputMasks = wOtherInputMasks(pChild)) != 0)
{ {
for (others = inputMasks->inputClients; others; for (others = inputMasks->inputClients; others;
others = others->next) others = others->next)
@ -892,10 +923,10 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
Bool propagate; Bool propagate;
xEvent *ev; xEvent *ev;
Mask mask; Mask mask;
int count;
{ {
WindowPtr pWin; WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr GetCurrentRootWindow();
WindowPtr spriteWin=GetSpriteWindow(); WindowPtr spriteWin=GetSpriteWindow();
if (dest == PointerWindow) if (dest == PointerWindow)
@ -996,7 +1027,7 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
KeyCode *inputMap; KeyCode *inputMap;
KeyClassPtr *k; KeyClassPtr *k;
{ {
KeyCode *map; KeyCode *map = NULL;
int inputMapLen; int inputMapLen;
register int i; register int i;
@ -1070,15 +1101,22 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
return(MappingSuccess); return(MappingSuccess);
} }
int void
#if NeedFunctionPrototypes
SendDeviceMappingNotify(
CARD8 request,
KeyCode firstKeyCode,
CARD8 count,
DeviceIntPtr dev)
#else
SendDeviceMappingNotify(request, firstKeyCode, count, dev) SendDeviceMappingNotify(request, firstKeyCode, count, dev)
CARD8 request, count; CARD8 request, count;
KeyCode firstKeyCode; KeyCode firstKeyCode;
DeviceIntPtr dev; DeviceIntPtr dev;
{ #endif
{
xEvent event; xEvent event;
deviceMappingNotify *ev = (deviceMappingNotify *) &event; deviceMappingNotify *ev = (deviceMappingNotify *) &event;
extern int DeviceMappingNotify;
ev->type = DeviceMappingNotify; ev->type = DeviceMappingNotify;
ev->request = request; ev->request = request;
@ -1090,10 +1128,21 @@ SendDeviceMappingNotify(request, firstKeyCode, count, dev)
ev->count = count; ev->count = count;
} }
SendEventToAllWindows (dev, DeviceMappingNotifyMask, ev, 1); SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
} }
int int
#if NeedFunctionPrototypes
ChangeKeyMapping(
ClientPtr client,
DeviceIntPtr dev,
unsigned len,
int type,
KeyCode firstKeyCode,
CARD8 keyCodes,
CARD8 keySymsPerKeyCode,
KeySym *map)
#else
ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes, ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
keySymsPerKeyCode, map) keySymsPerKeyCode, map)
ClientPtr client; ClientPtr client;
@ -1104,6 +1153,7 @@ ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
CARD8 keyCodes; CARD8 keyCodes;
CARD8 keySymsPerKeyCode; CARD8 keySymsPerKeyCode;
KeySym *map; KeySym *map;
#endif
{ {
KeySymsRec keysyms; KeySymsRec keysyms;
KeyClassPtr k = dev->key; KeyClassPtr k = dev->key;
@ -1158,7 +1208,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
DeleteDeviceFromAnyExtEvents(pWin, dev); DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources) if (freeResources)
while (inputMasks = wOtherInputMasks(pWin)) while ((inputMasks = wOtherInputMasks(pWin)) != 0)
{ {
ic = inputMasks->inputClients; ic = inputMasks->inputClients;
for (i=0; i<EMASKSIZE; i++) for (i=0; i<EMASKSIZE; i++)
@ -1167,6 +1217,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
} }
} }
void
DeleteDeviceFromAnyExtEvents(pWin, dev) DeleteDeviceFromAnyExtEvents(pWin, dev)
WindowPtr pWin; WindowPtr pWin;
DeviceIntPtr dev; DeviceIntPtr dev;
@ -1241,7 +1292,6 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
Mask mask; Mask mask;
{ {
DeviceIntPtr dev; DeviceIntPtr dev;
DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS); dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS);
if (pEvents->type == DeviceMotionNotify) if (pEvents->type == DeviceMotionNotify)
@ -1262,7 +1312,7 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
return (0); return (0);
} }
int void
CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask) CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
WindowPtr pWin; WindowPtr pWin;
int type; int type;
@ -1272,7 +1322,6 @@ CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
Mask deliveryMask; Mask deliveryMask;
{ {
DeviceIntPtr dev; DeviceIntPtr dev;
DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS); dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS);
if (type == DeviceMotionNotify) if (type == DeviceMotionNotify)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/extinit.c,v 3.6 2001/12/14 19:58:55 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -55,6 +56,7 @@ SOFTWARE.
#define NUMTYPES 15 #define NUMTYPES 15
#define NEED_EVENTS #define NEED_EVENTS
#define NEED_REPLIES
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "inputstr.h" #include "inputstr.h"
@ -63,6 +65,51 @@ SOFTWARE.
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "dixevents.h"
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
#include "swaprep.h"
/* modules local to Xi */
#include "allowev.h"
#include "chgdctl.h"
#include "chgfctl.h"
#include "chgkbd.h"
#include "chgprop.h"
#include "chgptr.h"
#include "closedev.h"
#include "devbell.h"
#include "getbmap.h"
#include "getbmap.h"
#include "getdctl.h"
#include "getfctl.h"
#include "getfocus.h"
#include "getkmap.h"
#include "getmmap.h"
#include "getprop.h"
#include "getselev.h"
#include "getvers.h"
#include "getvers.h"
#include "grabdev.h"
#include "grabdevb.h"
#include "grabdevk.h"
#include "gtmotion.h"
#include "listdev.h"
#include "opendev.h"
#include "queryst.h"
#include "selectev.h"
#include "sendexev.h"
#include "chgkmap.h"
#include "setbmap.h"
#include "setdval.h"
#include "setfocus.h"
#include "setmmap.h"
#include "setmode.h"
#include "ungrdev.h"
#include "ungrdevb.h"
#include "ungrdevk.h"
static Mask lastExtEventMask = 1; static Mask lastExtEventMask = 1;
int ExtEventIndex; int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE]; Mask ExtValidMasks[EMASKSIZE];
@ -141,10 +188,8 @@ int RT_INPUTCLIENT;
* *
*/ */
extern void (* ReplySwapVector[256]) ();
extern void (* EventSwapVector[128]) ();
extern XExtensionVersion AllExtensionVersions[]; extern XExtensionVersion AllExtensionVersions[];
extern InputInfo inputInfo;
Mask PropagateMask[MAX_DEVICES]; Mask PropagateMask[MAX_DEVICES];
/***************************************************************** /*****************************************************************
@ -153,12 +198,6 @@ Mask PropagateMask[MAX_DEVICES];
* *
*/ */
int ProcIDispatch();
int SProcIDispatch();
void SReplyIDispatch();
void IResetProc();
void SEventIDispatch();
void NotImplemented();
static XExtensionVersion thisversion = static XExtensionVersion thisversion =
{XI_Present, {XI_Present,
XI_Add_XChangeDeviceControl_Major, XI_Add_XChangeDeviceControl_Major,
@ -177,10 +216,8 @@ static XExtensionVersion thisversion =
void void
XInputExtensionInit() XInputExtensionInit()
{ {
ExtensionEntry *extEntry, *AddExtension(); ExtensionEntry *extEntry;
int XShutDownDevice();
int InputClientGone();
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode); SProcIDispatch, IResetProc, StandardMinorOpcode);
@ -189,9 +226,9 @@ XInputExtensionInit()
IReqCode = extEntry->base; IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion; AllExtensionVersions[IReqCode-128] = thisversion;
MakeDeviceTypeAtoms (); MakeDeviceTypeAtoms ();
RT_INPUTCLIENT = CreateNewResourceType(InputClientGone); RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
FixExtensionEvents (extEntry); FixExtensionEvents (extEntry);
ReplySwapVector[IReqCode] = SReplyIDispatch; ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch; EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch; EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch; EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@ -224,7 +261,7 @@ XInputExtensionInit()
int int
ProcIDispatch (client) ProcIDispatch (client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion) if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client)); return(ProcXGetExtensionVersion(client));
@ -315,7 +352,7 @@ ProcIDispatch (client)
int int
SProcIDispatch(client) SProcIDispatch(client)
register ClientPtr client; register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion) if (stuff->data == X_GetExtensionVersion)
return(SProcXGetExtensionVersion(client)); return(SProcXGetExtensionVersion(client));
@ -401,54 +438,59 @@ SProcIDispatch(client)
* *
*/ */
/* FIXME: this would be more concise and readable in ANSI C */
#define DISPATCH(code) \
if (rep->RepType == X_##code) \
SRepX##code (client, len, (x##code##Reply *) rep)
void void
SReplyIDispatch (client, len, rep) SReplyIDispatch (client, len, rep)
ClientPtr client; ClientPtr client;
int len; int len;
xGrabDeviceReply *rep; /* All we look at is the type field */ xGrabDeviceReply *rep; /* All we look at is the type field */
{ /* This is common to all replies */ { /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion) if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion (client, len, rep); SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
else if (rep->RepType == X_ListInputDevices) else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices (client, len, rep); SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
else if (rep->RepType == X_OpenDevice) else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice (client, len, rep); SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
else if (rep->RepType == X_SetDeviceMode) else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode (client, len, rep); SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents) else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents (client, len, rep); SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
else if (rep->RepType == X_GetDeviceDontPropagateList) else if (rep->RepType == X_GetDeviceDontPropagateList)
SRepXGetDeviceDontPropagateList (client, len, rep); SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep);
else if (rep->RepType == X_GetDeviceMotionEvents) else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents (client, len, rep); SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice) else if (rep->RepType == X_ChangeKeyboardDevice)
SRepXChangeKeyboardDevice (client, len, rep); SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice) else if (rep->RepType == X_ChangePointerDevice)
SRepXChangePointerDevice (client, len, rep); SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
else if (rep->RepType == X_GrabDevice) else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice (client, len, rep); SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
else if (rep->RepType == X_GetDeviceFocus) else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus (client, len, rep); SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
else if (rep->RepType == X_GetFeedbackControl) else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl (client, len, rep); SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
else if (rep->RepType == X_GetDeviceKeyMapping) else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping (client, len, rep); SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
else if (rep->RepType == X_GetDeviceModifierMapping) else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping (client, len, rep); SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_SetDeviceModifierMapping) else if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping (client, len, rep); SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_GetDeviceButtonMapping) else if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping (client, len, rep); SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_SetDeviceButtonMapping) else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping (client, len, rep); SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_QueryDeviceState) else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState (client, len, rep); SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
else if (rep->RepType == X_SetDeviceValuators) else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators (client, len, rep); SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
else if (rep->RepType == X_GetDeviceControl) else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl (client, len, rep); SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
else if (rep->RepType == X_ChangeDeviceControl) else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl (client, len, rep); SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
else else
{ {
FatalError("XINPUT confused sending swapped reply"); FatalError("XINPUT confused sending swapped reply");
@ -461,15 +503,17 @@ SReplyIDispatch (client, len, rep)
* *
* Swap any events defined in this extension. * Swap any events defined in this extension.
*/ */
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
void void
SEventIDispatch (from, to) SEventIDispatch (from, to)
xEvent *from; xEvent *from;
xEvent *to; xEvent *to;
{ {
int type = from->u.u.type & 0177; int type = from->u.u.type & 0177;
if (type == DeviceValuator) if (type == DeviceValuator)
SEventDeviceValuator (from, to); DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress) else if (type == DeviceKeyPress)
{ {
SKeyButtonPtrEvent (from, to); SKeyButtonPtrEvent (from, to);
@ -496,9 +540,9 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} }
else if (type == DeviceFocusIn) else if (type == DeviceFocusIn)
SEventFocus (from, to); DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut) else if (type == DeviceFocusOut)
SEventFocus (from, to); DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn) else if (type == ProximityIn)
{ {
SKeyButtonPtrEvent (from, to); SKeyButtonPtrEvent (from, to);
@ -510,15 +554,15 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} }
else if (type == DeviceStateNotify) else if (type == DeviceStateNotify)
SDeviceStateNotifyEvent (from, to); DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify) else if (type == DeviceKeyStateNotify)
SDeviceKeyStateNotifyEvent (from, to); DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify) else if (type == DeviceButtonStateNotify)
SDeviceButtonStateNotifyEvent (from, to); DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify) else if (type == DeviceMappingNotify)
SDeviceMappingNotifyEvent (from, to); DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify) else if (type == ChangeDeviceNotify)
SChangeDeviceNotifyEvent (from, to); DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else else
{ {
FatalError("XInputExtension: Impossible event!\n"); FatalError("XInputExtension: Impossible event!\n");
@ -531,6 +575,7 @@ SEventIDispatch (from, to)
* *
*/ */
void
SEventDeviceValuator (from, to) SEventDeviceValuator (from, to)
deviceValuator *from; deviceValuator *from;
deviceValuator *to; deviceValuator *to;
@ -549,10 +594,11 @@ SEventDeviceValuator (from, to)
} }
} }
void
SEventFocus (from, to) SEventFocus (from, to)
deviceFocus *from; deviceFocus *from;
deviceFocus *to; deviceFocus *to;
{ {
register char n; register char n;
*to = *from; *to = *from;
@ -561,10 +607,11 @@ SEventFocus (from, to)
swapl(&to->window, n); swapl(&to->window, n);
} }
void
SDeviceStateNotifyEvent (from, to) SDeviceStateNotifyEvent (from, to)
deviceStateNotify *from; deviceStateNotify *from;
deviceStateNotify *to; deviceStateNotify *to;
{ {
register int i; register int i;
register char n; register char n;
INT32 *ip B32; INT32 *ip B32;
@ -579,30 +626,33 @@ SDeviceStateNotifyEvent (from, to)
} }
} }
void
SDeviceKeyStateNotifyEvent (from, to) SDeviceKeyStateNotifyEvent (from, to)
deviceKeyStateNotify *from; deviceKeyStateNotify *from;
deviceKeyStateNotify *to; deviceKeyStateNotify *to;
{ {
register char n; register char n;
*to = *from; *to = *from;
swaps(&to->sequenceNumber,n); swaps(&to->sequenceNumber,n);
} }
void
SDeviceButtonStateNotifyEvent (from, to) SDeviceButtonStateNotifyEvent (from, to)
deviceButtonStateNotify *from; deviceButtonStateNotify *from;
deviceButtonStateNotify *to; deviceButtonStateNotify *to;
{ {
register char n; register char n;
*to = *from; *to = *from;
swaps(&to->sequenceNumber,n); swaps(&to->sequenceNumber,n);
} }
void
SChangeDeviceNotifyEvent (from, to) SChangeDeviceNotifyEvent (from, to)
changeDeviceNotify *from; changeDeviceNotify *from;
changeDeviceNotify *to; changeDeviceNotify *to;
{ {
register char n; register char n;
*to = *from; *to = *from;
@ -610,10 +660,11 @@ SChangeDeviceNotifyEvent (from, to)
swapl(&to->time, n); swapl(&to->time, n);
} }
void
SDeviceMappingNotifyEvent (from, to) SDeviceMappingNotifyEvent (from, to)
deviceMappingNotify *from; deviceMappingNotify *from;
deviceMappingNotify *to; deviceMappingNotify *to;
{ {
register char n; register char n;
*to = *from; *to = *from;
@ -627,14 +678,11 @@ SDeviceMappingNotifyEvent (from, to)
* *
*/ */
void
FixExtensionEvents (extEntry) FixExtensionEvents (extEntry)
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
{ {
Mask mask, GetNextExtEventMask(); Mask mask;
void SetMaskForExtEvent();
void SetEventInfo();
void AllowPropagateSuppress();
void SetExclusiveAccess();
DeviceValuator = extEntry->eventBase; DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1; DeviceKeyPress = DeviceValuator + 1;
@ -733,8 +781,9 @@ FixExtensionEvents (extEntry)
* *
*/ */
void
RestoreExtensionEvents () RestoreExtensionEvents ()
{ {
int i; int i;
IReqCode = 0; IReqCode = 0;
@ -781,10 +830,11 @@ RestoreExtensionEvents ()
*/ */
void void
IResetProc() IResetProc(unused)
ExtensionEntry *unused;
{ {
ReplySwapVector[IReqCode] = NotImplemented; ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented; EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented; EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented; EventSwapVector[DeviceKeyRelease] = NotImplemented;
@ -809,12 +859,12 @@ IResetProc()
* *
*/ */
int void
AssignTypeAndName (dev, type, name) AssignTypeAndName (dev, type, name)
DeviceIntPtr dev; DeviceIntPtr dev;
Atom type; Atom type;
char *name; char *name;
{ {
dev->type = type; dev->type = type;
dev->name = (char *) xalloc(strlen(name)+1); dev->name = (char *) xalloc(strlen(name)+1);
strcpy (dev->name, name); strcpy (dev->name, name);
@ -826,7 +876,7 @@ AssignTypeAndName (dev, type, name)
* *
*/ */
int void
MakeDeviceTypeAtoms () MakeDeviceTypeAtoms ()
{ {
int i; int i;
@ -844,9 +894,14 @@ MakeDeviceTypeAtoms ()
*/ */
DeviceIntPtr DeviceIntPtr
#if NeedFunctionPrototypes
LookupDeviceIntRec (
CARD8 id)
#else
LookupDeviceIntRec (id) LookupDeviceIntRec (id)
CARD8 id; CARD8 id;
{ #endif
{
DeviceIntPtr dev; DeviceIntPtr dev;
for (dev=inputInfo.devices; dev; dev=dev->next) for (dev=inputInfo.devices; dev; dev=dev->next)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getbmap.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "getbmap.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -88,6 +89,7 @@ SProcXGetDeviceButtonMapping(client)
* *
*/ */
int
ProcXGetDeviceButtonMapping (client) ProcXGetDeviceButtonMapping (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -134,6 +136,7 @@ ProcXGetDeviceButtonMapping (client)
* *
*/ */
void
SRepXGetDeviceButtonMapping (client, size, rep) SRepXGetDeviceButtonMapping (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getdctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,12 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "getdctl.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
void CopySwapDeviceResolution();
/*********************************************************************** /***********************************************************************
* *
@ -92,6 +92,7 @@ SProcXGetDeviceControl(client)
* *
*/ */
int
ProcXGetDeviceControl(client) ProcXGetDeviceControl(client)
ClientPtr client; ClientPtr client;
{ {
@ -134,7 +135,7 @@ ProcXGetDeviceControl(client)
return Success; return Success;
} }
buf = (char *) Xalloc (total_length); buf = (char *) xalloc (total_length);
if (!buf) if (!buf)
{ {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
@ -156,7 +157,7 @@ ProcXGetDeviceControl(client)
rep.length = (total_length+3) >> 2; rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
Xfree (savbuf); xfree (savbuf);
return Success; return Success;
} }
@ -210,6 +211,7 @@ CopySwapDeviceResolution (client, v, buf, length)
* *
*/ */
void
SRepXGetDeviceControl (client, size, rep) SRepXGetDeviceControl (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getfctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,17 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "getfctl.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
void CopySwapKbdFeedback();
void CopySwapPtrFeedback();
void CopySwapIntegerFeedback();
void CopySwapStringFeedback();
void CopySwapLedFeedback();
void CopySwapBellFeedback();
/*********************************************************************** /***********************************************************************
* *
@ -95,6 +90,7 @@ SProcXGetFeedbackControl(client)
* *
*/ */
int
ProcXGetFeedbackControl(client) ProcXGetFeedbackControl(client)
ClientPtr client; ClientPtr client;
{ {
@ -165,7 +161,7 @@ ProcXGetFeedbackControl(client)
return Success; return Success;
} }
buf = (char *) Xalloc (total_length); buf = (char *) xalloc (total_length);
if (!buf) if (!buf)
{ {
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
@ -190,7 +186,7 @@ ProcXGetFeedbackControl(client)
rep.length = (total_length+3) >> 2; rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
Xfree (savbuf); xfree (savbuf);
return Success; return Success;
} }
@ -407,6 +403,7 @@ CopySwapBellFeedback (client, b, buf)
* *
*/ */
void
SRepXGetFeedbackControl (client, size, rep) SRepXGetFeedbackControl (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getfocus.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,11 +61,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "getfocus.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -136,6 +137,7 @@ ProcXGetDeviceFocus(client)
* *
*/ */
void
SRepXGetDeviceFocus (client, size, rep) SRepXGetDeviceFocus (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getkmap.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
extern int IReqCode; #include "getkmap.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -89,10 +91,10 @@ SProcXGetDeviceKeyMapping(client)
* *
*/ */
int
ProcXGetDeviceKeyMapping(client) ProcXGetDeviceKeyMapping(client)
register ClientPtr client; register ClientPtr client;
{ {
extern void CopySwap32Write();
xGetDeviceKeyMappingReply rep; xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
KeySymsPtr k; KeySymsPtr k;
@ -140,7 +142,7 @@ ProcXGetDeviceKeyMapping(client)
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */ rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = CopySwap32Write; client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient( WriteSwappedDataToClient(
client, client,
k->mapWidth * stuff->count * sizeof(KeySym), k->mapWidth * stuff->count * sizeof(KeySym),
@ -157,6 +159,7 @@ ProcXGetDeviceKeyMapping(client)
* *
*/ */
void
SRepXGetDeviceKeyMapping (client, size, rep) SRepXGetDeviceKeyMapping (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getmmap.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" /* Request macro */ #include "XIproto.h" /* Request macro */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "getmmap.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -89,6 +90,7 @@ SProcXGetDeviceModifierMapping(client)
* *
*/ */
int
ProcXGetDeviceModifierMapping(client) ProcXGetDeviceModifierMapping(client)
ClientPtr client; ClientPtr client;
{ {
@ -138,6 +140,7 @@ ProcXGetDeviceModifierMapping(client)
* *
*/ */
void
SRepXGetDeviceModifierMapping (client, size, rep) SRepXGetDeviceModifierMapping (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,11 +61,15 @@ SOFTWARE.
#include "windowstr.h" /* window structs */ #include "windowstr.h" /* window structs */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
#include "getprop.h"
extern int IReqCode;
extern void (* ReplySwapVector[256]) ();
extern XExtEventInfo EventInfo[]; extern XExtEventInfo EventInfo[];
DeviceIntPtr LookupDeviceIntRec(); extern int ExtEventIndex;
/*********************************************************************** /***********************************************************************
* *
@ -91,16 +96,15 @@ SProcXGetDeviceDontPropagateList(client)
* *
*/ */
int
ProcXGetDeviceDontPropagateList (client) ProcXGetDeviceDontPropagateList (client)
register ClientPtr client; register ClientPtr client;
{ {
CARD16 count = 0; CARD16 count = 0;
int i; int i;
XEventClass *buf, *tbuf; XEventClass *buf = NULL, *tbuf;
WindowPtr pWin; WindowPtr pWin;
xGetDeviceDontPropagateListReply rep; xGetDeviceDontPropagateListReply rep;
XEventClass *ClassFromMask ();
void Swap32Write();
OtherInputMasks *others; OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq); REQUEST(xGetDeviceDontPropagateListReq);
@ -121,7 +125,7 @@ ProcXGetDeviceDontPropagateList (client)
return Success; return Success;
} }
if (others = wOtherInputMasks(pWin)) if ((others = wOtherInputMasks(pWin)) != 0)
{ {
for (i=0; i<EMASKSIZE; i++) for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i, tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
@ -129,7 +133,7 @@ ProcXGetDeviceDontPropagateList (client)
if (count) if (count)
{ {
rep.count = count; rep.count = count;
buf = (XEventClass *) Xalloc (rep.count * sizeof(XEventClass)); buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2; rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
tbuf = buf; tbuf = buf;
@ -144,9 +148,9 @@ ProcXGetDeviceDontPropagateList (client)
if (count) if (count)
{ {
client->pSwapReplyFunc = Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf); WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
Xfree (buf); xfree (buf);
} }
return Success; return Success;
} }
@ -169,7 +173,6 @@ XEventClass
int i,j; int i,j;
int id = maskndx; int id = maskndx;
Mask tmask = 0x80000000; Mask tmask = 0x80000000;
extern int ExtEventIndex;
for (i=0; i<32; i++,tmask>>=1) for (i=0; i<32; i++,tmask>>=1)
if (tmask & mask) if (tmask & mask)
@ -193,6 +196,7 @@ XEventClass
* *
*/ */
void
SRepXGetDeviceDontPropagateList (client, size, rep) SRepXGetDeviceDontPropagateList (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -1,3 +1,4 @@
/* $XFree86: xc/programs/Xserver/Xi/getselev.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/************************************************************ /************************************************************
Copyright 1989, 1998 The Open Group Copyright 1989, 1998 The Open Group
@ -60,10 +61,13 @@ SOFTWARE.
#include "XIproto.h" #include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */ #include "windowstr.h" /* window struct */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
extern int IReqCode; #include "getprop.h"
extern void (* ReplySwapVector[256]) (); #include "getselev.h"
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -99,11 +103,9 @@ ProcXGetSelectedExtensionEvents(client)
int total_length = 0; int total_length = 0;
xGetSelectedExtensionEventsReply rep; xGetSelectedExtensionEventsReply rep;
WindowPtr pWin; WindowPtr pWin;
XEventClass *buf; XEventClass *buf = NULL;
XEventClass *tclient; XEventClass *tclient;
XEventClass *aclient; XEventClass *aclient;
XEventClass *ClassFromMask ();
void Swap32Write();
OtherInputMasks *pOthers; OtherInputMasks *pOthers;
InputClientsPtr others; InputClientsPtr others;
@ -124,7 +126,7 @@ ProcXGetSelectedExtensionEvents(client)
return Success; return Success;
} }
if (pOthers=wOtherInputMasks(pWin)) if ((pOthers = wOtherInputMasks(pWin)) != 0)
{ {
for (others = pOthers->inputClients; others; others=others->next) for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++) for (i=0; i<EMASKSIZE; i++)
@ -143,7 +145,7 @@ ProcXGetSelectedExtensionEvents(client)
total_length = (rep.all_clients_count + rep.this_client_count) * total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass); sizeof (XEventClass);
rep.length = (total_length + 3) >> 2; rep.length = (total_length + 3) >> 2;
buf = (XEventClass *) Xalloc (total_length); buf = (XEventClass *) xalloc (total_length);
tclient = buf; tclient = buf;
aclient = buf + rep.this_client_count; aclient = buf + rep.this_client_count;
@ -160,9 +162,9 @@ ProcXGetSelectedExtensionEvents(client)
if (total_length) if (total_length)
{ {
client->pSwapReplyFunc = Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf); WriteSwappedDataToClient( client, total_length, buf);
Xfree (buf); xfree (buf);
} }
return Success; return Success;
} }
@ -174,6 +176,7 @@ ProcXGetSelectedExtensionEvents(client)
* *
*/ */
void
SRepXGetSelectedExtensionEvents (client, size, rep) SRepXGetSelectedExtensionEvents (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/getvers.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,10 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "getvers.h"
extern int IReqCode;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
XExtensionVersion AllExtensionVersions[128]; XExtensionVersion AllExtensionVersions[128];
/*********************************************************************** /***********************************************************************
@ -90,6 +93,7 @@ SProcXGetExtensionVersion(client)
* *
*/ */
int
ProcXGetExtensionVersion (client) ProcXGetExtensionVersion (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -133,6 +137,7 @@ ProcXGetExtensionVersion (client)
* *
*/ */
void
SRepXGetExtensionVersion (client, size, rep) SRepXGetExtensionVersion (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/grabdev.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -61,13 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
extern int IReqCode;
extern int BadDevice;
extern int BadClass;
extern XExtEventInfo EventInfo[]; extern XExtEventInfo EventInfo[];
extern void (* ReplySwapVector[256]) (); extern int ExtEventIndex;
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -171,7 +174,6 @@ CreateMaskFromList (client, list, count, mask, dev, req)
int i,j; int i,j;
int device; int device;
DeviceIntPtr tdev; DeviceIntPtr tdev;
extern int ExtEventIndex;
for (i=0; i<EMASKSIZE; i++) for (i=0; i<EMASKSIZE; i++)
{ {
@ -212,6 +214,7 @@ CreateMaskFromList (client, list, count, mask, dev, req)
* *
*/ */
void
SRepXGrabDevice (client, size, rep) SRepXGrabDevice (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/grabdevb.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,11 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "grabdev.h"
extern int BadDevice; #include "grabdevb.h"
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -154,7 +157,7 @@ ProcXGrabDeviceButton(client)
return Success; return Success;
ret = GrabButton(client, dev, stuff->this_device_mode, ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button, stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
stuff->grabWindow, stuff->ownerEvents, NullCursor, NullWindow, stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0,
tmp[stuff->grabbed_device].mask); tmp[stuff->grabbed_device].mask);
if (ret != Success) if (ret != Success)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/grabdevk.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,13 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "grabdev.h"
extern int BadClass; #include "grabdevk.h"
extern int BadDevice;
extern InputInfo inputInfo;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/gtmotion.c,v 3.7 2001/12/14 19:58:57 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode; #include "gtmotion.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -97,11 +99,11 @@ ProcXGetDeviceMotionEvents(client)
{ {
INT32 *coords = NULL, *bufptr; INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep; xGetDeviceMotionEventsReply rep;
int i, j, num_events, axes, size, tsize; unsigned long i;
int num_events, axes, size = 0, tsize;
unsigned long nEvents; unsigned long nEvents;
DeviceIntPtr dev; DeviceIntPtr dev;
TimeStamp start, stop; TimeStamp start, stop;
void XSwapTimeCoordWrite();
int length = 0; int length = 0;
ValuatorClassPtr v; ValuatorClassPtr v;
@ -192,6 +194,7 @@ ProcXGetDeviceMotionEvents(client)
* *
*/ */
void
SRepXGetDeviceMotionEvents (client, size, rep) SRepXGetDeviceMotionEvents (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/listdev.c,v 3.4 2001/12/14 19:58:58 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,22 +60,14 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" /* FIXME */
#include "listdev.h"
#define VPC 20 /* Max # valuators per chunk */ #define VPC 20 /* Max # valuators per chunk */
extern InputInfo inputInfo;
extern int IReqCode;
extern int BadDevice;
extern void (*ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
void CopySwapKeyClass ();
void CopySwapButtonClass ();
int CopySwapValuatorClass ();
void SizeDeviceInfo ();
void ListDeviceInfo ();
void AddOtherInputDevices ();
void CopyDeviceName ();
void CopySwapDevice ();
/*********************************************************************** /***********************************************************************
* *
@ -99,6 +92,7 @@ SProcXListInputDevices(client)
* *
*/ */
int
ProcXListInputDevices (client) ProcXListInputDevices (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -114,7 +108,6 @@ ProcXListInputDevices (client)
xDeviceInfo *dev; xDeviceInfo *dev;
DeviceIntPtr d; DeviceIntPtr d;
REQUEST(xListInputDevicesReq);
REQUEST_SIZE_MATCH(xListInputDevicesReq); REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep.repType = X_Reply; rep.repType = X_Reply;
@ -131,7 +124,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size); SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize; total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
devbuf = (char *) Xalloc (total_length); devbuf = (char *) xalloc (total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo)); classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size; namebuf = classbuf + size;
savbuf = devbuf; savbuf = devbuf;
@ -146,7 +139,7 @@ ProcXListInputDevices (client)
rep.length = (total_length + 3) >> 2; rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep); WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
Xfree (savbuf); xfree (savbuf);
return Success; return Success;
} }
@ -396,6 +389,7 @@ CopySwapValuatorClass (client, v, buf)
* *
*/ */
void
SRepXListInputDevices (client, size, rep) SRepXListInputDevices (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/opendev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -56,17 +57,18 @@ SOFTWARE.
#define NEED_REPLIES #define NEED_REPLIES
#include "X.h" /* for inputstr.h */ #include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */ #include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */ #include "XIstubs.h"
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "opendev.h"
extern int IReqCode;
extern int BadDevice;
extern CARD8 event_base []; extern CARD8 event_base [];
extern InputInfo inputInfo;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -102,7 +104,6 @@ ProcXOpenDevice(client)
int status = Success; int status = Success;
xOpenDeviceReply rep; xOpenDeviceReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
void OpenInputDevice();
REQUEST(xOpenDeviceReq); REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq); REQUEST_SIZE_MATCH(xOpenDeviceReq);
@ -186,6 +187,7 @@ ProcXOpenDevice(client)
* *
*/ */
void
SRepXOpenDevice (client, size, rep) SRepXOpenDevice (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group. from The Open Group.
*/ */
/* $XFree86: xc/programs/Xserver/Xi/queryst.c,v 3.5 2001/12/14 19:58:58 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -41,11 +42,12 @@ from The Open Group.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode; #include "queryst.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -129,7 +131,7 @@ ProcXQueryDeviceState(client)
(v->numAxes * sizeof(int))); (v->numAxes * sizeof(int)));
num_classes++; num_classes++;
} }
buf = (char *) Xalloc (total_length); buf = (char *) xalloc (total_length);
if (!buf) if (!buf)
{ {
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
@ -184,7 +186,7 @@ ProcXQueryDeviceState(client)
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep); WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0) if (total_length > 0)
WriteToClient (client, total_length, savbuf); WriteToClient (client, total_length, savbuf);
Xfree (savbuf); xfree (savbuf);
return Success; return Success;
} }
@ -195,6 +197,7 @@ ProcXQueryDeviceState(client)
* *
*/ */
void
SRepXQueryDeviceState (client, size, rep) SRepXQueryDeviceState (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/selectev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -61,12 +62,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
#include "grabdev.h"
#include "selectev.h"
extern int IReqCode;
extern Mask ExtExclusiveMasks[]; extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[]; extern Mask ExtValidMasks[];
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -137,7 +142,7 @@ ProcXSelectExtensionEvent (client)
for (i=0; i<EMASKSIZE; i++) for (i=0; i<EMASKSIZE; i++)
if (tmp[i].dev != NULL) if (tmp[i].dev != NULL)
{ {
if ((ret = SelectForWindow(tmp[i].dev, pWin, client, tmp[i].mask, if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask,
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success) ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
{ {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/sendexev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -61,12 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* Window */ #include "windowstr.h" /* Window */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode; #include "grabdev.h"
extern int BadDevice; #include "sendexev.h"
extern void (* ReplySwapVector[256]) ();
extern void (* EventSwapVector[128]) (); extern int lastEvent; /* Defined in extension.c */
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -83,7 +87,7 @@ SProcXSendExtensionEvent(client)
register int i; register int i;
xEvent eventT; xEvent eventT;
xEvent *eventP; xEvent *eventP;
void (*proc)(), NotImplemented(); EventSwapPtr proc;
REQUEST(xSendExtensionEventReq); REQUEST(xSendExtensionEventReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
@ -116,11 +120,11 @@ SProcXSendExtensionEvent(client)
* *
*/ */
int
ProcXSendExtensionEvent (client) ProcXSendExtensionEvent (client)
register ClientPtr client; register ClientPtr client;
{ {
int ret; int ret;
extern int lastEvent; /* Defined in extension.c */
DeviceIntPtr dev; DeviceIntPtr dev;
xEvent *first; xEvent *first;
XEventClass *list; XEventClass *list;
@ -163,7 +167,7 @@ ProcXSendExtensionEvent (client)
return Success; return Success;
ret = (SendEvent (client, dev, stuff->destination, ret = (SendEvent (client, dev, stuff->destination,
stuff->propagate, &stuff[1], tmp[stuff->deviceid].mask, stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask,
stuff->num_events)); stuff->num_events));
if (ret != Success) if (ret != Success)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/setbmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -62,12 +63,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "setbmap.h"
extern int BadDevice;
extern int DeviceMappingNotify;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -92,6 +93,7 @@ SProcXSetDeviceButtonMapping(client)
* *
*/ */
int
ProcXSetDeviceButtonMapping (client) ProcXSetDeviceButtonMapping (client)
register ClientPtr client; register ClientPtr client;
{ {
@ -124,7 +126,7 @@ ProcXSetDeviceButtonMapping (client)
return Success; return Success;
} }
ret = SetButtonMapping (client, dev, stuff->map_length, &stuff[1]); ret = SetButtonMapping (client, dev, stuff->map_length, (BYTE *)&stuff[1]);
if (ret == BadValue || ret == BadMatch) if (ret == BadValue || ret == BadMatch)
{ {
@ -150,6 +152,7 @@ ProcXSetDeviceButtonMapping (client)
* *
*/ */
void
SRepXSetDeviceButtonMapping (client, size, rep) SRepXSetDeviceButtonMapping (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/setdval.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES #define NEED_REPLIES
#include "X.h" /* for inputstr.h */ #include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */ #include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */ #include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "setdval.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -154,6 +156,7 @@ ProcXSetDeviceValuators(client)
* *
*/ */
void
SRepXSetDeviceValuators (client, size, rep) SRepXSetDeviceValuators (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/setfocus.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -61,11 +62,13 @@ SOFTWARE.
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
extern int IReqCode; #include "dixevents.h"
extern int BadDevice;
extern InputInfo inputInfo; #include "extnsionst.h"
extern void (* ReplySwapVector[256]) (); #include "extinit.h" /* LookupDeviceIntRec */
DeviceIntPtr LookupDeviceIntRec(); #include "exglobals.h"
#include "setfocus.h"
/*********************************************************************** /***********************************************************************
* *

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/setmmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/******************************************************************** /********************************************************************
* *
@ -59,12 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "setmmap.h"
extern int BadDevice;
extern int DeviceMappingNotify;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -90,6 +91,7 @@ SProcXSetDeviceModifierMapping(client)
* *
*/ */
int
ProcXSetDeviceModifierMapping(client) ProcXSetDeviceModifierMapping(client)
ClientPtr client; ClientPtr client;
{ {
@ -116,7 +118,7 @@ ProcXSetDeviceModifierMapping(client)
ret = SetModifierMapping(client, dev, stuff->length, ret = SetModifierMapping(client, dev, stuff->length,
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier, (sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
&stuff[1], &kp); (BYTE *)&stuff[1], &kp);
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed) if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
{ {
@ -143,6 +145,7 @@ ProcXSetDeviceModifierMapping(client)
* *
*/ */
void
SRepXSetDeviceModifierMapping (client, size, rep) SRepXSetDeviceModifierMapping (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/setmode.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES #define NEED_REPLIES
#include "X.h" /* for inputstr.h */ #include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */ #include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */ #include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "setmode.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *
@ -138,6 +140,7 @@ ProcXSetDeviceMode(client)
* *
*/ */
void
SRepXSetDeviceMode (client, size, rep) SRepXSetDeviceMode (client, size, rep)
ClientPtr client; ClientPtr client;
int size; int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.4 2001/12/14 19:58:59 dawes Exp $ */
/* /*
* stubs.c -- stub routines for the X server side of the XINPUT * stubs.c -- stub routines for the X server side of the XINPUT
@ -62,6 +63,7 @@ SOFTWARE.
#include "inputstr.h" #include "inputstr.h"
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "XIstubs.h"
/*********************************************************************** /***********************************************************************
* *
@ -95,6 +97,7 @@ ChangeKeyboardDevice (old_dev, new_dev)
/*********************************************************************** /***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/ **********************************************************************/
return BadMatch;
} }
@ -129,9 +132,17 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/ */
int int
#if NeedFunctionPrototypes
ChangePointerDevice (
DeviceIntPtr old_dev,
DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
#else
ChangePointerDevice (old_dev, new_dev, x, y) ChangePointerDevice (old_dev, new_dev, x, y)
DeviceIntPtr old_dev, new_dev; DeviceIntPtr old_dev, new_dev;
unsigned char x, y; unsigned char x, y;
#endif
{ {
/*********************************************************************** /***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
@ -143,6 +154,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
else else
axes_changed = FALSE; axes_changed = FALSE;
*************************************************************************/ *************************************************************************/
return BadMatch;
} }
/*********************************************************************** /***********************************************************************
@ -194,13 +206,13 @@ CloseInputDevice (d, client)
void void
AddOtherInputDevices () AddOtherInputDevices ()
{ {
/**********************************************************************
for each uninitialized device, do something like:
DeviceIntPtr dev; DeviceIntPtr dev;
DeviceProc deviceProc; DeviceProc deviceProc;
pointer private; pointer private;
/**********************************************************************
for each uninitialized device, do something like:
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE); dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
dev->public.devicePrivate = private; dev->public.devicePrivate = private;
RegisterOtherDevice(dev); RegisterOtherDevice(dev);

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/ungrdev.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode; #include "ungrdev.h"
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevb.h"
#define AllModifiersMask ( \ #define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask ) Mod3Mask | Mod4Mask | Mod5Mask )
extern int IReqCode;
extern int BadDevice;
extern int DeviceButtonPress;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE. SOFTWARE.
********************************************************/ ********************************************************/
/* $XFree86: xc/programs/Xserver/Xi/ungrdevk.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/*********************************************************************** /***********************************************************************
* *
@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevk.h"
#define AllModifiersMask ( \ #define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask ) Mod3Mask | Mod4Mask | Mod5Mask )
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
extern int DeviceKeyPress;
DeviceIntPtr LookupDeviceIntRec();
/*********************************************************************** /***********************************************************************
* *

View File

@ -0,0 +1 @@
! So the file isn't empty

View File

@ -0,0 +1 @@
! So the file isn't empty

View File

@ -30,13 +30,11 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.5 2001/12/21 21:02:04 dawes Exp $ */
#include <scrnintstr.h> #include <scrnintstr.h>
#define _XP_PRINT_SERVER_ #include "attributes.h"
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include "AttrValid.h"
/* /*
* default medium-source-sizes supported = na-letter w/.25" margins * default medium-source-sizes supported = na-letter w/.25" margins
@ -48,7 +46,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
&DefaultMediumSize, 1 &DefaultMediumSize, 1
}; };
static XpOidMediumSourceSize DefaultMediumSourceSize = { static XpOidMediumSourceSize DefaultMediumSourceSize = {
xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
}; };
static XpOidMediumSS DefaultMediumSS = { static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1 &DefaultMediumSourceSize, 1
@ -300,7 +298,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
} }
const XpOidMediumSS* const XpOidMediumSS*
XpGetDefaultMediumSS() XpGetDefaultMediumSS(void)
{ {
return &DefaultMediumSS; return &DefaultMediumSS;
} }

View File

@ -30,12 +30,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.7 2001/12/21 21:02:04 dawes Exp $ */
#ifndef _Xp_AttrValid_h #ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h #define _Xp_AttrValid_h
#include <X11/extensions/Printstr.h>
#include "Oid.h" #include "Oid.h"
#include "attributes.h"
#define XpNumber(a) (sizeof(a) / sizeof(*(a))) #define XpNumber(a) (sizeof(a) / sizeof(*(a)))
@ -83,6 +84,9 @@ typedef struct
(const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid)) (const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
#define XpPutStringAttr(pContext, pool, oid, value) \ #define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value) XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
/* /*
* XpOid-valued attribute access * XpOid-valued attribute access
*/ */
@ -175,7 +179,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
XPAttributes pool, XPAttributes pool,
XpOid oid, XpOid oid,
const XpOidMediumSS* msss); const XpOidMediumSS* msss);
const XpOidMediumSS* XpGetDefaultMediumSS(); const XpOidMediumSS* XpGetDefaultMediumSS(void);
/* /*
* XpOidTrayMediumList-valued attribute access * XpOidTrayMediumList-valued attribute access
@ -189,12 +193,15 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
XPAttributes pool, XPAttributes pool,
XpOid oid, XpOid oid,
const XpOidTrayMediumList* tm); const XpOidTrayMediumList* tm);
BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
/* /*
* Attribute pool validation * Attribute pool validation
*/ */
void XpValidateAttributePool(XpContextPtr pContext, void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool, XPAttributes pool,
const XpValidatePoolsRec* vpr); const XpValidatePoolsRec* vpr);
void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext, void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr); const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext, void XpValidateJobPool(XpContextPtr pContext,
@ -203,6 +210,10 @@ void XpValidateDocumentPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr); const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext, void XpValidatePagePool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr); const XpValidatePoolsRec* vpr);
void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
const XpOidList* valid_trays,
const XpOidList* valid_sizes);
#endif /* _XP_PRINT_SERVER_ */
#endif /* _Xp_AttrValid_h - don't add anything after this line */ #endif /* _Xp_AttrValid_h - don't add anything after this line */

View File

@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
/* /*
* The XpDiListEntry struct is the type of each element of the array * The XpDiListEntry struct is the type of each element of the array
* handed back to the extension code to handle a GetPrinterList request. * handed back to the extension code to handle a GetPrinterList request.
@ -38,6 +40,11 @@ copyright holders.
* request will allow us to build it with the description in the locale of * request will allow us to build it with the description in the locale of
* the requesting client. * the requesting client.
*/ */
#ifndef _XpDiPrint_H_
#define _XpDiPrint_H_ 1
#include "scrnintstr.h"
typedef struct _diListEntry { typedef struct _diListEntry {
char *name; char *name;
char *description; char *description;
@ -52,3 +59,17 @@ extern XpDiListEntry **XpDiGetPrinterList(
char *name, char *name,
int localeLen, int localeLen,
char *locale); char *locale);
extern char * XpDiGetDriverName(int index, char *printerName);
extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen);
extern int XprintOptions(int argc, char **argv, int i);
extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv);
extern void _XpVoidNoop(void);
extern Bool _XpBoolNoop(void);
#endif /* _XpDiPrint_H_ */

View File

@ -50,6 +50,7 @@ copyright holders.
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.13 2001/12/21 21:02:04 dawes Exp $ */
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -74,53 +75,23 @@ copyright holders.
#include "cursor.h" #include "cursor.h"
#include "misc.h" #include "misc.h"
#include "windowstr.h" #include "windowstr.h"
#include "scrnintstr.h"
#include "inputstr.h" #include "inputstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "fonts/fontstruct.h" #include "fonts/fontstruct.h"
#include "errno.h" #include "errno.h"
#define _XP_PRINT_SERVER_
#include "Printstr.h"
#undef _XP_PRINT_SERVER_
typedef char *XPointer; typedef char *XPointer;
#define HAVE_XPointer 1
#define Status int #define Status int
#include <Xresource.h> #include <Xresource.h>
#include "DiPrint.h" #include "DiPrint.h"
#include "AttrValid.h"
#include "attributes.h" #include "attributes.h"
extern char *display; /* display number as a string */
#if 0
/* extern char *Xalloc(); */
extern void Xfree();
/* extern char *Xrealloc(); */
#else
#include "os.h" #include "os.h"
#endif
extern char *getenv();
extern void XpAddPrinterAttribute();
extern char *XpGetConfigDir();
extern XpContextPtr XpContextOfClient();
/*
extern int GiveUp();
*/
extern WindowPtr *WindowTable; /* declared in dix:globals.c */
#if NeedFunctionPrototypes
static void GetDriverFromPrinterName(
char *printerName,
char **driverName,
Bool (**initScreenFunc)());
static void GenericScreenInit( static void GenericScreenInit(
int index, int index,
ScreenPtr pScreen, ScreenPtr pScreen,
@ -132,15 +103,6 @@ static Bool InitPrintDrivers(
int argc, int argc,
char **argv); char **argv);
#else
static void GetDriverFromPrinterName();
static void GenericScreenInit();
static Bool InitPrintDrivers();
#endif
/* /*
* The following two defines are used to build the name "X*printers", where * The following two defines are used to build the name "X*printers", where
* the "*" is replaced by the display number. This is used to construct * the "*" is replaced by the display number. This is used to construct
@ -188,7 +150,7 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
" print substr($5, 1, x-1)" " print substr($5, 1, x-1)"
" }' | sort"; " }' | sort";
#else #else
#if defined(CSRG_BASED) || defined(linux) #if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | " const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
"sed -e /:/s/// | sort"; "sed -e /:/s/// | sort";
#else #else
@ -209,12 +171,11 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
static static
PixmapFormatRec RasterPixmapFormats[] = { PixmapFormatRec RasterPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD { 1, 1, BITMAP_SCANLINE_PAD }
}; };
#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0]) #define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
extern Bool InitializeRasterDriver(); #include "raster/Raster.h"
extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
#endif #endif
@ -222,51 +183,45 @@ extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
static static
PixmapFormatRec ColorPclPixmapFormats[] = { PixmapFormatRec ColorPclPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD, { 1, 1, BITMAP_SCANLINE_PAD },
8, 8, BITMAP_SCANLINE_PAD, { 8, 8, BITMAP_SCANLINE_PAD },
24,32, BITMAP_SCANLINE_PAD { 24,32, BITMAP_SCANLINE_PAD }
}; };
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0]) #define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
extern Bool InitializeColorPclDriver();
extern XpValidatePoolsRec PclValidatePoolsRec;
#endif #endif
#ifdef XPMONOPCLDDX #ifdef XPMONOPCLDDX
static static
PixmapFormatRec MonoPclPixmapFormats[] = { PixmapFormatRec MonoPclPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD { 1, 1, BITMAP_SCANLINE_PAD }
}; };
#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0]) #define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
extern Bool InitializeMonoPclDriver(); #endif
extern XpValidatePoolsRec PclValidatePoolsRec;
#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
#include "pcl/Pcl.h"
#endif #endif
#ifdef XPPSDDX #ifdef XPPSDDX
static static
PixmapFormatRec PSPixmapFormats[] = { PixmapFormatRec PSPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD, { 1, 1, BITMAP_SCANLINE_PAD },
8, 8, BITMAP_SCANLINE_PAD, { 8, 8, BITMAP_SCANLINE_PAD },
24,32, BITMAP_SCANLINE_PAD { 24,32, BITMAP_SCANLINE_PAD }
}; };
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0]) #define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
extern Bool InitializePsDriver(); #include "ps/Ps.h"
extern XpValidatePoolsRec PsValidatePoolsRec;
#endif #endif
typedef Bool (*pBFunc)();
typedef void (*pVFunc)();
/* /*
* The driverInitArray contains an entry for each driver the * The driverInitArray contains an entry for each driver the
* server knows about. Each element contains pointers to pixmap formats, the * server knows about. Each element contains pointers to pixmap formats, the
@ -375,10 +330,6 @@ static const char configFilePath[] =
static const char printServerConfigDir[] = "XPSERVERCONFIGDIR"; static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
static int printScreenPrivIndex,
printWindowPrivIndex,
printGCPrivIndex;
static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL; static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE; static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL; static char *origFontPath = (char *)NULL;
@ -389,12 +340,11 @@ static char *origFontPath = (char *)NULL;
* of the next option to process. * of the next option to process.
*/ */
int int
XprintOptions(argc, argv, i) XprintOptions(
int argc; int argc,
char **argv; char **argv,
int i; int i)
{ {
extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0) if(strcmp(argv[i], "-XpFile") == 0)
{ {
if ((i + 1) >= argc) { if ((i + 1) >= argc) {
@ -427,9 +377,7 @@ static pIFunc
GetInitFunc(driverName) GetInitFunc(driverName)
*/ */
static Bool (* static pBFunc GetInitFunc(char *driverName)
GetInitFunc(driverName))()
char *driverName;
{ {
driverInitRec *pInitRec; driverInitRec *pInitRec;
int numDrivers = sizeof(driverInits)/sizeof(driverInitRec); int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
@ -441,7 +389,7 @@ GetInitFunc(driverName))()
return pInitRec->initFunc; return pInitRec->initFunc;
} }
return (Bool(*)())NULL; return 0;
} }
static void static void
@ -464,17 +412,17 @@ GetDimFuncAndRec(
} }
} }
*dimensionsFunc = (pVFunc)NULL; *dimensionsFunc = 0;
*pValRec = (XpValidatePoolsRec *)NULL; *pValRec = 0;
return; return;
} }
static void static void
FreePrinterDb() FreePrinterDb(void)
{ {
PrinterDbPtr pCurEntry, pNextEntry; PrinterDbPtr pCurEntry, pNextEntry;
for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL; for(pCurEntry = printerDb, pNextEntry = 0;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry) pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{ {
pNextEntry = pCurEntry->next; pNextEntry = pCurEntry->next;
@ -486,7 +434,7 @@ FreePrinterDb()
*/ */
xfree(pCurEntry); xfree(pCurEntry);
} }
printerDb = (PrinterDbPtr)NULL; printerDb = 0;
} }
/* /*
@ -496,8 +444,7 @@ FreePrinterDb()
* XXX AddPrinterDbName needs to check for (and not add) duplicate names. * XXX AddPrinterDbName needs to check for (and not add) duplicate names.
*/ */
static Bool static Bool
AddPrinterDbName(name) AddPrinterDbName(char *name)
char *name;
{ {
PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry)); PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
@ -519,8 +466,7 @@ AddPrinterDbName(name)
} }
static void static void
AugmentPrinterDb(command) AugmentPrinterDb(const char *command)
char *command;
{ {
FILE *fp; FILE *fp;
char name[256]; char name[256];
@ -539,7 +485,7 @@ AugmentPrinterDb(command)
* FreeNameMap frees all remaining memory associated with the nameMap. * FreeNameMap frees all remaining memory associated with the nameMap.
*/ */
static void static void
FreeNameMap() FreeNameMap(void)
{ {
NameMapPtr pEntry, pTmp; NameMapPtr pEntry, pTmp;
@ -561,9 +507,7 @@ FreeNameMap()
* AddNameMap adds an element to the nameMap linked list. * AddNameMap adds an element to the nameMap linked list.
*/ */
static Bool static Bool
AddNameMap(name, qualifier) AddNameMap(char *name, char *qualifier)
char *name;
char *qualifier;
{ {
NameMapPtr pEntry; NameMapPtr pEntry;
@ -585,7 +529,7 @@ AddNameMap(name, qualifier)
* is NULLed out. * is NULLed out.
*/ */
static void static void
MergeNameMap() MergeNameMap(void)
{ {
NameMapPtr pMap; NameMapPtr pMap;
PrinterDbPtr pDb; PrinterDbPtr pDb;
@ -608,7 +552,7 @@ MergeNameMap()
* each printer in the printerDb. * each printer in the printerDb.
*/ */
static void static void
CreatePrinterAttrs() CreatePrinterAttrs(void)
{ {
PrinterDbPtr pDb; PrinterDbPtr pDb;
@ -642,7 +586,7 @@ CreatePrinterAttrs()
* the screens. * the screens.
*/ */
static void static void
StoreDriverNames() StoreDriverNames(void)
{ {
PrinterDbPtr pEntry; PrinterDbPtr pEntry;
@ -653,7 +597,7 @@ StoreDriverNames()
"xp-ddx-identifier"); "xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL || if(pEntry->driverName == (char *)NULL ||
strlen(pEntry->driverName) == 0 || strlen(pEntry->driverName) == 0 ||
GetInitFunc(pEntry->driverName) == (Bool(*)())NULL) GetInitFunc(pEntry->driverName) == 0)
{ {
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) { if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
ErrorF("Xp Extension: Can't load driver %s\n", ErrorF("Xp Extension: Can't load driver %s\n",
@ -670,7 +614,7 @@ StoreDriverNames()
} }
} }
char * static char *
MbStrchr( MbStrchr(
char *str, char *str,
int ch) int ch)
@ -699,7 +643,7 @@ MbStrchr(
* string must be freed by the caller. * string must be freed by the caller.
*/ */
static char * static char *
GetConfigFileName() GetConfigFileName(void)
{ {
/* /*
* We need to find the system-wide file, if one exists. This * We need to find the system-wide file, if one exists. This
@ -711,7 +655,7 @@ GetConfigFileName()
/* /*
* Check for a LANG-specific file. * Check for a LANG-specific file.
*/ */
if(dirName = XpGetConfigDir(TRUE)) if ((dirName = XpGetConfigDir(TRUE)) != 0)
{ {
filePath = (char *)xalloc(strlen(dirName) + filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2); strlen(XPRINTERSFILENAME) + 2);
@ -730,7 +674,7 @@ GetConfigFileName()
xfree(filePath); xfree(filePath);
} }
if(dirName = XpGetConfigDir(FALSE)) if ((dirName = XpGetConfigDir(FALSE)) != 0)
{ {
filePath = (char *)xalloc(strlen(dirName) + filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2); strlen(XPRINTERSFILENAME) + 2);
@ -760,9 +704,8 @@ GetConfigFileName()
* XXX * XXX
*/ */
static PrinterDbPtr static PrinterDbPtr
BuildPrinterDb() BuildPrinterDb(void)
{ {
char *printerList, *augmentCmd = (char *)NULL;
Bool defaultAugment = TRUE, freeConfigFileName; Bool defaultAugment = TRUE, freeConfigFileName;
if(configFileName && access(configFileName, R_OK) != 0) if(configFileName && access(configFileName, R_OK) != 0)
@ -789,7 +732,7 @@ BuildPrinterDb()
{ {
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL) while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
{ {
if(ptr = MbStrchr(tok, '\012')) if ((ptr = MbStrchr(tok, '\012')) != 0)
*ptr = (char)'\0'; *ptr = (char)'\0';
AddPrinterDbName(tok); AddPrinterDbName(tok);
} }
@ -855,8 +798,7 @@ BuildPrinterDb()
} }
static void static void
FreeDriverMap(driverMap) FreeDriverMap(DriverMapPtr driverMap)
DriverMapPtr driverMap;
{ {
DriverMapPtr pCurEntry, pNextEntry; DriverMapPtr pCurEntry, pNextEntry;
@ -882,7 +824,7 @@ FreeDriverMap(driverMap)
* the next rehash or server recycle. * the next rehash or server recycle.
*/ */
int int
XpRehashPrinterList() XpRehashPrinterList(void)
{ {
PrinterDbPtr pEntry, pPrev; PrinterDbPtr pEntry, pPrev;
DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt; DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
@ -1014,7 +956,7 @@ FindFontDir(
return (char *)NULL; return (char *)NULL;
configDir = XpGetConfigDir(TRUE); configDir = XpGetConfigDir(TRUE);
if(fontDir = ValidateFontDir(configDir, modelName)) if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
{ {
xfree(configDir); xfree(configDir);
return fontDir; return fontDir;
@ -1074,10 +1016,10 @@ AddToFontPath(
* and to properly free the modified version upon server recycle. * and to properly free the modified version upon server recycle.
*/ */
static void static void
AugmentFontPath() AugmentFontPath(void)
{ {
char *newPath, *modelID, **allIDs = (char **)NULL; char *modelID, **allIDs = (char **)NULL;
PrinterDbPtr pDb, pDbEntry; PrinterDbPtr pDbEntry;
int numModels, i; int numModels, i;
if(!origFontPath) if(!origFontPath)
@ -1135,7 +1077,7 @@ AugmentFontPath()
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++) for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
{ {
char *fontDir; char *fontDir;
if(fontDir = FindFontDir(allIDs[i])) if ((fontDir = FindFontDir(allIDs[i])) != 0)
{ {
AddToFontPath(fontDir); AddToFontPath(fontDir);
xfree(fontDir); xfree(fontDir);
@ -1225,7 +1167,7 @@ XpClientIsPrintClient(
* fpe->name. * fpe->name.
*/ */
if(fpe->name_length < PATH_PREFIX_LEN || if(fpe->name_length < PATH_PREFIX_LEN ||
(strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) || (strlen(fontDir) != (unsigned)(fpe->name_length - PATH_PREFIX_LEN)) ||
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN, strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
fpe->name_length - PATH_PREFIX_LEN)) fpe->name_length - PATH_PREFIX_LEN))
{ {
@ -1237,9 +1179,7 @@ XpClientIsPrintClient(
} }
static void static void
AddFormats(pScreenInfo, driverName) AddFormats(ScreenInfo *pScreenInfo, char *driverName)
ScreenInfo *pScreenInfo;
char *driverName;
{ {
int i, j; int i, j;
driverInitRec *pInitRec; driverInitRec *pInitRec;
@ -1290,10 +1230,10 @@ AddFormats(pScreenInfo, driverName)
************************************************************/ ************************************************************/
void void
PrinterInitOutput(pScreenInfo, argc, argv) PrinterInitOutput(
ScreenInfo *pScreenInfo; ScreenInfo *pScreenInfo,
int argc; int argc,
char **argv; char **argv)
{ {
PrinterDbPtr pDb, pDbEntry; PrinterDbPtr pDb, pDbEntry;
int driverCount = 0, i; int driverCount = 0, i;
@ -1454,11 +1394,11 @@ PrinterInitOutput(pScreenInfo, argc, argv)
* screen. * screen.
*/ */
static Bool static Bool
InitPrintDrivers(index, pScreen, argc, argv) InitPrintDrivers(
int index; int index,
ScreenPtr pScreen; ScreenPtr pScreen,
int argc; int argc,
char **argv; char **argv)
{ {
PrinterDbPtr pDb, pDb2; PrinterDbPtr pDb, pDb2;
@ -1479,7 +1419,7 @@ InitPrintDrivers(index, pScreen, argc, argv)
} }
if(callInit == TRUE) if(callInit == TRUE)
{ {
Bool (*initFunc)(); pBFunc initFunc;
initFunc = GetInitFunc(pDb->driverName); initFunc = GetInitFunc(pDb->driverName);
if(initFunc(index, pScreen, argc, argv) == FALSE) if(initFunc(index, pScreen, argc, argv) == FALSE)
{ {
@ -1492,13 +1432,13 @@ InitPrintDrivers(index, pScreen, argc, argv)
} }
void void
_XpVoidNoop() _XpVoidNoop(void)
{ {
return; return;
} }
Bool Bool
_XpBoolNoop() _XpBoolNoop(void)
{ {
return TRUE; return TRUE;
} }
@ -1510,16 +1450,15 @@ _XpBoolNoop()
*/ */
static void static void
GenericScreenInit( index, pScreen, argc, argv ) GenericScreenInit(
int index; int index,
ScreenPtr pScreen; ScreenPtr pScreen,
int argc; int argc,
char **argv; char **argv)
{ {
int i;
float fWidth, fHeight, maxWidth, maxHeight; float fWidth, fHeight, maxWidth, maxHeight;
unsigned short width, height; unsigned short width, height;
PrinterDbPtr pDb, pDb2; PrinterDbPtr pDb;
int res, maxRes; int res, maxRes;
/* /*
@ -1543,7 +1482,6 @@ GenericScreenInit( index, pScreen, argc, argv )
{ {
if(pDb->screenNum == index) if(pDb->screenNum == index)
{ {
XpValidatePoolsRec *pValRec; XpValidatePoolsRec *pValRec;
pVFunc dimensionsFunc; pVFunc dimensionsFunc;
@ -1582,9 +1520,9 @@ GenericScreenInit( index, pScreen, argc, argv )
* freeing the associated memory. * freeing the associated memory.
*/ */
static char * static char *
QualifyName(fileName, searchPath) QualifyName(
char *fileName; char *fileName,
char *searchPath; char *searchPath)
{ {
char * curPath = searchPath; char * curPath = searchPath;
char * nextPath; char * nextPath;
@ -1632,11 +1570,11 @@ QualifyName(fileName, searchPath)
* XXX "localeName" elements of the XpDiListEntry to the specified locale. * XXX "localeName" elements of the XpDiListEntry to the specified locale.
*/ */
static void static void
FillPrinterListEntry(pEntry, pDb, localeLen, locale) FillPrinterListEntry(
XpDiListEntry *pEntry; XpDiListEntry *pEntry,
PrinterDbPtr pDb; PrinterDbPtr pDb,
int localeLen; int localeLen,
char *locale; char *locale)
{ {
static char *localeStr = (char *)NULL; static char *localeStr = (char *)NULL;
@ -1659,18 +1597,19 @@ FillPrinterListEntry(pEntry, pDb, localeLen, locale)
* *
*/ */
static Bool static Bool
GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale) GetPrinterListInfo(
XpDiListEntry *pEntry; XpDiListEntry *pEntry,
int nameLen; int nameLen,
char *name; char *name,
int localeLen; int localeLen,
char *locale; char *locale)
{ {
PrinterDbPtr pDb, pDb2; PrinterDbPtr pDb;
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
{ {
if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen)) if (strlen(pDb->name) == (unsigned)nameLen
&& !strncmp(pDb->name, name, nameLen))
{ {
FillPrinterListEntry(pEntry, pDb, localeLen, locale); FillPrinterListEntry(pEntry, pDb, localeLen, locale);
return TRUE; return TRUE;
@ -1684,8 +1623,7 @@ GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
* for a printer list. * for a printer list.
*/ */
void void
XpDiFreePrinterList(list) XpDiFreePrinterList(XpDiListEntry **list)
XpDiListEntry **list;
{ {
int i; int i;
@ -1705,18 +1643,18 @@ XpDiFreePrinterList(list)
* the information for all printers is desired. * the information for all printers is desired.
*/ */
XpDiListEntry ** XpDiListEntry **
XpDiGetPrinterList(nameLen, name, localeLen, locale) XpDiGetPrinterList(
int nameLen; int nameLen,
char *name; char *name,
int localeLen; int localeLen,
char *locale; char *locale)
{ {
XpDiListEntry **pList; XpDiListEntry **pList;
if(!nameLen || name == (char *)NULL) if(!nameLen || name == (char *)NULL)
{ {
int i; int i;
PrinterDbPtr pDb, pDb2; PrinterDbPtr pDb;
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL; for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
pDb = pDb->next, i++) pDb = pDb->next, i++)
@ -1763,17 +1701,14 @@ XpDiGetPrinterList(nameLen, name, localeLen, locale)
} }
WindowPtr WindowPtr
XpDiValidatePrinter(printerName, printerNameLen) XpDiValidatePrinter(char *printerName, int printerNameLen)
char *printerName;
int printerNameLen;
{ {
PrinterDbPtr pCurEntry; PrinterDbPtr pCurEntry;
WindowPtr pWin;
for(pCurEntry = printerDb; for(pCurEntry = printerDb;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next) pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
{ {
if(strlen(pCurEntry->name) == printerNameLen && if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
!strncmp(pCurEntry->name, printerName, printerNameLen)) !strncmp(pCurEntry->name, printerName, printerNameLen))
return WindowTable[pCurEntry->screenNum]; return WindowTable[pCurEntry->screenNum];
} }
@ -1786,9 +1721,7 @@ XpDiValidatePrinter(printerName, printerNameLen)
* on the specified screen. * on the specified screen.
*/ */
char * char *
XpDiGetDriverName(index, printerName) XpDiGetDriverName(int index, char *printerName)
int index;
char *printerName;
{ {
PrinterDbPtr pCurEntry; PrinterDbPtr pCurEntry;

View File

@ -30,11 +30,9 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
#include <stdio.h> /* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5 2001/10/28 03:32:53 tsi Exp $ */
#include <stdlib.h>
#include <ctype.h> #include "attributes.h"
#include "Oid.h"
#include <X11/Xfuncs.h> /* for memmove */
/* /*
* XpOidNotify value strings * XpOidNotify value strings
@ -753,7 +751,7 @@ XpOidLinkedListFirstOid(XpOidLinkedList* me)
XpOid XpOid
XpOidLinkedListNextOid(XpOidLinkedList* me) XpOidLinkedListNextOid(XpOidLinkedList* me)
{ {
if(me->current ? me->current = me->current->next : xFalse) if(me->current ? (me->current = me->current->next) != 0 : xFalse)
return me->current->oid; return me->current->oid;
else else
return xpoid_none; return xpoid_none;
@ -1654,8 +1652,6 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
const XpOidMediumSS* msss) const XpOidMediumSS* msss)
{ {
int i_mss, i_ds, i_itm; int i_mss, i_ds, i_itm;
XpOidMediumDiscreteSizeList* ds_list;
int tray_count;
XpOid current_tray, current_medium; XpOid current_tray, current_medium;
XpOidMediumDiscreteSizeList* unspecified_tray_ds; XpOidMediumDiscreteSizeList* unspecified_tray_ds;
XpOidMediumDiscreteSizeList* tray_ds; XpOidMediumDiscreteSizeList* tray_ds;
@ -1715,6 +1711,7 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
* list * list
*/ */
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL) if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL) if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{ {
/* /*
@ -1725,7 +1722,10 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
continue; continue;
} }
else else
{
tray_ds = unspecified_tray_ds; tray_ds = unspecified_tray_ds;
}
}
/* /*
* loop through the discrete sizes list, looking for a size that * loop through the discrete sizes list, looking for a size that
* matches the medium for the current input tray * matches the medium for the current input tray
@ -2107,15 +2107,13 @@ const char* XpOidNotifyString(XpOidNotify notify)
{ {
switch(notify) switch(notify)
{ {
default:
case XPOID_NOTIFY_UNSUPPORTED: case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL; return (const char*)NULL;
break;
case XPOID_NOTIFY_NONE: case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR; return NOTIFY_NONE_STR;
break;
case XPOID_NOTIFY_EMAIL: case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR; return NOTIFY_EMAIL_STR;
break;
} }
} }
@ -2240,7 +2238,7 @@ XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
const char* first_nonws_ptr; const char* first_nonws_ptr;
const char* format; const char* format;
const char* variant; const char* variant;
const char* version; const char* version = 0;
int format_len; int format_len;
int variant_len; int variant_len;
int version_len; int version_len;
@ -2553,10 +2551,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* variants must both be NULL or match * variants must both be NULL or match
*/ */
if(fmt->variant == (char*)NULL) if(fmt->variant == (char*)NULL)
{
if(list->list[i].variant == (char*)NULL) if(list->list[i].variant == (char*)NULL)
return xTrue; return xTrue;
else else
continue; continue;
}
if(list->list[i].variant == (char*)NULL) if(list->list[i].variant == (char*)NULL)
continue; continue;
if(strcmp(fmt->variant, list->list[i].variant) != 0) if(strcmp(fmt->variant, list->list[i].variant) != 0)
@ -2565,10 +2565,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* versions must both be NULL or match * versions must both be NULL or match
*/ */
if(fmt->version == (char*)NULL) if(fmt->version == (char*)NULL)
{
if(list->list[i].version == (char*)NULL) if(list->list[i].version == (char*)NULL)
return xTrue; return xTrue;
else else
continue; continue;
}
if(list->list[i].version == (char*)NULL) if(list->list[i].version == (char*)NULL)
continue; continue;
if(strcmp(fmt->version, list->list[i].version) == 0) if(strcmp(fmt->version, list->list[i].version) == 0)

View File

@ -30,6 +30,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
#ifndef _Xp_Oid_h #ifndef _Xp_Oid_h
#define _Xp_Oid_h #define _Xp_Oid_h
@ -205,7 +206,7 @@ char* XpOidListString(const XpOidList*);
/* /*
* XpOidLinkedList public methods * XpOidLinkedList public methods
*/ */
XpOidLinkedList* XpOidLinkedListNew(); XpOidLinkedList* XpOidLinkedListNew(void);
void XpOidLinkedListDelete(XpOidLinkedList*); void XpOidLinkedListDelete(XpOidLinkedList*);
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0) #define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i); XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);

View File

@ -30,136 +30,140 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* This is an automatically-generated file. Do not edit. */ /* $XFree86: xc/programs/Xserver/Xprint/OidStrs.h,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
static int XpOidStringMapCount = 127; static int XpOidStringMapCount = 127;
#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
static const XpOidStringMapEntry XpOidStringMap[] = { static const XpOidStringMapEntry XpOidStringMap[] = {
{ "", 0 }, OIDATA(""),
{ "", 0 }, OIDATA(""),
{ "descriptor", 10 }, OIDATA("descriptor"),
{ "content-orientation", 19 }, OIDATA("content-orientation"),
{ "copy-count", 10 }, OIDATA("copy-count"),
{ "default-printer-resolution", 26 }, OIDATA("default-printer-resolution"),
{ "default-input-tray", 18 }, OIDATA("default-input-tray"),
{ "default-medium", 14 }, OIDATA("default-medium"),
{ "document-format", 15 }, OIDATA("document-format"),
{ "plex", 4 }, OIDATA("plex"),
{ "xp-listfonts-modes", 18 }, OIDATA("xp-listfonts-modes"),
{ "job-name", 8 }, OIDATA("job-name"),
{ "job-owner", 9 }, OIDATA("job-owner"),
{ "notification-profile", 20 }, OIDATA("notification-profile"),
{ "xp-setup-state", 14 }, OIDATA("xp-setup-state"),
{ "xp-spooler-command-options", 26 }, OIDATA("xp-spooler-command-options"),
{ "content-orientations-supported", 30 }, OIDATA("content-orientations-supported"),
{ "document-formats-supported", 26 }, OIDATA("document-formats-supported"),
{ "dt-pdm-command", 14 }, OIDATA("dt-pdm-command"),
{ "input-trays-medium", 18 }, OIDATA("input-trays-medium"),
{ "medium-source-sizes-supported", 29 }, OIDATA("medium-source-sizes-supported"),
{ "plexes-supported", 16 }, OIDATA("plexes-supported"),
{ "printer-model", 13 }, OIDATA("printer-model"),
{ "printer-name", 12 }, OIDATA("printer-name"),
{ "printer-resolutions-supported", 29 }, OIDATA("printer-resolutions-supported"),
{ "xp-embedded-formats-supported", 29 }, OIDATA("xp-embedded-formats-supported"),
{ "xp-listfonts-modes-supported", 28 }, OIDATA("xp-listfonts-modes-supported"),
{ "xp-page-attributes-supported", 28 }, OIDATA("xp-page-attributes-supported"),
{ "xp-raw-formats-supported", 24 }, OIDATA("xp-raw-formats-supported"),
{ "xp-setup-proviso", 16 }, OIDATA("xp-setup-proviso"),
{ "document-attributes-supported", 29 }, OIDATA("document-attributes-supported"),
{ "job-attributes-supported", 24 }, OIDATA("job-attributes-supported"),
{ "locale", 6 }, OIDATA("locale"),
{ "multiple-documents-supported", 28 }, OIDATA("multiple-documents-supported"),
{ "available-compression", 21 }, OIDATA("available-compression"),
{ "available-compressions-supported", 32 }, OIDATA("available-compressions-supported"),
{ "portrait", 8 }, OIDATA("portrait"),
{ "landscape", 9 }, OIDATA("landscape"),
{ "reverse-portrait", 16 }, OIDATA("reverse-portrait"),
{ "reverse-landscape", 17 }, OIDATA("reverse-landscape"),
{ "iso-a0", 6 }, OIDATA("iso-a0"),
{ "iso-a1", 6 }, OIDATA("iso-a1"),
{ "iso-a2", 6 }, OIDATA("iso-a2"),
{ "iso-a3", 6 }, OIDATA("iso-a3"),
{ "iso-a4", 6 }, OIDATA("iso-a4"),
{ "iso-a5", 6 }, OIDATA("iso-a5"),
{ "iso-a6", 6 }, OIDATA("iso-a6"),
{ "iso-a7", 6 }, OIDATA("iso-a7"),
{ "iso-a8", 6 }, OIDATA("iso-a8"),
{ "iso-a9", 6 }, OIDATA("iso-a9"),
{ "iso-a10", 7 }, OIDATA("iso-a10"),
{ "iso-b0", 6 }, OIDATA("iso-b0"),
{ "iso-b1", 6 }, OIDATA("iso-b1"),
{ "iso-b2", 6 }, OIDATA("iso-b2"),
{ "iso-b3", 6 }, OIDATA("iso-b3"),
{ "iso-b4", 6 }, OIDATA("iso-b4"),
{ "iso-b5", 6 }, OIDATA("iso-b5"),
{ "iso-b6", 6 }, OIDATA("iso-b6"),
{ "iso-b7", 6 }, OIDATA("iso-b7"),
{ "iso-b8", 6 }, OIDATA("iso-b8"),
{ "iso-b9", 6 }, OIDATA("iso-b9"),
{ "iso-b10", 7 }, OIDATA("iso-b10"),
{ "na-letter", 9 }, OIDATA("na-letter"),
{ "na-legal", 8 }, OIDATA("na-legal"),
{ "executive", 9 }, OIDATA("executive"),
{ "folio", 5 }, OIDATA("folio"),
{ "invoice", 7 }, OIDATA("invoice"),
{ "ledger", 6 }, OIDATA("ledger"),
{ "quarto", 6 }, OIDATA("quarto"),
{ "iso-c3", 6 }, OIDATA("iso-c3"),
{ "iso-c4", 6 }, OIDATA("iso-c4"),
{ "iso-c5", 6 }, OIDATA("iso-c5"),
{ "iso-c6", 6 }, OIDATA("iso-c6"),
{ "iso-designated-long", 19 }, OIDATA("iso-designated-long"),
{ "na-10x13-envelope", 17 }, OIDATA("na-10x13-envelope"),
{ "na-9x12-envelope", 16 }, OIDATA("na-9x12-envelope"),
{ "na-number-10-envelope", 21 }, OIDATA("na-number-10-envelope"),
{ "na-7x9-envelope", 15 }, OIDATA("na-7x9-envelope"),
{ "na-9x11-envelope", 16 }, OIDATA("na-9x11-envelope"),
{ "na-10x14-envelope", 17 }, OIDATA("na-10x14-envelope"),
{ "na-number-9-envelope", 20 }, OIDATA("na-number-9-envelope"),
{ "na-6x9-envelope", 15 }, OIDATA("na-6x9-envelope"),
{ "na-10x15-envelope", 17 }, OIDATA("na-10x15-envelope"),
{ "monarch-envelope", 16 }, OIDATA("monarch-envelope"),
{ "a", 1 }, OIDATA("a"),
{ "b", 1 }, OIDATA("b"),
{ "c", 1 }, OIDATA("c"),
{ "d", 1 }, OIDATA("d"),
{ "e", 1 }, OIDATA("e"),
{ "jis-b0", 6 }, OIDATA("jis-b0"),
{ "jis-b1", 6 }, OIDATA("jis-b1"),
{ "jis-b2", 6 }, OIDATA("jis-b2"),
{ "jis-b3", 6 }, OIDATA("jis-b3"),
{ "jis-b4", 6 }, OIDATA("jis-b4"),
{ "jis-b5", 6 }, OIDATA("jis-b5"),
{ "jis-b6", 6 }, OIDATA("jis-b6"),
{ "jis-b7", 6 }, OIDATA("jis-b7"),
{ "jis-b8", 6 }, OIDATA("jis-b8"),
{ "jis-b9", 6 }, OIDATA("jis-b9"),
{ "jis-b10", 7 }, OIDATA("jis-b10"),
{ "simplex", 7 }, OIDATA("simplex"),
{ "duplex", 6 }, OIDATA("duplex"),
{ "tumble", 6 }, OIDATA("tumble"),
{ "top", 3 }, OIDATA("top"),
{ "middle", 6 }, OIDATA("middle"),
{ "bottom", 6 }, OIDATA("bottom"),
{ "envelope", 8 }, OIDATA("envelope"),
{ "manual", 6 }, OIDATA("manual"),
{ "large-capacity", 14 }, OIDATA("large-capacity"),
{ "main", 4 }, OIDATA("main"),
{ "side", 4 }, OIDATA("side"),
{ "event-report-job-completed", 26 }, OIDATA("event-report-job-completed"),
{ "electronic-mail", 15 }, OIDATA("electronic-mail"),
{ "xp-setup-mandatory", 18 }, OIDATA("xp-setup-mandatory"),
{ "xp-setup-optional", 17 }, OIDATA("xp-setup-optional"),
{ "xp-setup-ok", 11 }, OIDATA("xp-setup-ok"),
{ "xp-setup-incomplete", 19 }, OIDATA("xp-setup-incomplete"),
{ "xp-list-glyph-fonts", 19 }, OIDATA("xp-list-glyph-fonts"),
{ "xp-list-internal-printer-fonts", 30 }, OIDATA("xp-list-internal-printer-fonts"),
{ "0", 1 }, OIDATA("0"),
{ "01", 2 }, OIDATA("01"),
{ "02", 2 }, OIDATA("02"),
{ "03", 2 }, OIDATA("03"),
{ "012", 3 }, OIDATA("012"),
{ "013", 3 }, OIDATA("013"),
{ "023", 3 }, OIDATA("023"),
{ "0123", 4 } OIDATA("0123")
}; };
#undef OIDATA

View File

@ -30,18 +30,23 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
#include "Xos.h" /* for unistd.h and string.h */ /* $XFree86: xc/programs/Xserver/Xprint/Util.c,v 1.13 2001/10/31 22:50:28 tsi Exp $ */
/* To get the tempnam() prototype in <stdio.h> */
#if defined(linux) && defined(__STRICT_ANSI__)
#undef __STRICT_ANSI__
#endif
#include <X11/Xos.h> /* for unistd.h and string.h */
#include <stdio.h> #include <stdio.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "dixstruct.h"
#include "scrnintstr.h"
#include "misc.h" #include "misc.h"
#include "dixstruct.h"
#define _XP_PRINT_SERVER_ #include <X11/extensions/Print.h>
#include "extensions/Print.h"
#include "extensions/Printstr.h" #include "attributes.h"
#undef _XP_PRINT_SERVER_
#define IN_FILE_STRING "%(InFile)%" #define IN_FILE_STRING "%(InFile)%"
#define OUT_FILE_STRING "%(OutFile)%" #define OUT_FILE_STRING "%(OutFile)%"
@ -89,10 +94,10 @@ ReplaceAnyString(
* and the caller is responsible for freeing whatever string is returned. * and the caller is responsible for freeing whatever string is returned.
*/ */
char * char *
ReplaceFileString(string, inFileName, outFileName) ReplaceFileString(
char *string; char *string,
char *inFileName; char *inFileName,
char *outFileName; char *outFileName)
{ {
char *pKeyString, char *pKeyString,
*pInFileString = IN_FILE_STRING, *pInFileString = IN_FILE_STRING,
@ -143,9 +148,9 @@ ReplaceFileString(string, inFileName, outFileName)
* we don't delete the job file before the spooler has made a copy. * we don't delete the job file before the spooler has made a copy.
*/ */
void void
ExecCommand(pCommand, argVector) ExecCommand(
char *pCommand; char *pCommand,
char **argVector; char **argVector)
{ {
pid_t childPid; pid_t childPid;
int status; int status;
@ -169,17 +174,19 @@ ExecCommand(pCommand, argVector)
* beginning the transfer. * beginning the transfer.
*/ */
int int
TransferBytes(pSrcFile, pDstFile, numBytes) TransferBytes(
FILE *pSrcFile, FILE *pSrcFile,
*pDstFile; FILE *pDstFile,
int numBytes; int numBytes)
{ {
char buf[10240]; char buf[10240];
int bytesWritten = 0, bytesToXfer; #define BUF_SIZE (sizeof(buf)*sizeof(char))
int bytesWritten = 0;
unsigned bytesToXfer;
for(bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes); for(bytesToXfer = min(BUF_SIZE, (unsigned)numBytes);
bytesToXfer > 0; bytesToXfer > 0;
bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes - bytesWritten)) bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten)))
{ {
if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer) if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
return bytesWritten; return bytesWritten;
@ -195,10 +202,10 @@ TransferBytes(pSrcFile, pDstFile, numBytes)
* pre, no, and post raster files as well as the raster file itself. * pre, no, and post raster files as well as the raster file itself.
*/ */
Bool Bool
CopyContentsAndDelete(ppSrcFile, pSrcFileName, pDstFile) CopyContentsAndDelete(
FILE **ppSrcFile, FILE **ppSrcFile,
*pDstFile; char **pSrcFileName,
char **pSrcFileName; FILE *pDstFile)
{ {
struct stat statBuf; struct stat statBuf;
@ -228,7 +235,8 @@ XpSendDocumentData(
int maxBufSize) int maxBufSize)
{ {
xPrintGetDocumentDataReply *pRep; xPrintGetDocumentDataReply *pRep;
int bytesWritten, bytesToWrite; int bytesWritten;
unsigned bytesToWrite;
int result = Success; int result = Success;
if(client->clientGone) if(client->clientGone)
@ -247,8 +255,7 @@ XpSendDocumentData(
pRep->length = (QUADPAD(bytesToWrite)) >> 2; pRep->length = (QUADPAD(bytesToWrite)) >> 2;
pRep->dataLen = bytesToWrite; pRep->dataLen = bytesToWrite;
if(fread((void *)(pRep + 1), (size_t) 1, bytesToWrite, fp) < if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite)
bytesToWrite)
{ {
result = BadAlloc; /* XXX poor error choice? */ result = BadAlloc; /* XXX poor error choice? */
pRep->statusCode = 2; /* XXX Is this the right value??? */ pRep->statusCode = 2; /* XXX Is this the right value??? */
@ -316,6 +323,7 @@ XpFinishDocData(
return Success; return Success;
} }
#ifndef HAS_MKSTEMP
static static
char *XpDirName(char *fname) char *XpDirName(char *fname)
{ {
@ -334,6 +342,7 @@ char *XpDirName(char *fname)
} }
return fn; return fn;
} }
#endif
Bool Bool
XpOpenTmpFile( XpOpenTmpFile(
@ -341,6 +350,7 @@ XpOpenTmpFile(
char **fname, char **fname,
FILE **stream) FILE **stream)
{ {
#ifndef HAS_MKSTEMP
char *fn = NULL; char *fn = NULL;
/* note that there is a small race condition here... */ /* note that there is a small race condition here... */
@ -348,6 +358,7 @@ XpOpenTmpFile(
!(fn = XpDirName(*fname)) || !(fn = XpDirName(*fname)) ||
access(fn, W_OK) || access(fn, W_OK) ||
!(*stream = fopen(*fname, mode))) !(*stream = fopen(*fname, mode)))
{ {
xfree(fn); xfree(fn);
xfree(*fname); xfree(*fname);
@ -356,5 +367,26 @@ XpOpenTmpFile(
return FALSE; return FALSE;
} }
xfree(fn); xfree(fn);
#else
int fd;
*stream = NULL;
*fname = (char *)xalloc(14);
if (*fname == NULL)
return FALSE;
strcpy(*fname, "/tmp/xpXXXXXX");
fd = mkstemp(*fname);
if (fd < 0) {
xfree(*fname);
*fname = NULL;
return FALSE;
}
*stream = fdopen(fd, mode);
if (stream == NULL) {
xfree(*fname);
*fname = NULL;
return FALSE;
}
#endif
return TRUE; return TRUE;
} }

View File

@ -44,26 +44,30 @@ copyright holders.
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.18 2002/05/31 18:45:53 dawes Exp $ */
#include <Xproto.h> #include <X11/Xproto.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <pwd.h> #include <pwd.h>
#if defined(sun) && defined(SVR4)
#include <wchar.h>
#endif
#include <scrnintstr.h> #include "scrnintstr.h"
#define _XP_PRINT_SERVER_ #include <X11/extensions/Printstr.h>
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include "attributes.h"
#include "Xrm.c" #include "Xrm.c"
static XrmDatabase CopyDb(XrmDatabase inDb); static XrmDatabase CopyDb(XrmDatabase inDb);
extern XrmDatabase XpSpoolerGetServerAttributes(); extern XrmDatabase XpSpoolerGetServerAttributes(void);
static int attrGeneration = 0; static unsigned long attrGeneration = 0;
typedef struct { typedef struct {
XrmDatabase *pDb; XrmDatabase *pDb;
@ -137,8 +141,7 @@ static char NULL_STRING[] = "\0";
* $LANG. It makes no attempt to ensure that the directory actually exists. * $LANG. It makes no attempt to ensure that the directory actually exists.
*/ */
char * char *
XpGetConfigDir(useLocale) XpGetConfigDir(Bool useLocale)
Bool useLocale;
{ {
char *dirName, *langName, *langDir, *configDir; char *dirName, *langName, *langDir, *configDir;
Bool freeLangDir = False; Bool freeLangDir = False;
@ -182,8 +185,7 @@ XpGetConfigDir(useLocale)
* locale (if other than the top-level). * locale (if other than the top-level).
*/ */
static XrmDatabase static XrmDatabase
GetMergedDatabase(attrName) GetMergedDatabase(const char *attrName)
char *attrName;
{ {
char *dirName, *fileName; char *dirName, *fileName;
XrmDatabase db; XrmDatabase db;
@ -220,7 +222,7 @@ GetMergedDatabase(attrName)
* the context. * the context.
*/ */
static void static void
BuildSystemAttributes() BuildSystemAttributes(void)
{ {
if(systemAttributes.printers != (XrmDatabase)NULL) if(systemAttributes.printers != (XrmDatabase)NULL)
XrmDestroyDatabase(systemAttributes.printers); XrmDestroyDatabase(systemAttributes.printers);
@ -243,13 +245,13 @@ BuildSystemAttributes()
* passed as the client_data (aka "closure"). * passed as the client_data (aka "closure").
*/ */
static Bool static Bool
AddDbEntry(sourceDB, bindings, quarks, type, value, client_data) AddDbEntry(
XrmDatabase *sourceDB; XrmDatabase *sourceDB,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation *type; XrmRepresentation *type,
XrmValue *value; XrmValue *value,
XPointer client_data; XPointer client_data)
{ {
DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data; DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
XrmName xrm_name[5]; XrmName xrm_name[5];
@ -293,15 +295,15 @@ AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
* printer. * printer.
*/ */
static XrmDatabase static XrmDatabase
BuildPrinterAttrs(printerName, qualifierName) BuildPrinterAttrs(
char *printerName; char *printerName,
char *qualifierName; char *qualifierName)
{ {
XrmDatabase printerDB = (XrmDatabase)NULL; XrmDatabase printerDB = (XrmDatabase)NULL;
if(systemAttributes.printers != (XrmDatabase)NULL) if(systemAttributes.printers != (XrmDatabase)NULL)
{ {
char *dirName, *fileName; char *fileName;
XrmDatabase modelDB = (XrmDatabase)NULL; XrmDatabase modelDB = (XrmDatabase)NULL;
XrmName xrm_name[5], xrm_class[2]; XrmName xrm_name[5], xrm_class[2];
XrmRepresentation rep_type; XrmRepresentation rep_type;
@ -374,10 +376,10 @@ BuildPrinterAttrs(printerName, qualifierName)
* level doc and job databases. * level doc and job databases.
*/ */
static XrmDatabase static XrmDatabase
BuildABase(printerName, qualifierName, sourceBase) BuildABase(
char *printerName; char *printerName,
char *qualifierName; char *qualifierName,
XrmDatabase sourceBase; XrmDatabase sourceBase)
{ {
XrmDatabase builtDB = (XrmDatabase)NULL; XrmDatabase builtDB = (XrmDatabase)NULL;
@ -425,7 +427,7 @@ BuildABase(printerName, qualifierName, sourceBase)
* databases stored in the global attrList. * databases stored in the global attrList.
*/ */
static void static void
FreeAttrList() FreeAttrList(void)
{ {
PrAttrPtr pAttr, pNext; PrAttrPtr pAttr, pNext;
@ -454,7 +456,7 @@ FreeAttrList()
* by calling XpBuildAttributeStore for a new list of printers. * by calling XpBuildAttributeStore for a new list of printers.
*/ */
int int
XpRehashAttributes() XpRehashAttributes(void)
{ {
if(attrList != (PrAttrPtr)NULL) if(attrList != (PrAttrPtr)NULL)
FreeAttrList(); FreeAttrList();
@ -468,9 +470,9 @@ XpRehashAttributes()
* calls BuildSystemAttributes to create the system-level databases. * calls BuildSystemAttributes to create the system-level databases.
*/ */
void void
XpBuildAttributeStore(printerName, qualifierName) XpBuildAttributeStore(
char *printerName; char *printerName,
char *qualifierName; char *qualifierName)
{ {
PrAttrPtr pAttr; PrAttrPtr pAttr;
@ -510,13 +512,13 @@ XpBuildAttributeStore(printerName, qualifierName)
static Bool static Bool
StoreEntry(sourceDB, bindings, quarks, type, value, client_data) StoreEntry(
XrmDatabase *sourceDB; XrmDatabase *sourceDB,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation *type; XrmRepresentation *type,
XrmValue *value; XrmValue *value,
XPointer client_data; XPointer client_data)
{ {
XrmDatabase *outDb = (XrmDatabase *)client_data; XrmDatabase *outDb = (XrmDatabase *)client_data;
@ -530,8 +532,7 @@ StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
* the copy. * the copy.
*/ */
static XrmDatabase static XrmDatabase
CopyDb(inDb) CopyDb(XrmDatabase inDb)
XrmDatabase inDb;
{ {
XrmDatabase outDb = (XrmDatabase)NULL; XrmDatabase outDb = (XrmDatabase)NULL;
XrmQuark empty = NULLQUARK; XrmQuark empty = NULLQUARK;
@ -547,8 +548,7 @@ CopyDb(inDb)
* attributes databases for the printer associated with the context. * attributes databases for the printer associated with the context.
*/ */
void void
XpInitAttributes( pContext ) XpInitAttributes(XpContextPtr pContext)
XpContextPtr pContext;
{ {
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
PrAttrPtr pPrAttr = attrList; PrAttrPtr pPrAttr = attrList;
@ -569,8 +569,8 @@ XpInitAttributes( pContext )
} }
void void
XpDestroyAttributes( pContext ) XpDestroyAttributes(
XpContextPtr pContext; XpContextPtr pContext)
{ {
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
@ -596,14 +596,13 @@ XpDestroyAttributes( pContext )
* in which case the pContext parameter is ignored. * in which case the pContext parameter is ignored.
*/ */
char * char *
XpGetOneAttribute( pContext, class, attributeName ) XpGetOneAttribute(
XpContextPtr pContext; XpContextPtr pContext,
XPAttributes class; XPAttributes class,
char *attributeName; char *attributeName)
{ {
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL; XrmDatabase db = (XrmDatabase)NULL;
char *retVal;
XrmName xrm_name[3]; XrmName xrm_name[3];
XrmRepresentation rep_type; XrmRepresentation rep_type;
XrmValue value; XrmValue value;
@ -666,12 +665,11 @@ XpGetOneAttribute( pContext, class, attributeName )
* function does not recognize XPServerAttr. * function does not recognize XPServerAttr.
*/ */
void void
XpPutOneAttribute( pContext, class, attributeName, value ) XpPutOneAttribute(
XpContextPtr pContext,
XpContextPtr pContext; XPAttributes class,
XPAttributes class; const char* attributeName,
const char* attributeName; const char* value)
const char* value;
{ {
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
XrmDatabase db; XrmDatabase db;
@ -720,8 +718,8 @@ const char* value;
* struct to indicate the new amount of space available. * struct to indicate the new amount of space available.
*/ */
static Bool static Bool
ExpandSpace(pStr) ExpandSpace(
StringDbStruct *pStr; StringDbStruct *pStr)
{ {
char *newSpace; char *newSpace;
@ -740,9 +738,9 @@ ExpandSpace(pStr)
* are updated. * are updated.
*/ */
static void static void
PutString(pStr, pString) PutString(
StringDbStruct *pStr; StringDbStruct *pStr,
char *pString; char *pString)
{ {
int len = strlen(pString); int len = strlen(pString);
@ -760,9 +758,9 @@ PutString(pStr, pString)
* the byte, and the nextPos and space fields are updated. * the byte, and the nextPos and space fields are updated.
*/ */
static void static void
PutByte(pStr, byte) PutByte(
StringDbStruct *pStr; StringDbStruct *pStr,
char byte; char byte)
{ {
if(pStr->space <= 1) if(pStr->space <= 1)
if(!ExpandSpace(pStr)) if(!ExpandSpace(pStr))
@ -782,13 +780,13 @@ PutByte(pStr, byte)
* This code is based directly on that in "DumpEntry" in Xrm.c. * This code is based directly on that in "DumpEntry" in Xrm.c.
*/ */
static Bool static Bool
AppendEntry(db, bindings, quarks, type, value, data) AppendEntry(
XrmDatabase *db; XrmDatabase *db,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation *type; XrmRepresentation *type,
XrmValuePtr value; XrmValuePtr value,
XPointer data; XPointer data)
{ {
StringDbStruct *pEnumStr = (StringDbStruct *)data; StringDbStruct *pEnumStr = (StringDbStruct *)data;
Bool firstNameSeen; Bool firstNameSeen;
@ -796,7 +794,7 @@ AppendEntry(db, bindings, quarks, type, value, data)
char *s, c; char *s, c;
if (*type != XrmQString) if (*type != XrmQString)
return; return False;
for (firstNameSeen = False; *quarks; bindings++, quarks++) { for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) { if (*bindings == XrmBindLoosely) {
@ -849,13 +847,12 @@ AppendEntry(db, bindings, quarks, type, value, data)
* unlike XpGetOneAttribute, where the caller must not free the string. * unlike XpGetOneAttribute, where the caller must not free the string.
*/ */
char * char *
XpGetAttributes( pContext, class ) XpGetAttributes(
XpContextPtr pContext; XpContextPtr pContext,
XPAttributes class; XPAttributes class)
{ {
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL; XrmDatabase db = (XrmDatabase)NULL;
char *retVal;
StringDbStruct enumStruct; StringDbStruct enumStruct;
XrmQuark empty = NULLQUARK; XrmQuark empty = NULLQUARK;
@ -904,10 +901,10 @@ XpGetAttributes( pContext, class )
} }
int int
XpAugmentAttributes( pContext, class, attributes ) XpAugmentAttributes(
XpContextPtr pContext; XpContextPtr pContext,
XPAttributes class; XPAttributes class,
char *attributes; char *attributes)
{ {
XrmDatabase db; XrmDatabase db;
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
@ -940,10 +937,10 @@ XpAugmentAttributes( pContext, class, attributes )
* XpSetAttributes - sets the attribute stores for a specified context. * XpSetAttributes - sets the attribute stores for a specified context.
*/ */
int int
XpSetAttributes( pContext, class, attributes ) XpSetAttributes(
XpContextPtr pContext; XpContextPtr pContext,
XPAttributes class; XPAttributes class,
char *attributes; char *attributes)
{ {
XrmDatabase db; XrmDatabase db;
ContextAttrPtr pCtxtAttrs; ContextAttrPtr pCtxtAttrs;
@ -981,12 +978,11 @@ XpSetAttributes( pContext, class, attributes )
} }
void void
XpAddPrinterAttribute(printerName, printerQualifier, attributeName, XpAddPrinterAttribute(
attributeValue) char *printerName,
char *printerName; char *printerQualifier,
char *printerQualifier; char *attributeName,
char *attributeName; char *attributeValue)
char *attributeValue;
{ {
PrAttrPtr pAttr; PrAttrPtr pAttr;
@ -1045,7 +1041,7 @@ static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
*multiple-documents-supported: False"; *multiple-documents-supported: False";
XrmDatabase XrmDatabase
XpSpoolerGetServerAttributes() XpSpoolerGetServerAttributes(void)
{ {
char *totalAttrs, *localeName; char *totalAttrs, *localeName;
XrmDatabase db; XrmDatabase db;
@ -1064,34 +1060,6 @@ XpSpoolerGetServerAttributes()
return db; return db;
} }
/*
* ExecuteCommand takes two pointers - the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
* We wait for the command to terminate before continuing to ensure that
* we don't delete the job file before the spooler has made a copy.
*/
static void
ExecCommand(pCommand, argVector)
char *pCommand;
char **argVector;
{
pid_t childPid;
int status;
if((childPid = fork()) == 0)
{
/* return BadAlloc? */
if (execv(pCommand, argVector) == -1) {
FatalError("unable to exec '%s'", pCommand);
}
}
else
{
(void) waitpid(childPid, &status, 0);
}
return;
}
/* /*
* SendFileToCommand takes three character pointers - the file name, * SendFileToCommand takes three character pointers - the file name,
* the command to execute, * the command to execute,
@ -1167,8 +1135,6 @@ SendFileToCommand(
} }
else else
{ {
int res;
(void) close(pipefd[0]); (void) close(pipefd[0]);
outPipe = fdopen(pipefd[1], "w"); outPipe = fdopen(pipefd[1], "w");
@ -1188,7 +1154,6 @@ SendFileToCommand(
* store for the supplied print context. The ReplaceAnyString utility * store for the supplied print context. The ReplaceAnyString utility
* routine is used to perform the actual replacements. * routine is used to perform the actual replacements.
*/ */
extern char *ReplaceAnyString(char *, char *, char *);
static char * static char *
ReplaceAllKeywords( ReplaceAllKeywords(
@ -1233,7 +1198,20 @@ ReplaceAllKeywords(
return command; return command;
} }
#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL)) #ifdef __QNX__
#define toascii( c ) ((unsigned)(c) & 0x007f)
#endif
#if defined(CSRG_BASED) || \
defined(linux) || \
defined(__CYGWIN__) || \
(defined(sun) && !defined(SVR4)) || \
(defined(SVR4) && !defined(sun) && !defined(USL)) || \
defined(__UNIXOS2__) || \
defined(ISC) || \
defined(Lynx) || \
defined(__QNX__) || \
defined(__DARWIN__)
#define iswspace(c) (isascii(c) && isspace(toascii(c))) #define iswspace(c) (isascii(c) && isspace(toascii(c)))
#endif #endif
@ -1387,8 +1365,8 @@ VectorizeCommand(
char ***pVector, char ***pVector,
XpContextPtr pContext) XpContextPtr pContext)
{ {
char *cmdName, *curTok; char *cmdName;
int i, numChars; int numChars;
if(command == (char *)NULL) if(command == (char *)NULL)
return (char *)NULL; return (char *)NULL;
@ -1410,11 +1388,11 @@ static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-co
#endif #endif
int int
XpSubmitJob(fileName, pContext) XpSubmitJob(
char *fileName; char *fileName,
XpContextPtr pContext; XpContextPtr pContext)
{ {
char **vector, *cmdNam, *cmdOpt, *command, *userName; char **vector, *cmdNam, *command, *userName;
int i; int i;
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command"); command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
@ -1452,6 +1430,7 @@ XpSubmitJob(fileName, pContext)
FreeVector(vector); FreeVector(vector);
xfree(cmdNam); xfree(cmdNam);
return Success;
} }
/* /*
@ -1524,7 +1503,6 @@ XpGetTrayMediumFromContext(XpContextPtr pCon,
{ {
char *defMedium, *defTray; char *defMedium, *defTray;
char *t, *m; char *t, *m;
char *pS, *pE, *pLast;
defMedium = XpGetOneAttribute( pCon, XPPageAttr, defMedium = XpGetOneAttribute( pCon, XPPageAttr,
"default-medium" ); "default-medium" );

View File

@ -30,13 +30,32 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/attributes.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
#include "Oid.h" #ifndef _Xp_attributes_h
#define _Xp_attributes_h 1
#include "scrnintstr.h"
#include "AttrValid.h"
#define BFuncArgs int ndx, ScreenPtr pScreen, int argc, char **argv
typedef Bool (*pBFunc)(BFuncArgs);
#define VFuncArgs char *name, XpValidatePoolsRec *pValRec, float *width, float *height, int *res
typedef void (*pVFunc)(VFuncArgs);
/* /*
* attributes.c * attributes.c
*/ */
void XpInitAttributes(XpContextPtr pContext); void XpInitAttributes(XpContextPtr pContext);
void XpBuildAttributeStore(char *printerName,
char *qualifierName);
void XpAddPrinterAttribute(char *printerName,
char *printerQualifier,
char *attributeName,
char *attributeValue);
void XpDestroyAttributes(XpContextPtr pContext);
char *XpGetConfigDir(Bool useLocale);
char *XpGetOneAttribute(XpContextPtr pContext, char *XpGetOneAttribute(XpContextPtr pContext,
XPAttributes class, XPAttributes class,
char *attributeName); char *attributeName);
@ -44,6 +63,7 @@ void XpPutOneAttribute(XpContextPtr pContext,
XPAttributes class, XPAttributes class,
const char* attributeName, const char* attributeName,
const char* value); const char* value);
int XpRehashAttributes(void);
char *XpGetAttributes(XpContextPtr pContext, char *XpGetAttributes(XpContextPtr pContext,
XPAttributes class); XPAttributes class);
int XpAugmentAttributes(XpContextPtr pContext, int XpAugmentAttributes(XpContextPtr pContext,
@ -57,6 +77,7 @@ const char *XpGetPrinterAttribute(const char *printerName,
void XpGetTrayMediumFromContext(XpContextPtr pCon, void XpGetTrayMediumFromContext(XpContextPtr pCon,
char **medium, char **medium,
char **tray); char **tray);
int XpSubmitJob(char *fileName, XpContextPtr pContext);
/* /*
* mediaSizes.c * mediaSizes.c
@ -76,3 +97,34 @@ void XpGetMediumDimensions(XpContextPtr pContext,
unsigned short *height); unsigned short *height);
void XpGetReproductionArea(XpContextPtr pContext, void XpGetReproductionArea(XpContextPtr pContext,
xRectangle *pRect); xRectangle *pRect);
void XpGetMaxWidthHeightRes(const char *printer_name,
const XpValidatePoolsRec* vpr,
float *width,
float *height,
int* resolution);
/* Util.c */
char * ReplaceAnyString(char *string,
char *target,
char *replacement);
char * ReplaceFileString(char *string,
char *inFileName,
char *outFileName);
void ExecCommand(char *pCommand,
char **argVector);
int TransferBytes(FILE *pSrcFile,
FILE *pDstFile,
int numBytes);
Bool CopyContentsAndDelete(FILE **ppSrcFile,
char **pSrcFileName,
FILE *pDstFile);
int XpSendDocumentData(ClientPtr client,
FILE *fp,
int fileLen,
int maxBufSize);
int XpFinishDocData(ClientPtr client);
Bool XpOpenTmpFile(char *mode,
char **fname,
FILE **stream);
#endif /* _Xp_attributes_h */

View File

@ -30,19 +30,16 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.14 2001/10/28 03:32:53 tsi Exp $ */
#include "X.h" #include "X.h"
#include "Xproto.h" #include "Xproto.h"
#include "screenint.h"
#include "input.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h" #include "windowstr.h"
#include "servermd.h" #include "servermd.h"
#include "Xos.h" #include "Xos.h"
#include "DiPrint.h"
static void Exit(); static void Exit(int);
void _XpVoidNoop();
/*- /*-
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
@ -72,13 +69,11 @@ void _XpVoidNoop();
*/ */
void void
InitOutput(pScreenInfo, argc, argv) InitOutput(
ScreenInfo *pScreenInfo; ScreenInfo *pScreenInfo,
int argc; int argc,
char **argv; char **argv)
{ {
int i;
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@ -92,17 +87,17 @@ InitOutput(pScreenInfo, argc, argv)
} }
static void static void
BellProc(volume, pDev) BellProc(
int volume; int volume,
DeviceIntPtr pDev; DeviceIntPtr pDev)
{ {
return; return;
} }
static void static void
KeyControlProc(pDev, ctrl) KeyControlProc(
DeviceIntPtr pDev; DeviceIntPtr pDev,
KeybdCtrl *ctrl; KeybdCtrl *ctrl)
{ {
return; return;
} }
@ -111,11 +106,11 @@ static KeySym printKeyMap[256];
static CARD8 printModMap[256]; static CARD8 printModMap[256];
static int static int
KeyboardProc(pKbd, what, argc, argv) KeyboardProc(
DevicePtr pKbd; DevicePtr pKbd,
int what; int what,
int argc; int argc,
char *argv[]; char *argv[])
{ {
KeySymsRec keySyms; KeySymsRec keySyms;
@ -143,11 +138,11 @@ KeyboardProc(pKbd, what, argc, argv)
#include "../mi/mipointer.h" #include "../mi/mipointer.h"
static int static int
PointerProc(pPtr, what, argc, argv) PointerProc(
DevicePtr pPtr; DevicePtr pPtr,
int what; int what,
int argc; int argc,
char *argv[]; char *argv[])
{ {
#define NUM_BUTTONS 1 #define NUM_BUTTONS 1
CARD8 map[NUM_BUTTONS]; CARD8 map[NUM_BUTTONS];
@ -174,11 +169,11 @@ PointerProc(pPtr, what, argc, argv)
} }
void void
InitInput(argc, argv) InitInput(
int argc; int argc,
char **argv; char **argv)
{ {
DevicePtr ptr, kbd; DeviceIntPtr ptr, kbd;
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE); ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE); kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
@ -189,28 +184,42 @@ InitInput(argc, argv)
Bool Bool
LegalModifier(key, dev) LegalModifier(
unsigned int key; unsigned int key,
DevicePtr dev; DevicePtr dev)
{ {
return TRUE; return TRUE;
} }
void void
ProcessInputEvents() ProcessInputEvents(void)
{ {
} }
#ifdef __DARWIN__
void
DarwinHandleGUI(int argc, char *argv[])
{
}
#endif
#ifdef DDXOSINIT #ifdef DDXOSINIT
void void
OsVendorInit() OsVendorInit(void)
{
}
#endif
#ifdef DDXOSFATALERROR
void
OsVendorFatalError(void)
{ {
} }
#endif #endif
#ifdef DDXTIME #ifdef DDXTIME
CARD32 CARD32
GetTimeInMillis() GetTimeInMillis(void)
{ {
struct timeval tp; struct timeval tp;
@ -226,7 +235,7 @@ GetTimeInMillis()
* *
*****************************************/ *****************************************/
void ddxUseMsg() void ddxUseMsg(void)
{ {
/* Right now, let's just do nothing */ /* Right now, let's just do nothing */
} }
@ -237,20 +246,19 @@ static void Exit (code)
exit (code); exit (code);
} }
void AbortDDX () void AbortDDX (void)
{ {
} }
void ddxGiveUp() /* Called by GiveUp() */ void ddxGiveUp(void) /* Called by GiveUp() */
{ {
} }
int int
ddxProcessArgument (argc, argv, i) ddxProcessArgument (
int argc; int argc,
char *argv[]; char *argv[],
int i; int i)
{ {
#ifdef PRINT_ONLY_SERVER #ifdef PRINT_ONLY_SERVER
return XprintOptions(argc, argv, i) - i; return XprintOptions(argc, argv, i) - i;
@ -263,67 +271,76 @@ ddxProcessArgument (argc, argv, i)
#include "XI.h" #include "XI.h"
#include "XIproto.h" #include "XIproto.h"
#include "XIstubs.h"
extern int BadDevice; extern int BadDevice;
ChangePointerDevice (old_dev, new_dev, x, y) int
DeviceIntPtr old_dev; ChangePointerDevice (
DeviceIntPtr new_dev; DeviceIntPtr old_dev,
unsigned char x,y; DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
{ {
return (BadDevice); return (BadDevice);
} }
int int
ChangeDeviceControl (client, dev, control) ChangeDeviceControl (
register ClientPtr client; register ClientPtr client,
DeviceIntPtr dev; DeviceIntPtr dev,
xDeviceCtl *control; xDeviceCtl *control)
{ {
return BadMatch; return BadMatch;
} }
OpenInputDevice (dev, client, status) void
DeviceIntPtr dev; OpenInputDevice (
ClientPtr client; DeviceIntPtr dev,
int *status; ClientPtr client,
int *status)
{ {
return; return;
} }
AddOtherInputDevices () void
AddOtherInputDevices (void)
{ {
return; return;
} }
CloseInputDevice (dev, client) void
DeviceIntPtr dev; CloseInputDevice (
ClientPtr client; DeviceIntPtr dev,
ClientPtr client)
{ {
return; return;
} }
ChangeKeyboardDevice (old_dev, new_dev) int
DeviceIntPtr old_dev; ChangeKeyboardDevice (
DeviceIntPtr new_dev; DeviceIntPtr old_dev,
DeviceIntPtr new_dev)
{ {
return (Success); return (Success);
} }
SetDeviceMode (client, dev, mode) int
register ClientPtr client; SetDeviceMode (
DeviceIntPtr dev; register ClientPtr client,
int mode; DeviceIntPtr dev,
int mode)
{ {
return BadMatch; return BadMatch;
} }
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) int
register ClientPtr client; SetDeviceValuators (
DeviceIntPtr dev; register ClientPtr client,
int *valuators; DeviceIntPtr dev,
int first_valuator; int *valuators,
int num_valuators; int first_valuator,
int num_valuators)
{ {
return BadMatch; return BadMatch;
} }
@ -334,21 +351,19 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
#ifdef XTESTEXT1 #ifdef XTESTEXT1
void void
XTestJumpPointer(x, y, dev) XTestJumpPointer(int x, int y, int dev)
int x, y, dev;
{ {
return; return;
} }
void void
XTestGetPointerPos(x, y) XTestGetPointerPos(int x, int y)
{ {
return; return;
} }
void void
XTestGenerateEvent(dev, keycode, keystate, x, y) XTestGenerateEvent(int dev, int keycode, int keystate, int x, int y)
int dev, keycode, keystate, x, y;
{ {
return; return;
} }

View File

@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/mediaSizes.c,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
/******************************************************************* /*******************************************************************
** **
** ********************************************************* ** *********************************************************
@ -62,14 +64,8 @@ copyright holders.
#include "scrnintstr.h" #include "scrnintstr.h"
#include "fontstruct.h" #include "fontstruct.h"
#define _XP_PRINT_SERVER_
#include "Printstr.h"
#undef _XP_PRINT_SERVER_
#include "DiPrint.h" #include "DiPrint.h"
#include "AttrValid.h" #include "attributes.h"
extern XpContextPtr XpContextOfClient();
typedef struct { typedef struct {
XpOid page_size; XpOid page_size;
@ -149,8 +145,7 @@ static PageDimensionsRec PageDimensions[] =
* attributes pools have been validated. * attributes pools have been validated.
*/ */
int int
XpGetResolution( XpGetResolution(XpContextPtr pContext)
XpContextPtr pContext)
{ {
unsigned long resolution; unsigned long resolution;
@ -190,8 +185,7 @@ XpGetResolution(
* attributes pools have been validated. * attributes pools have been validated.
*/ */
XpOid XpOid
XpGetContentOrientation( XpGetContentOrientation(XpContextPtr pContext)
XpContextPtr pContext)
{ {
XpOid orientation; XpOid orientation;
@ -421,7 +415,7 @@ XpGetMediumMillimeters(
float *width, /* return */ float *width, /* return */
float *height) /* return */ float *height) /* return */
{ {
int i; unsigned i;
*width = *height = 0; *width = *height = 0;
for(i = 0; i < XpNumber(PageDimensions); i++) for(i = 0; i < XpNumber(PageDimensions); i++)
@ -745,9 +739,7 @@ XpGetMaxWidthHeightRes(
} }
FontResolutionPtr FontResolutionPtr
XpGetClientResolutions(client, num) XpGetClientResolutions(ClientPtr client, int *num)
ClientPtr client;
int *num;
{ {
static struct _FontResolution res; static struct _FontResolution res;
int resolution = XpGetResolution(XpContextOfClient(client)); int resolution = XpGetResolution(XpContextOfClient(client));
@ -763,15 +755,13 @@ XpGetClientResolutions(client, num)
} }
void XpSetFontResFunc(client) void XpSetFontResFunc(ClientPtr client)
ClientPtr client;
{ {
client->fontResFunc = XpGetClientResolutions; client->fontResFunc = XpGetClientResolutions;
} }
void XpUnsetFontResFunc(client) void XpUnsetFontResFunc(ClientPtr client)
ClientPtr client;
{ {
client->fontResFunc = NULL; client->fontResFunc = NULL;
} }

View File

@ -11,7 +11,7 @@
** * Created: 1/30/95 ** * Created: 1/30/95
** * ** *
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* /*
(c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 Hewlett-Packard Company
@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.12 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCL_H_ #ifndef _PCL_H_
#define _PCL_H_ #define _PCL_H_
@ -51,25 +52,12 @@ copyright holders.
#include <stdio.h> #include <stdio.h>
#include "scrnintstr.h" #include "scrnintstr.h"
/*
#include "X.h"
#include "Xproto.h"
#include "Xatom.h"
#include "misc.h"
#include "screenint.h"
#include "colormapst.h"
#include "windowstr.h"
#include "propertyst.h"
#include "servermd.h" */ /* needed for IMAGE_BUFSIZE */
#include "PclDef.h" #include "PclDef.h"
#include "Pclmap.h" #include "Pclmap.h"
#include "PclSFonts.h" #include "PclSFonts.h"
#define _XP_PRINT_SERVER_ #include <X11/extensions/Print.h>
#include "Print.h" #include <X11/extensions/Printstr.h>
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include "miscstruct.h" #include "miscstruct.h"
#include "fontstruct.h" #include "fontstruct.h"
@ -79,13 +67,16 @@ copyright holders.
/* /*
* Some sleazes to force the XrmDB stuff into the server * Some sleazes to force the XrmDB stuff into the server
*/ */
#ifndef HAVE_XPointer
typedef char *XPointer; typedef char *XPointer;
#endif
#define Status int #define Status int
#define True 1 #define True 1
#define False 0 #define False 0
#include "misc.h" #include "misc.h"
#include <Xfuncproto.h> #include <X11/Xfuncproto.h>
#include "../Xresource.h" #include <X11/Xresource.h>
#include "attributes.h"
/****** /******
* externally visible variables from PclInit.c * externally visible variables from PclInit.c
@ -95,6 +86,11 @@ extern int PclContextPrivateIndex;
extern int PclPixmapPrivateIndex; extern int PclPixmapPrivateIndex;
extern int PclGCPrivateIndex; extern int PclGCPrivateIndex;
/******
* externally visible variables from PclAttVal.c
******/
extern XpValidatePoolsRec PclValidatePoolsRec;
/* /*
* This structure defines a mapping from an X colormap ID to a list of * This structure defines a mapping from an X colormap ID to a list of
* print contexts which use the colormap. * print contexts which use the colormap.
@ -159,8 +155,6 @@ typedef struct {
} PclWindowPrivRec, *PclWindowPrivPtr; } PclWindowPrivRec, *PclWindowPrivPtr;
typedef struct { typedef struct {
unsigned freeCompClip;
RegionPtr pCompositeClip;
unsigned long stippleFg, stippleBg; unsigned long stippleFg, stippleBg;
} PclGCPrivRec, *PclGCPrivPtr; } PclGCPrivRec, *PclGCPrivPtr;
@ -191,7 +185,9 @@ typedef struct {
#endif /* XP_PCL_LJ3 */ #endif /* XP_PCL_LJ3 */
#define MIN(a,b) (((a)<(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b))
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))
#endif
/****** /******
* Functions in PclArc.c * Functions in PclArc.c
@ -247,18 +243,18 @@ RegionPtr PclCopyPlane(
/****** /******
* Functions in PclAttr.c * Functions in PclAttr.c
******/ ******/
extern char *PclGetAttributes( extern char *PclGetAttributes(
XpContextPtr pCon, XpContextPtr pCon,
XPAttributes pool ); XPAttributes pool );
extern char *PclGetOneAttribute( extern char *PclGetOneAttribute(
XpContextPtr pCon, XpContextPtr pCon,
XPAttributes pool, XPAttributes pool,
char *attr ); char *attr );
extern int PclAugmentAttributes( extern int PclAugmentAttributes(
XpContextPtr pCon, XpContextPtr pCon,
XPAttributes pool, XPAttributes pool,
char *attrs ); char *attrs );
extern int PclSetAttributes( extern int PclSetAttributes(
XpContextPtr pCon, XpContextPtr pCon,
XPAttributes pool, XPAttributes pool,
char *attrs ); char *attrs );
@ -284,6 +280,16 @@ extern int PclUpdateColormap(DrawablePtr pDrawable,
XpContextPtr pCon, XpContextPtr pCon,
GCPtr gc, GCPtr gc,
FILE *outFile); FILE *outFile);
extern void PclLookUp(ColormapPtr cmap,
PclContextPrivPtr cPriv,
unsigned short *r,
unsigned short *g,
unsigned short *b);
extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
ColormapPtr cmap,
GCPtr gc);
extern unsigned char *PclReadMap(char *, int *);
/****** /******
* Functions in PclCursor.c * Functions in PclCursor.c
@ -315,6 +321,27 @@ extern Bool PclSetCursorPosition(
int y, int y,
Bool generateEvent); Bool generateEvent);
/******
* Functions in PclSFonts.c
******/
extern void
PclDownloadSoftFont8(
FILE *fp,
PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead8Ptr pfh,
PclCharDataPtr pcd,
unsigned char *code);
extern void PclDownloadSoftFont16(
FILE *fp,
PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead16Ptr pfh,
PclCharDataPtr pcd,
unsigned char row,
unsigned char col);
extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void);
extern void PclDestroySoftFontInfo(
PclSoftFontInfoPtr pSoftFontInfo );
/****** /******
* Functions in PclGC.c * Functions in PclGC.c
******/ ******/
@ -326,7 +353,7 @@ extern int PclUpdateDrawableGC(
FILE **outFile); FILE **outFile);
extern void PclValidateGC( extern void PclValidateGC(
GCPtr pGC, GCPtr pGC,
Mask changes, unsigned long changes,
DrawablePtr pDrawable); DrawablePtr pDrawable);
extern void PclSetDrawablePrivateStuff( extern void PclSetDrawablePrivateStuff(
DrawablePtr pDrawable, DrawablePtr pDrawable,
@ -336,16 +363,34 @@ extern int PclGetDrawablePrivateStuff(
GC *gc, GC *gc,
unsigned long *valid, unsigned long *valid,
FILE **file ); FILE **file );
extern void PclSetDrawablePrivateGC(
DrawablePtr pDrawable,
GC gc);
extern void PclComputeCompositeClip(
GCPtr pGC,
DrawablePtr pDrawable);
/****** /******
* Functions in PclInit.c * Functions in PclInit.c
******/ ******/
extern Bool InitializePclDriver( extern Bool PclCloseScreen(
int index,
ScreenPtr pScreen);
extern Bool InitializeColorPclDriver(
int ndx,
ScreenPtr pScreen,
int argc,
char **argv);
extern Bool InitializeMonoPclDriver(
int ndx,
ScreenPtr pScreen,
int argc,
char **argv);
extern Bool InitializeLj3PclDriver(
int ndx, int ndx,
ScreenPtr pScreen, ScreenPtr pScreen,
int argc, int argc,
char **argv); char **argv);
static Bool PclDestroyContext( XpContextPtr pCon );
extern XpContextPtr PclGetContextFromWindow( WindowPtr win ); extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
/****** /******
@ -380,6 +425,12 @@ extern int PclGetMediumDimensions(
extern int PclGetReproducibleArea( extern int PclGetReproducibleArea(
XpContextPtr pCon, XpContextPtr pCon,
xRectangle *pRect); xRectangle *pRect);
extern void PclSendData(
FILE *outFile,
PclContextPrivPtr pConPriv,
BoxPtr pbox,
int nbox,
double ratio);
/****** /******
* Functions in PclPixel.c * Functions in PclPixel.c
@ -508,7 +559,6 @@ extern Bool PclPositionWindow(
int x, int x,
int y); int y);
extern Bool PclUnmapWindow(WindowPtr pWindow); extern Bool PclUnmapWindow(WindowPtr pWindow);
extern Bool PclUnmapWindow(WindowPtr pWindow);
extern void PclCopyWindow( extern void PclCopyWindow(
WindowPtr pWin, WindowPtr pWin,
DDXPointRec ptOldOrg, DDXPointRec ptOldOrg,
@ -569,12 +619,3 @@ extern int PclGetDocumentData(
#endif /* _PCL_H_ */ #endif /* _PCL_H_ */

View File

@ -45,6 +45,8 @@ dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArc.c,v 1.5 2001/01/17 22:36:30 dawes Exp $ */
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <errno.h> #include <errno.h>
@ -52,14 +54,15 @@ copyright holders.
#include "Pcl.h" #include "Pcl.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "windowstr.h" #include "windowstr.h"
#include "attributes.h"
static void static void
PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt ) PclDoArc(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nArcs; int nArcs,
xArc *pArcs; xArc *pArcs,
void (*DoIt)(); void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
{ {
char t[80]; char t[80];
FILE *outFile; FILE *outFile;
@ -140,7 +143,7 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
r.y1 = -Arc.height / 2 - fudge; r.y1 = -Arc.height / 2 - fudge;
r.x2 = Arc.width / 2 + fudge; r.x2 = Arc.width / 2 + fudge;
r.y2 = Arc.height / 2 + fudge; r.y2 = Arc.height / 2 + fudge;
drawRegion = miRegionCreate( &r, 0 ); drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );
SAVE_PCL( outFile, pConPriv, "\033%0A" ); SAVE_PCL( outFile, pConPriv, "\033%0A" );
MACRO_END( outFile ); MACRO_END( outFile );
@ -148,14 +151,13 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/* /*
* Intersect the bounding box with the clip region. * Intersect the bounding box with the clip region.
*/ */
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
transClip = miRegionCreate( NULL, 0 ); transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
miRegionCopy( transClip, REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) REGION_TRANSLATE( pGC->pScreen, transClip,
->pCompositeClip ); -(xoffset + Arc.x + Arc.width / 2),
miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2),
-(yoffset + Arc.y + Arc.height / 2) ); -(yoffset + Arc.y + Arc.height / 2) );
miIntersect( region, drawRegion, transClip ); REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
@ -177,9 +179,9 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
miRegionDestroy( transClip ); REGION_DESTROY( pGC->pScreen, transClip );
} }
} }
@ -202,11 +204,11 @@ DrawArc(FILE *outFile,
} }
void void
PclPolyArc( pDrawable, pGC, nArcs, pArcs ) PclPolyArc(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nArcs; int nArcs,
xArc *pArcs; xArc *pArcs)
{ {
PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc ); PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
} }
@ -246,11 +248,11 @@ DoChord(FILE *outFile,
void void
PclPolyFillArc( pDrawable, pGC, nArcs, pArcs ) PclPolyFillArc(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nArcs; int nArcs,
xArc *pArcs; xArc *pArcs)
{ {
switch( pGC->arcMode ) switch( pGC->arcMode )
{ {

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95 ** * Created: 10/23/95
** * ** *
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* /*
(c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 Hewlett-Packard Company
@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArea.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
@ -53,6 +54,9 @@ copyright holders.
#include "region.h" #include "region.h"
#include "cfb.h" #include "cfb.h"
#if 1
#include "cfb32.h"
#endif
void void
PclPutImage(DrawablePtr pDrawable, PclPutImage(DrawablePtr pDrawable,
@ -72,10 +76,10 @@ PclPutImage(DrawablePtr pDrawable,
unsigned long oldPlanemask; unsigned long oldPlanemask;
unsigned long i; unsigned long i;
long bytesPer; long bytesPer;
if( ( w == 0 ) || ( h == 0 ) ) if( ( w == 0 ) || ( h == 0 ) )
return; return;
if( format != XYPixmap ) if( format != XYPixmap )
{ {
pPixmap = GetScratchPixmapHeader( pDrawable->pScreen, pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
@ -85,7 +89,7 @@ PclPutImage(DrawablePtr pDrawable,
depth ), (pointer)pImage ); depth ), (pointer)pImage );
if( !pPixmap ) if( !pPixmap )
return; return;
if( format == ZPixmap ) if( format == ZPixmap )
(void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC, (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
leftPad, 0, w, h, x, y ); leftPad, 0, w, h, x, y );
@ -104,7 +108,7 @@ PclPutImage(DrawablePtr pDrawable,
if( !pPixmap ) if( !pPixmap )
return; return;
depth = pGC->depth; depth = pGC->depth;
oldPlanemask = pGC->planemask; oldPlanemask = pGC->planemask;
oldFg = pGC->fgPixel; oldFg = pGC->fgPixel;
@ -113,12 +117,11 @@ PclPutImage(DrawablePtr pDrawable,
gcv[1] = 0; gcv[1] = 0;
DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 ); DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
bytesPer = (long)h * BitmapBytePad( w + leftPad ); bytesPer = (long)h * BitmapBytePad( w + leftPad );
for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer ) for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
{ {
if( i & oldPlanemask ) if( i & oldPlanemask )
{ {
extern void cfbPutImage(), cfb32PutImage();
gcv[0] = i; gcv[0] = i;
DoChangeGC( pGC, GCPlaneMask, gcv, 0 ); DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
ValidateGC( pDrawable, pGC ); ValidateGC( pDrawable, pGC );
@ -160,16 +163,16 @@ PclMonoPixmapFragment(FILE *outFile,
{ {
char *bits, t[80], *row; char *bits, t[80], *row;
int h, w, i; int h, w, i;
/* /*
* Create a storage area large enough to hold the entire pixmap, * Create a storage area large enough to hold the entire pixmap,
* then use mfbGetImage to get the appropriate bits. * then use mfbGetImage to get the appropriate bits.
*/ */
h = y2 - y1; h = y2 - y1;
w = BitmapBytePad( x2 - x1 ); w = BitmapBytePad( x2 - x1 );
bits = (char *)xalloc( h * w ); bits = (char *)xalloc( h * w );
mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
XYPixmap, ~0, bits ); XYPixmap, ~0, bits );
/* /*
@ -179,7 +182,7 @@ PclMonoPixmapFragment(FILE *outFile,
*/ */
sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty ); sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
/* /*
* Now, wrap the raster in the appropriate PCL code. Right now, * Now, wrap the raster in the appropriate PCL code. Right now,
* it's going to go down the wire without any compression. That * it's going to go down the wire without any compression. That
@ -188,14 +191,14 @@ PclMonoPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M", sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
h, x2 - x1 ); h, x2 - x1 );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
sprintf( t, "\033*b%dW", w ); sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i <= h; i++, row += w ) for( row = bits, i = 0; i <= h; i++, row += w )
{ {
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w ); SEND_PCL_COUNT( outFile, row, w );
} }
SEND_PCL( outFile, "\033*rC" ); SEND_PCL( outFile, "\033*rC" );
/* /*
@ -216,21 +219,20 @@ PclColorPixmapFragment(FILE *outFile,
{ {
char *bits, t[80], *row; char *bits, t[80], *row;
int h, w, i; int h, w, i;
extern void cfbGetImage(), cfb32GetImage();
/* /*
* Create a storage area large enough to hold the entire pixmap, * Create a storage area large enough to hold the entire pixmap,
* then use cfbGetImage to get the appropriate bits. * then use cfbGetImage to get the appropriate bits.
*/ */
h = y2 - y1; h = y2 - y1;
w = PixmapBytePad( x2 - x1, pix->drawable.depth ); w = PixmapBytePad( x2 - x1, pix->drawable.depth );
bits = (char *)xalloc( h * w ); bits = (char *)xalloc( h * w );
if (pix->drawable.depth <= 8) if (pix->drawable.depth <= 8)
cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits ); ZPixmap, ~0, bits );
else if (pix->drawable.depth <= 32) else if (pix->drawable.depth <= 32)
cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits ); ZPixmap, ~0, bits );
/* /*
@ -249,16 +251,16 @@ PclColorPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M", sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
h, x2 - x1 ); h, x2 - x1 );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
sprintf( t, "\033*b%dW", w ); sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i < h; i++, row += w ) for( row = bits, i = 0; i < h; i++, row += w )
{ {
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w ); SEND_PCL_COUNT( outFile, row, w );
} }
SEND_PCL( outFile, "\033*rC" ); SEND_PCL( outFile, "\033*rC" );
/* /*
* Clean things up a bit * Clean things up a bit
*/ */
@ -277,22 +279,20 @@ PclCopyArea(DrawablePtr pSrc,
int dsty) int dsty)
{ {
PixmapPtr pixSrc = (PixmapPtr)pSrc; PixmapPtr pixSrc = (PixmapPtr)pSrc;
char t[80]; /*
FILE *srcFile, *dstFile; FILE *srcFile;
GC srcGC, dstGC; GC srcGC;
*/
FILE *dstFile;
GC dstGC;
unsigned long valid; unsigned long valid;
struct stat statBuf;
XpContextPtr pCon;
xRectangle repro;
PclPixmapPrivPtr pPriv;
RegionPtr drawRegion, region, whole, ret; RegionPtr drawRegion, region, whole, ret;
BoxRec box; BoxRec box;
BoxPtr prect; BoxPtr prect;
int nrect; int nrect;
void (*doFragment)(FILE *, PixmapPtr, short, short, short, short, void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
short, short ); short, short );
extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea();
/* /*
* Since we don't store any information on a per-window basis, we * Since we don't store any information on a per-window basis, we
* can't copy from a window. * can't copy from a window.
@ -321,7 +321,7 @@ PclCopyArea(DrawablePtr pSrc,
PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile ); PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
*/ */
PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile ); PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
/* /*
* If we're copying to a window, we have to do some actual * If we're copying to a window, we have to do some actual
* drawing, instead of just handing it off to mfb or cfb. Start * drawing, instead of just handing it off to mfb or cfb. Start
@ -331,14 +331,11 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = srcy; box.y1 = srcy;
box.x2 = srcx + width; box.x2 = srcx + width;
box.y2 = srcy + height; box.y2 = srcy + height;
drawRegion = miRegionCreate( &box, 0 ); drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
miTranslateRegion( drawRegion, dstx, dsty ); REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
miIntersect( region, drawRegion, REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
((PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr))
->pCompositeClip );
/* /*
* Now select the operation to be performed on each box in the * Now select the operation to be performed on each box in the
@ -348,7 +345,7 @@ PclCopyArea(DrawablePtr pSrc,
doFragment = PclMonoPixmapFragment; doFragment = PclMonoPixmapFragment;
else else
doFragment = PclColorPixmapFragment; doFragment = PclColorPixmapFragment;
/* /*
* Actually draw each section of the bitmap. * Actually draw each section of the bitmap.
*/ */
@ -360,18 +357,18 @@ PclCopyArea(DrawablePtr pSrc,
(*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx, (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
prect->y1 - dsty, prect->x2 - dstx, prect->y1 - dsty, prect->x2 - dstx,
prect->y2 - dsty, prect->x1, prect->y1 ); prect->y2 - dsty, prect->x1, prect->y1 );
nrect--; nrect--;
prect++; prect++;
} }
/* /*
* Update the destination's GC to the source's GC. * Update the destination's GC to the source's GC.
*/ */
/* /*
PclSetDrawablePrivateGC( pDst, srcGC ); PclSetDrawablePrivateGC( pDst, srcGC );
*/ */
/* /*
* Determine the region that needs to be returned. This is the * Determine the region that needs to be returned. This is the
* region of the source that falls outside the boundary of the * region of the source that falls outside the boundary of the
@ -381,24 +378,24 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = 0; box.y1 = 0;
box.x2 = pixSrc->drawable.width; box.x2 = pixSrc->drawable.width;
box.y2 = pixSrc->drawable.height; box.y2 = pixSrc->drawable.height;
whole = miRegionCreate( &box, 0 ); whole = REGION_CREATE( pGC->pScreen, &box, 0 );
ret = miRegionCreate( NULL, 0 ); ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
miTranslateRegion( drawRegion, -dstx, -dsty ); REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
miSubtract( ret, drawRegion, whole ); REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
/* /*
* Clean up the regions * Clean up the regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
miRegionDestroy( whole ); REGION_DESTROY( pGC->pScreen, whole );
if( miRegionNotEmpty( ret ) ) if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
return ret; return ret;
else else
{ {
miRegionDestroy( ret ); REGION_DESTROY( pGC->pScreen, ret );
return NULL; return NULL;
} }
} }
@ -418,20 +415,19 @@ PclCopyPlane(DrawablePtr pSrc,
RegionPtr reg; RegionPtr reg;
GCPtr scratchGC; GCPtr scratchGC;
PixmapPtr scratchPix; PixmapPtr scratchPix;
extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane();
/* /*
* Since we don't store PCL on a per-window basis, there's no good * Since we don't store PCL on a per-window basis, there's no good
* way to copy from a window. * way to copy from a window.
*/ */
if( pSrc->type == DRAWABLE_WINDOW ) if( pSrc->type == DRAWABLE_WINDOW )
return NULL; return NULL;
/* /*
* Copying from a pixmap to a pixmap is already implemented by * Copying from a pixmap to a pixmap is already implemented by
* mfb/cfb. * mfb/cfb.
*/ */
if( pSrc->type == DRAWABLE_PIXMAP && if( pSrc->type == DRAWABLE_PIXMAP &&
pDst->type == DRAWABLE_PIXMAP ) pDst->type == DRAWABLE_PIXMAP )
{ {
if( pDst->depth == 1 ) if( pDst->depth == 1 )
@ -452,7 +448,7 @@ PclCopyPlane(DrawablePtr pSrc,
*/ */
scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width, scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
height, pDst->depth ); height, pDst->depth );
scratchGC = GetScratchGC( pDst->depth, pDst->pScreen ); scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
CopyGC( pGC, scratchGC, ~0L ); CopyGC( pGC, scratchGC, ~0L );
@ -474,14 +470,13 @@ PclCopyPlane(DrawablePtr pSrc,
cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
srcx, srcy, width, height, 0, 0, plane ); srcx, srcy, width, height, 0, 0, plane );
} }
reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width, reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
height, dstx, dsty ); height, dstx, dsty );
FreeScratchGC( scratchGC ); FreeScratchGC( scratchGC );
(*pDst->pScreen->DestroyPixmap)( scratchPix ); (*pDst->pScreen->DestroyPixmap)( scratchPix );
return reg; return reg;
} }

View File

@ -45,10 +45,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclColor.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <math.h> #include <math.h>
@ -58,18 +60,7 @@ copyright holders.
#include "resource.h" #include "resource.h"
#include "Pcl.h" #include "Pcl.h"
#include "cfb.h"
PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
ColormapPtr cmap,
GCPtr gc);
unsigned char *PclReadMap(char *, int *);
void PclLookUp( ColormapPtr cmap,
PclContextPrivPtr cPriv,
unsigned short *r,
unsigned short *g,
unsigned short *b);
static void lookup(unsigned char *src, static void lookup(unsigned char *src,
unsigned char *dst, unsigned char *dst,
@ -166,7 +157,7 @@ void
PclDestroyColormap(ColormapPtr pColor) PclDestroyColormap(ColormapPtr pColor)
{ {
PclScreenPrivPtr sPriv; PclScreenPrivPtr sPriv;
PclCmapToContexts *pCmap, *tCmap; PclCmapToContexts *pCmap, *tCmap = 0;
PclContextListPtr con, tCon; PclContextListPtr con, tCon;
PclContextPrivPtr cPriv; PclContextPrivPtr cPriv;
PclPaletteMapPtr pPal; PclPaletteMapPtr pPal;
@ -263,7 +254,7 @@ PclStoreColors(ColormapPtr pColor,
PclContextListPtr con; PclContextListPtr con;
PclContextPrivPtr cPriv; PclContextPrivPtr cPriv;
PclPaletteMapPtr pMap; PclPaletteMapPtr pMap;
char t[80], t2[30]; char t[80];
int i; int i;
sPriv = (PclScreenPrivPtr)pColor->pScreen sPriv = (PclScreenPrivPtr)pColor->pScreen
@ -425,7 +416,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
* If the requested colormap is already active, nothing needs to * If the requested colormap is already active, nothing needs to
* be done. * be done.
*/ */
return; return FALSE;
/* /*
* Now we activate the palette in the printer * Now we activate the palette in the printer
@ -478,10 +469,10 @@ PclUpdateColormap(DrawablePtr pDrawable,
SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
/* Now program the two colors */ /* Now program the two colors */
sprintf( t, "\033*v0a0b0c%dI", cmap->pScreen->blackPixel ); sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel );
SEND_PCL( cPriv->pPageFile, t ); SEND_PCL( cPriv->pPageFile, t );
sprintf( t, "\033*v32767a32767b32767c%dI", sprintf( t, "\033*v32767a32767b32767c%ldI",
cmap->pScreen->whitePixel ); (long) cmap->pScreen->whitePixel );
SEND_PCL( cPriv->pPageFile, t ); SEND_PCL( cPriv->pPageFile, t );
#endif /* XP_PCL_COLOR */ #endif /* XP_PCL_COLOR */
} }
@ -637,6 +628,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
} }
pMap->downloaded = 1; pMap->downloaded = 1;
} }
return TRUE;
} }
@ -725,7 +717,7 @@ unsigned char *PclReadMap(char *name, int *dim)
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
if (fread(data, sizeof(char), size, fp) != size) { if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
fclose(fp); fclose(fp);
free(data); free(data);
return(NULL); return(NULL);
@ -746,11 +738,11 @@ unsigned char *PclReadMap(char *name, int *dim)
static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim) static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
{ {
int i; int i;
unsigned char *p1, *p2, *p3;
int shift, offset;
#define _INTERPOLATE #define _INTERPOLATE
#ifndef _INTERPOLATE #ifndef _INTERPOLATE
unsigned char *p1, *p2, *p3;
for (i=0; i<num; i++) { for (i=0; i<num; i++) {
p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3; p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
*dst++ = *p1++; *dst++ = *p1++;
@ -794,7 +786,7 @@ static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, in
d000, d001, d010, d011, d000, d001, d010, d011,
d100, d101, d110, d111, d100, d101, d110, d111,
dx00, dx01, dx10, dx11, dx00, dx01, dx10, dx11,
dxy0, dxy1, dxyz; dxy0, dxy1;
float scale; float scale;
scale = 255.0 / (dim-1); scale = 255.0 / (dim-1);

View File

@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclCursor.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include <stdio.h> #include <stdio.h>
@ -52,59 +53,59 @@ copyright holders.
#include "windowstr.h" #include "windowstr.h"
void void
PclConstrainCursor( pScreen, pBox ) PclConstrainCursor(
ScreenPtr pScreen; ScreenPtr pScreen,
BoxPtr pBox; BoxPtr pBox)
{ {
} }
void void
PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox ) PclCursorLimits(
ScreenPtr pScreen; ScreenPtr pScreen,
CursorPtr pCursor; CursorPtr pCursor,
BoxPtr pHotBox; BoxPtr pHotBox,
BoxPtr pTopLeftBox; BoxPtr pTopLeftBox)
{ {
} }
Bool Bool
PclDisplayCursor( pScreen, pCursor ) PclDisplayCursor(
ScreenPtr pScreen; ScreenPtr pScreen,
CursorPtr pCursor; CursorPtr pCursor)
{ {
return True; return True;
} }
Bool Bool
PclRealizeCursor( pScreen, pCursor ) PclRealizeCursor(
ScreenPtr pScreen; ScreenPtr pScreen,
CursorPtr pCursor; CursorPtr pCursor)
{ {
return True; return True;
} }
Bool Bool
PclUnrealizeCursor( pScreen, pCursor ) PclUnrealizeCursor(
ScreenPtr pScreen; ScreenPtr pScreen,
CursorPtr pCursor; CursorPtr pCursor)
{ {
return True; return True;
} }
void void
PclRecolorCursor( pScreen, pCursor, displayed ) PclRecolorCursor(
ScreenPtr pScreen; ScreenPtr pScreen,
CursorPtr pCursor; CursorPtr pCursor,
Bool displayed; Bool displayed)
{ {
} }
Bool Bool
PclSetCursorPosition( pScreen, x, y, generateEvent ) PclSetCursorPosition(
ScreenPtr pScreen; ScreenPtr pScreen,
int x; int x,
int y; int y,
Bool generateEvent; Bool generateEvent)
{ {
return True; return True;
} }

View File

@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.10 2001/10/28 03:32:54 tsi Exp $ */
#include "gcstruct.h" #include "gcstruct.h"
@ -51,6 +52,8 @@ copyright holders.
#include "pixmapstr.h" #include "pixmapstr.h"
#include "colormapst.h" #include "colormapst.h"
#include "windowstr.h" #include "windowstr.h"
#include "cfb.h"
#include "cfb32.h"
#include "migc.h" #include "migc.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "resource.h" #include "resource.h"
@ -97,11 +100,8 @@ static GCFuncs PclGCFuncs =
; ;
Bool Bool
PclCreateGC( pGC ) PclCreateGC(GCPtr pGC)
GCPtr pGC;
{ {
PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
if( pGC->depth == 1 ) if( pGC->depth == 1 )
{ {
if( mfbCreateGC( pGC ) == FALSE ) if( mfbCreateGC( pGC ) == FALSE )
@ -125,36 +125,25 @@ PclCreateGC( pGC )
pGC->ops = &PclGCOps; pGC->ops = &PclGCOps;
pGC->funcs = &PclGCFuncs; pGC->funcs = &PclGCFuncs;
pPriv->pCompositeClip = NULL;
pPriv->freeCompClip = FALSE;
return TRUE; return TRUE;
} }
void void
PclDestroyGC(GCPtr pGC) PclDestroyGC(GCPtr pGC)
{ {
PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
extern int mfbGCPrivateIndex;
/* Handle the mfb and cfb, which share a GC private struct */ /* Handle the mfb and cfb, which share a GC private struct */
miRegisterGCPrivateIndex( mfbGCPrivateIndex );
miDestroyGC( pGC ); miDestroyGC( pGC );
if( pPriv->freeCompClip == TRUE )
REGION_DESTROY( pGC->pScreen, pPriv->pCompositeClip );
} }
int int
PclGetDrawablePrivateStuff( pDrawable, gc, valid, file ) PclGetDrawablePrivateStuff(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GC *gc; GC *gc,
unsigned long *valid; unsigned long *valid,
FILE **file; FILE **file)
{ {
XpContextPtr pCon; XpContextPtr pCon;
PclPixmapPrivPtr pPriv;
PclContextPrivPtr cPriv; PclContextPrivPtr cPriv;
switch( pDrawable->type ) switch( pDrawable->type )
@ -185,9 +174,9 @@ PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
} }
void void
PclSetDrawablePrivateGC( pDrawable, gc ) PclSetDrawablePrivateGC(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GC gc; GC gc)
{ {
PixmapPtr pix; PixmapPtr pix;
XpContextPtr pCon; XpContextPtr pCon;
@ -332,19 +321,17 @@ PclSendPattern(char *bits,
} }
int int
PclUpdateDrawableGC( pGC, pDrawable, outFile ) PclUpdateDrawableGC(
GCPtr pGC; GCPtr pGC,
DrawablePtr pDrawable; DrawablePtr pDrawable,
FILE **outFile; FILE **outFile)
{ {
Mask drawableMask, changeMask = 0; Mask changeMask = 0;
GC dGC; GC dGC;
unsigned long valid; unsigned long valid;
int i; int i;
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr cPriv; PclContextPrivPtr cPriv;
Colormap c;
ColormapPtr cmap;
PclGCPrivPtr gcPriv = (PclGCPrivPtr) PclGCPrivPtr gcPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr); (pGC->devPrivates[PclGCPrivateIndex].ptr);
@ -403,12 +390,14 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
changeMask |= GCTileStipYOrigin; changeMask |= GCTileStipYOrigin;
if( dGC.numInDashList == pGC->numInDashList ) if( dGC.numInDashList == pGC->numInDashList )
{
for( i = 0; i < dGC.numInDashList; i++ ) for( i = 0; i < dGC.numInDashList; i++ )
if( cPriv->dash[i] != pGC->dash[i] ) if( cPriv->dash[i] != pGC->dash[i] )
{ {
changeMask |= GCDashList; changeMask |= GCDashList;
break; break;
} }
}
else else
changeMask |= GCDashList; changeMask |= GCDashList;
} }
@ -513,9 +502,11 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCForeground ) if( changeMask & GCForeground )
{ {
#ifdef XP_PCL_COLOR
ColormapPtr cmap;
Colormap c;
char t[40]; char t[40];
#ifdef XP_PCL_COLOR
c = wColormap( ((WindowPtr)pDrawable) ); c = wColormap( ((WindowPtr)pDrawable) );
cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
@ -538,7 +529,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
} }
else /* PseudoColor or StaticGray */ else /* PseudoColor or StaticGray */
{ {
sprintf( t, "SP%d;", pGC->fgPixel ); sprintf( t, "SP%ld;", (long) pGC->fgPixel );
SEND_PCL( *outFile, t ); SEND_PCL( *outFile, t );
} }
#else #else
@ -654,9 +645,8 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCTile && !pGC->tileIsPixel ) if( changeMask & GCTile && !pGC->tileIsPixel )
{ {
char t[80], *bits, *row, *mod; char *bits;
int h, w, w2, sz; int h, w, sz;
int i, j;
h = pGC->tile.pixmap->drawable.height; h = pGC->tile.pixmap->drawable.height;
w = pGC->tile.pixmap->drawable.width; w = pGC->tile.pixmap->drawable.width;
@ -666,7 +656,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w ); sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz ); bits = (char *)xalloc( sz );
mfbGetImage(pGC->tile.pixmap, 0, 0, w, h, XYPixmap, ~0, bits); mfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, bits);
PclSendPattern( bits, sz, 1, h, w, 100, *outFile ); PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
xfree( bits ); xfree( bits );
} }
@ -674,7 +664,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{ {
sz = h * PixmapBytePad( w, 8 ); sz = h * PixmapBytePad( w, 8 );
bits = (char *)xalloc( sz ); bits = (char *)xalloc( sz );
cfbGetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits); cfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 8, h, w, 100, *outFile ); PclSendPattern( bits, sz, 8, h, w, 100, *outFile );
xfree( bits ); xfree( bits );
} }
@ -684,7 +674,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * PixmapBytePad( w, 24 ); sz = h * PixmapBytePad( w, 24 );
bits = (char *)xalloc( sz ); bits = (char *)xalloc( sz );
cfb32GetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits); cfb32GetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 24, h, w, 100, *outFile ); PclSendPattern( bits, sz, 24, h, w, 100, *outFile );
xfree( bits ); xfree( bits );
} }
@ -723,7 +713,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w ); sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz ); bits = (char *)xalloc( sz );
mfbGetImage( pGC->stipple, 0, 0, w, h, XYPixmap, ~0, bits ); mfbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits );
w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 ); w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
/* /*
@ -766,10 +756,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{ {
mfbValidateGC( scratchGC, ~0L, mfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix ); (DrawablePtr)scratchPix );
mfbCopyPlane( pGC->stipple, mfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0, (DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 ); 0, w, h, 0, 0, 1 );
mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0, mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
bits ); bits );
} }
else if( pGC->depth <= 32 ) else if( pGC->depth <= 32 )
@ -777,10 +767,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
#if PSZ == 8 #if PSZ == 8
cfbValidateGC( scratchGC, ~0L, cfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix ); (DrawablePtr)scratchPix );
cfbCopyPlane( pGC->stipple, cfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0, (DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 ); 0, w, h, 0, 0, 1 );
cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0, cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0,
bits ); bits );
#else #else
cfb32ValidateGC( scratchGC, ~0L, cfb32ValidateGC( scratchGC, ~0L,
@ -868,14 +858,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
void void
PclComputeCompositeClip(pGC, pDrawable) PclComputeCompositeClip(
GCPtr pGC; GCPtr pGC,
DrawablePtr pDrawable; DrawablePtr pDrawable)
{ {
ScreenPtr pScreen = pGC->pScreen;
PclGCPrivPtr devPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr);
if (pDrawable->type == DRAWABLE_WINDOW) if (pDrawable->type == DRAWABLE_WINDOW)
{ {
WindowPtr pWin = (WindowPtr) pDrawable; WindowPtr pWin = (WindowPtr) pDrawable;
@ -892,7 +878,7 @@ PclComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList; pregWin = &pWin->clipList;
freeTmpClip = FALSE; freeTmpClip = FALSE;
} }
freeCompClip = devPriv->freeCompClip; freeCompClip = pGC->freeCompClip;
/* /*
* if there is no client clip, we can get by with just keeping the * if there is no client clip, we can get by with just keeping the
@ -904,9 +890,9 @@ PclComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE) if (pGC->clientClipType == CT_NONE)
{ {
if (freeCompClip) if (freeCompClip)
REGION_DESTROY(pScreen, devPriv->pCompositeClip); REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
devPriv->pCompositeClip = pregWin; pGC->pCompositeClip = pregWin;
devPriv->freeCompClip = freeTmpClip; pGC->freeCompClip = freeTmpClip;
} }
else else
{ {
@ -919,30 +905,31 @@ PclComputeCompositeClip(pGC, pDrawable)
* clip. if neither is real, create a new region. * clip. if neither is real, create a new region.
*/ */
REGION_TRANSLATE(pScreen, pGC->clientClip, REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
pDrawable->x + pGC->clipOrg.x, pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y); pDrawable->y + pGC->clipOrg.y);
if (freeCompClip) if (freeCompClip)
{ {
REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip, REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip); pregWin, pGC->clientClip);
if (freeTmpClip) if (freeTmpClip)
REGION_DESTROY(pScreen, pregWin); REGION_DESTROY(pGC->pScreen, pregWin);
} }
else if (freeTmpClip) else if (freeTmpClip)
{ {
REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip); REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
devPriv->pCompositeClip = pregWin; pGC->clientClip);
pGC->pCompositeClip = pregWin;
} }
else else
{ {
devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
REGION_INTERSECT(pScreen, devPriv->pCompositeClip, REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip); pregWin, pGC->clientClip);
} }
devPriv->freeCompClip = TRUE; pGC->freeCompClip = TRUE;
REGION_TRANSLATE(pScreen, pGC->clientClip, REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x), -(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y)); -(pDrawable->y + pGC->clipOrg.y));
} }
@ -957,23 +944,23 @@ PclComputeCompositeClip(pGC, pDrawable)
pixbounds.x2 = pDrawable->width; pixbounds.x2 = pDrawable->width;
pixbounds.y2 = pDrawable->height; pixbounds.y2 = pDrawable->height;
if (devPriv->freeCompClip) if (pGC->freeCompClip)
{ {
REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds); REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
} }
else else
{ {
devPriv->freeCompClip = TRUE; pGC->freeCompClip = TRUE;
devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
} }
if (pGC->clientClipType == CT_REGION) if (pGC->clientClipType == CT_REGION)
{ {
REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y); -pGC->clipOrg.x, -pGC->clipOrg.y);
REGION_INTERSECT(pScreen, devPriv->pCompositeClip, REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
devPriv->pCompositeClip, pGC->clientClip); pGC->pCompositeClip, pGC->clientClip);
REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y); pGC->clipOrg.x, pGC->clipOrg.y);
} }
} /* end of composite clip for pixmap */ } /* end of composite clip for pixmap */
@ -992,16 +979,11 @@ PclComputeCompositeClip(pGC, pDrawable)
/*ARGSUSED*/ /*ARGSUSED*/
void void
PclValidateGC( pGC, changes, pDrawable ) PclValidateGC(
GCPtr pGC; GCPtr pGC,
Mask changes; unsigned long changes,
DrawablePtr pDrawable; DrawablePtr pDrawable)
{ {
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
extern int mfbGCPrivateIndex;
extern int cfbGCPrivateIndex;
/* /*
* Pixmaps should be handled by their respective validation * Pixmaps should be handled by their respective validation
* functions. * functions.
@ -1010,16 +992,13 @@ PclValidateGC( pGC, changes, pDrawable )
{ {
if( pDrawable->depth == 1 ) if( pDrawable->depth == 1 )
{ {
miRegisterGCPrivateIndex( mfbGCPrivateIndex );
mfbValidateGC( pGC, ~0, pDrawable ); mfbValidateGC( pGC, ~0, pDrawable );
} }
else if( pDrawable->depth <= 32 ) else if( pDrawable->depth <= 32 )
{ {
#if PSZ == 8 #if PSZ == 8
miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfbValidateGC( pGC, ~0, pDrawable ); cfbValidateGC( pGC, ~0, pDrawable );
#else #else
miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfb32ValidateGC( pGC, ~0, pDrawable ); cfb32ValidateGC( pGC, ~0, pDrawable );
#endif #endif
} }
@ -1061,4 +1040,3 @@ PclValidateGC( pGC, changes, pDrawable )
PclSetDrawablePrivateGC( pDrawable, *pGC, changes ); PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
*/ */
} }

View File

@ -76,30 +76,26 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclInit.c,v 1.12 2002/10/16 21:13:32 dawes Exp $ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "Pcl.h" #include "Pcl.h"
#include "AttrValid.h"
#include "cfb.h" #include "cfb.h"
#include "Xos.h" /* for unlink() */
#include "attributes.h" #include "attributes.h"
#include "windowstr.h" #include "DiPrint.h"
#define MODELDIRNAME "/models" #define MODELDIRNAME "/models"
extern char *XpGetConfigDir();
static void AllocatePclPrivates( static void AllocatePclPrivates(ScreenPtr pScreen);
ScreenPtr pScreen);
static int PclInitContext(XpContextPtr pCon); static int PclInitContext(XpContextPtr pCon);
static Bool PclDestroyContext(XpContextPtr pCon);
extern Bool _XpBoolNoop();
extern void _XpVoidNoop();
extern unsigned char *PclReadMap(char *, int *);
int PclScreenPrivateIndex; int PclScreenPrivateIndex;
int PclContextPrivateIndex; int PclContextPrivateIndex;
@ -153,46 +149,24 @@ Bool
PclCloseScreen(int index, PclCloseScreen(int index,
ScreenPtr pScreen) ScreenPtr pScreen)
{ {
Bool status = Success;
PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr; PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
/* pScreen->CloseScreen = pPriv->CloseScreen;
if( pPriv->CloseScreen != (Bool (*)())NULL )
{
pScreen->CloseScreen = pPriv->CloseScreen;
status = pScreen->CloseScreen( index, pScreen );
pScreen->CloseScreen = PclCloseScreen;
}
*/
/*
* Finish cleaning up cfb (code taken from cfbCloseScreen)
*/
#ifdef XP_PCL_COLOR
#ifdef CFB_NEED_SCREEN_PRIVATE
xfree( pScreen->devPrivates[cfbScreenPrivateIndex].ptr );
#else
xfree( pScreen->devPrivate );
#endif
#endif
xfree( pPriv ); xfree( pPriv );
return status; return (*pScreen->CloseScreen)(index, pScreen);
} }
Bool Bool
InitializePclDriver(ndx, pScreen, argc, argv) InitializePclDriver(
int ndx; int ndx,
ScreenPtr pScreen; ScreenPtr pScreen,
int argc; int argc,
char **argv; char **argv)
{ {
int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes; int maxRes, xRes, yRes, maxDim;
int i; unsigned i;
PclScreenPrivPtr pPriv; PclScreenPrivPtr pPriv;
char **printerNames;
int numPrinters;
/* /*
* Register this driver's InitContext function with the print * Register this driver's InitContext function with the print
@ -227,7 +201,7 @@ InitializePclDriver(ndx, pScreen, argc, argv)
/* /*
* Clean up the fields that we stomp (code taken from cfbCloseScreen) * Clean up the fields that we stomp (code taken from cfbCloseScreen)
*/ */
for( i = 0; i < pScreen->numDepths; i++ ) for( i = 0; (int) i < pScreen->numDepths; i++ )
xfree( pScreen->allowedDepths[i].vids ); xfree( pScreen->allowedDepths[i].vids );
xfree( pScreen->allowedDepths ); xfree( pScreen->allowedDepths );
xfree( pScreen->visuals ); xfree( pScreen->visuals );
@ -236,19 +210,19 @@ InitializePclDriver(ndx, pScreen, argc, argv)
maxRes ); maxRes );
#endif /* XP_PCL_COLOR */ #endif /* XP_PCL_COLOR */
miInitializeBackingStore ( pScreen );
pScreen->defColormap = FakeClientID(0); pScreen->defColormap = FakeClientID(0);
pScreen->blackPixel = 1; pScreen->blackPixel = 1;
pScreen->whitePixel = 0; pScreen->whitePixel = 0;
/*
pPriv->CloseScreen = pScreen->CloseScreen; pPriv->CloseScreen = pScreen->CloseScreen;
*/
pScreen->CloseScreen = PclCloseScreen; pScreen->CloseScreen = PclCloseScreen;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize; pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
pScreen->SaveScreen = _XpBoolNoop; pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
pScreen->GetImage = _XpVoidNoop; pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
pScreen->GetSpans = _XpVoidNoop; pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PclCreateWindow; pScreen->CreateWindow = PclCreateWindow;
pScreen->DestroyWindow = PclDestroyWindow; pScreen->DestroyWindow = PclDestroyWindow;
/* /*
@ -316,30 +290,29 @@ InitializePclDriver(ndx, pScreen, argc, argv)
} }
static void static void
AllocatePclPrivates( AllocatePclPrivates(ScreenPtr pScreen)
ScreenPtr pScreen)
{ {
static int PclGeneration = -1; static unsigned long PclGeneration = 0;
if(PclGeneration != serverGeneration) if((unsigned long) PclGeneration != serverGeneration)
{ {
PclScreenPrivateIndex = AllocateScreenPrivateIndex(); PclScreenPrivateIndex = AllocateScreenPrivateIndex();
PclWindowPrivateIndex = AllocateWindowPrivateIndex(); PclWindowPrivateIndex = AllocateWindowPrivateIndex();
AllocateWindowPrivate( pScreen, PclWindowPrivateIndex, AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
sizeof( PclWindowPrivRec ) ); sizeof( PclWindowPrivRec ) );
PclContextPrivateIndex = XpAllocateContextPrivateIndex(); PclContextPrivateIndex = XpAllocateContextPrivateIndex();
XpAllocateContextPrivate( PclContextPrivateIndex, XpAllocateContextPrivate( PclContextPrivateIndex,
sizeof( PclContextPrivRec ) ); sizeof( PclContextPrivRec ) );
PclGCPrivateIndex = AllocateGCPrivateIndex(); PclGCPrivateIndex = AllocateGCPrivateIndex();
AllocateGCPrivate( pScreen, PclGCPrivateIndex, AllocateGCPrivate( pScreen, PclGCPrivateIndex,
sizeof( PclGCPrivRec ) ); sizeof( PclGCPrivRec ) );
PclPixmapPrivateIndex = AllocatePixmapPrivateIndex(); PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex, AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
sizeof( PclPixmapPrivRec ) ); sizeof( PclPixmapPrivRec ) );
PclGeneration = serverGeneration; PclGeneration = serverGeneration;
} }
@ -364,8 +337,7 @@ static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex"; default-input-tray default-medium plex";
static int static int
PclInitContext( pCon ) PclInitContext(XpContextPtr pCon)
XpContextPtr pCon;
{ {
XpDriverFuncsPtr pFuncs; XpDriverFuncsPtr pFuncs;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
@ -373,7 +345,6 @@ PclInitContext( pCon )
char *modelID; char *modelID;
char *configDir; char *configDir;
char *pathName; char *pathName;
extern XpValidatePoolsRec PclValidatePoolsRec;
int i, j; int i, j;
float width, height; float width, height;
XpOidMediumDiscreteSizeList* ds_list; XpOidMediumDiscreteSizeList* ds_list;
@ -392,16 +363,16 @@ PclInitContext( pCon )
pFuncs = &( pCon->funcs ); pFuncs = &( pCon->funcs );
pFuncs->StartJob = PclStartJob; pFuncs->StartJob = PclStartJob;
pFuncs->EndJob = PclEndJob; pFuncs->EndJob = PclEndJob;
pFuncs->StartDoc = (int (*)())PclStartDoc; pFuncs->StartDoc = PclStartDoc;
pFuncs->EndDoc = PclEndDoc; pFuncs->EndDoc = PclEndDoc;
pFuncs->StartPage = PclStartPage; pFuncs->StartPage = PclStartPage;
pFuncs->EndPage = PclEndPage; pFuncs->EndPage = PclEndPage;
pFuncs->PutDocumentData = PclDocumentData; pFuncs->PutDocumentData = PclDocumentData;
pFuncs->GetDocumentData = PclGetDocumentData; pFuncs->GetDocumentData = PclGetDocumentData;
pFuncs->GetAttributes = (char *(*)())PclGetAttributes; pFuncs->GetAttributes = PclGetAttributes;
pFuncs->SetAttributes = (int (*)())PclSetAttributes; pFuncs->SetAttributes = PclSetAttributes;
pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes; pFuncs->AugmentAttributes = PclAugmentAttributes;
pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute; pFuncs->GetOneAttribute = PclGetOneAttribute;
pFuncs->DestroyContext = PclDestroyContext; pFuncs->DestroyContext = PclDestroyContext;
pFuncs->GetMediumDimensions = PclGetMediumDimensions; pFuncs->GetMediumDimensions = PclGetMediumDimensions;
pFuncs->GetReproducibleArea = PclGetReproducibleArea; pFuncs->GetReproducibleArea = PclGetReproducibleArea;
@ -541,8 +512,7 @@ PclInitContext( pCon )
} }
static Bool static Bool
PclDestroyContext( pCon ) PclDestroyContext(XpContextPtr pCon)
XpContextPtr pCon;
{ {
PclContextPrivPtr pConPriv = (PclContextPrivPtr) PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
@ -639,8 +609,7 @@ PclDestroyContext( pCon )
} }
XpContextPtr XpContextPtr
PclGetContextFromWindow( win ) PclGetContextFromWindow(WindowPtr win)
WindowPtr win;
{ {
PclWindowPrivPtr pPriv; PclWindowPrivPtr pPriv;

View File

@ -11,7 +11,7 @@
** * Created: 10/11/95 ** * Created: 10/11/95
** * ** *
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* /*
(c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 Hewlett-Packard Company
@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclLine.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h" #include "Pcl.h"
#include "gcstruct.h" #include "gcstruct.h"
@ -80,16 +81,16 @@ copyright holders.
*/ */
void void
PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) PclPolyLine(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int mode; int mode,
int nPoints; int nPoints,
xPoint *pPoints; xPoint *pPoints)
{ {
char t[80], window[80]; char t[80];
FILE *outFile; FILE *outFile;
int xoffset, yoffset; int xoffset = 0, yoffset = 0;
int nbox; int nbox;
BoxPtr pbox; BoxPtr pbox;
xRectangle *drawRects, *r; xRectangle *drawRects, *r;
@ -98,7 +99,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
int i; int i;
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
@ -110,7 +111,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Allocate the storage required to deal with the clipping * Allocate the storage required to deal with the clipping
* regions. * regions.
*/ */
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *) drawRects = (xRectangle *)
xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) ); xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
@ -120,7 +121,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* XXX I need to think of a way to test this. * XXX I need to think of a way to test this.
*/ */
fudge = 3 * pGC->lineWidth + 1; fudge = 3 * pGC->lineWidth + 1;
/* /*
* Generate the PCL code to draw the polyline, by defining it as a * Generate the PCL code to draw the polyline, by defining it as a
* macro which uses the HP-GL/2 line drawing function. * macro which uses the HP-GL/2 line drawing function.
@ -132,20 +133,20 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x, sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
pPoints[0].y + pDrawable->y ); pPoints[0].y + pDrawable->y );
SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */ SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
switch( mode ) switch( mode )
{ {
case CoordModeOrigin: case CoordModeOrigin:
xoffset = pDrawable->x; xoffset = pDrawable->x;
yoffset = pDrawable->y; yoffset = pDrawable->y;
SAVE_PCL( outFile, pConPriv, "PA" ); SAVE_PCL( outFile, pConPriv, "PA" );
break; break;
case CoordModePrevious: case CoordModePrevious:
xoffset = yoffset = 0; xoffset = yoffset = 0;
SAVE_PCL( outFile, pConPriv, "PR" ); SAVE_PCL( outFile, pConPriv, "PR" );
break; break;
} }
/* /*
* Build the "drawing region" as we build the PCL to draw the * Build the "drawing region" as we build the PCL to draw the
* line. * line.
@ -154,13 +155,13 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
{ {
if( i != 1 ) if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," ); SAVE_PCL( outFile, pConPriv, "," );
sprintf( t, "%d,%d", pPoints[i].x + xoffset, sprintf( t, "%d,%d", pPoints[i].x + xoffset,
pPoints[i].y + yoffset ); pPoints[i].y + yoffset );
SAVE_PCL( outFile, pConPriv, t ); SAVE_PCL( outFile, pConPriv, t );
r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge; r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge; r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge; r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge; r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
} }
@ -171,36 +172,35 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Convert the collection of rectangles into a proper region, then * Convert the collection of rectangles into a proper region, then
* intersect it with the clip region. * intersect it with the clip region.
*/ */
drawRegion = miRectsToRegion( nPoints - 1, drawRects, CT_UNSORTED ); drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1,
drawRects, CT_UNSORTED );
if( mode == CoordModePrevious ) if( mode == CoordModePrevious )
miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y ); REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
miIntersect( region, drawRegion, REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire polyline to it. * window" and render the entire polyline to it.
*/ */
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0); PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects ); xfree( drawRects );
} }
void void
PclPolySegment( pDrawable, pGC, nSegments, pSegments ) PclPolySegment(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nSegments; int nSegments,
xSegment *pSegments; xSegment *pSegments)
{ {
FILE *outFile, *dummy; FILE *outFile, *dummy;
char t[80]; char t[80];
@ -214,8 +214,8 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
GC cacheGC; GC cacheGC;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
@ -226,7 +226,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
/* /*
* Allocate the storage for the temporary regions. * Allocate the storage for the temporary regions.
*/ */
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *) drawRects = (xRectangle *)
xalloc( nSegments * sizeof( xRectangle ) ); xalloc( nSegments * sizeof( xRectangle ) );
@ -234,12 +234,12 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Calculate the fudge factor, based on the line width * Calculate the fudge factor, based on the line width
*/ */
fudge = pGC->lineWidth * 3 + 1; fudge = pGC->lineWidth * 3 + 1;
/* /*
* Turn off line joining. * Turn off line joining.
*/ */
SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" ); SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
/* /*
* Generate the PCL code to draw the segments, by defining them as * Generate the PCL code to draw the segments, by defining them as
* a macro which uses the HP-GL/2 line drawing function. * a macro which uses the HP-GL/2 line drawing function.
@ -254,7 +254,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
xoffset = pDrawable->x; xoffset = pDrawable->x;
yoffset = pDrawable->y; yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nSegments; i++, r++ ) for( i = 0, r = drawRects; i < nSegments; i++, r++ )
{ {
r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset; r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
@ -279,18 +279,17 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Convert the collection of rectangles into a proper region, then * Convert the collection of rectangles into a proper region, then
* intersect it with the clip region. * intersect it with the clip region.
*/ */
drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED ); drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
miIntersect( region, drawRegion, drawRects, CT_UNSORTED );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire set of segments to it. * window" and render the entire set of segments to it.
*/ */
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0); PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/* /*
@ -303,12 +302,11 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
cacheGC.joinStyle = !cacheGC.joinStyle; cacheGC.joinStyle = !cacheGC.joinStyle;
PclSetDrawablePrivateGC( pDrawable, cacheGC ); PclSetDrawablePrivateGC( pDrawable, cacheGC );
PclUpdateDrawableGC( pGC, pDrawable, &outFile ); PclUpdateDrawableGC( pGC, pDrawable, &outFile );
/* /*
* Clean up * Clean up
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects ); xfree( drawRects );
} }

View File

@ -44,9 +44,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclMisc.c,v 1.10 2001/12/02 13:35:28 herrb Exp $ */
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */ #include "Xos.h" /* for SIGCLD on pre-POSIX systems */
#include <stdio.h>
#include "Pcl.h" #include "Pcl.h"
#include "cursor.h" #include "cursor.h"
@ -54,6 +58,7 @@ copyright holders.
#include "windowstr.h" #include "windowstr.h"
#include "propertyst.h" #include "propertyst.h"
#include "attributes.h"
/*ARGSUSED*/ /*ARGSUSED*/
@ -142,12 +147,14 @@ GetPropString(
} }
#include <signal.h> #include <signal.h>
#include <errno.h>
/* ARGSUSED */ /* ARGSUSED */
static void SigchldHndlr ( static void SigchldHndlr (
int dummy) int dummy)
{ {
int status, w; int status, w;
int olderrno = errno;
struct sigaction act; struct sigaction act;
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_flags = 0; act.sa_flags = 0;
@ -159,6 +166,7 @@ static void SigchldHndlr (
* Is this really necessary? * Is this really necessary?
*/ */
sigaction(SIGCHLD, &act, (struct sigaction *)NULL); sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
errno = olderrno;
} }
/* /*
@ -248,6 +256,7 @@ char *ptr;
* in the clipped area. * in the clipped area.
* For XP-PCL-LJ3, it draws the spooled figures in the clipped area. * For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
*/ */
void
PclSendData( PclSendData(
FILE *outFile, FILE *outFile,
PclContextPrivPtr pConPriv, PclContextPrivPtr pConPriv,

View File

@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixel.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h> #include <stdio.h>
@ -60,7 +61,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
int nPoints; int nPoints;
xPoint *pPoints; xPoint *pPoints;
{ {
char t[80], *command; char t[80];
FILE *outFile; FILE *outFile;
int xoffset, yoffset; int xoffset, yoffset;
BoxRec box; BoxRec box;
@ -84,7 +85,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
xloc = pPoints[0].x + pDrawable->x; xloc = pPoints[0].x + pDrawable->x;
yloc = pPoints[0].y + pDrawable->y; yloc = pPoints[0].y + pDrawable->y;
sprintf( t, "\27%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc ); sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
/* /*
@ -94,7 +95,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
for( i = 0; i < nPoints; i++ ) for( i = 0; i < nPoints; i++ )
{ {
if( miPointInRegion( pGC->clientClip, xloc, yloc, &box ) ) if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) )
{ {
sprintf( t, ",%d,%d", xloc, yloc ); sprintf( t, ",%d,%d", xloc, yloc );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );

View File

@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixmap.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h" #include "Pcl.h"
/*#include "cfb.h"*/ #include "cfb.h"
/* #include "mfb.h" */ #include "cfb32.h"
#include "mfb.h"
#include "pixmapstr.h" #include "pixmapstr.h"
PixmapPtr PixmapPtr
@ -56,25 +58,24 @@ PclCreatePixmap(ScreenPtr pScreen,
int height, int height,
int depth) int depth)
{ {
extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap();
if( depth == 1 ) if( depth == 1 )
return mfbCreatePixmap( pScreen, width, height, depth ); return mfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 8 ) else if( depth <= 8 )
return cfbCreatePixmap( pScreen, width, height, depth ); return cfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 32 ) else if( depth <= 32 )
return cfb32CreatePixmap( pScreen, width, height, depth ); return cfb32CreatePixmap( pScreen, width, height, depth );
return 0;
} }
Bool Bool
PclDestroyPixmap(PixmapPtr pPixmap) PclDestroyPixmap(PixmapPtr pPixmap)
{ {
extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap();
if( pPixmap->drawable.depth == 1 ) if( pPixmap->drawable.depth == 1 )
return mfbDestroyPixmap( pPixmap ); return mfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 8 ) else if( pPixmap->drawable.depth <= 8 )
return cfbDestroyPixmap( pPixmap ); return cfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 32 ) else if( pPixmap->drawable.depth <= 32 )
return cfb32DestroyPixmap( pPixmap ); return cfb32DestroyPixmap( pPixmap );
return 0;
} }

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95 ** * Created: 10/23/95
** * ** *
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* /*
(c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 Hewlett-Packard Company
@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h" #include "Pcl.h"
@ -51,11 +52,11 @@ copyright holders.
#include "windowstr.h" #include "windowstr.h"
void void
PclPolyRectangle( pDrawable, pGC, nRects, pRects ) PclPolyRectangle(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nRects; int nRects,
xRectangle *pRects; xRectangle *pRects)
{ {
char t[80]; char t[80];
FILE *outFile; FILE *outFile;
@ -67,23 +68,23 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
int xoffset, yoffset; int xoffset, yoffset;
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr) pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
/* /*
* Allocate the storage required to deal with the clipping * Allocate the storage required to deal with the clipping
* regions. * regions.
*/ */
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1; fudge = 3 * pGC->lineWidth + 1;
/* /*
* Generate the PCL code to draw the rectangles, by defining them * Generate the PCL code to draw the rectangles, by defining them
* as a macro which uses the HP-GL/2 rectangle drawing function. * as a macro which uses the HP-GL/2 rectangle drawing function.
@ -93,13 +94,13 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
xoffset = pDrawable->x; xoffset = pDrawable->x;
yoffset = pDrawable->y; yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nRects; i++, r++ ) for( i = 0, r = drawRects; i < nRects; i++, r++ )
{ {
xRectangle rect = pRects[i]; xRectangle rect = pRects[i];
/* Draw the rectangle */ /* Draw the rectangle */
sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset, sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
rect.y + yoffset, rect.width, rect.height ); rect.y + yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t ); SAVE_PCL( outFile, pConPriv, t );
@ -113,49 +114,47 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
} }
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile ); MACRO_END( outFile );
/* /*
* Convert the collection of rectangles to a proper region, then * Convert the collection of rectangles to a proper region, then
* intersect it with the clip region. * intersect it with the clip region.
*/ */
drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED ); drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
drawRects, CT_UNSORTED );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it. * window" and render the set of rectangles to it.
*/ */
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0); PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects ); xfree( drawRects );
} }
void void
PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) PclFillPolygon(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int shape; int shape,
int mode; int mode,
int nPoints; int nPoints,
DDXPointPtr pPoints; DDXPointPtr pPoints)
{ {
char t[80]; char t[80];
FILE *outFile; FILE *outFile;
int nbox, i; int nbox, i;
BoxPtr pbox; BoxPtr pbox;
BoxRec box; BoxRec box;
xRectangle *drawRects, *r;
RegionPtr drawRegion, region; RegionPtr drawRegion, region;
int xoffset, yoffset; int xoffset, yoffset;
int xtop, xbottom, yleft, yright; int xtop, xbottom, yleft, yright;
@ -163,14 +162,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
char *command; char *command;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr) pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
/* /*
* Generate the PCL code to draw the filled polygon, by defining * Generate the PCL code to draw the filled polygon, by defining
* it as a macro which uses the HP-GL/2 polygon drawing function. * it as a macro which uses the HP-GL/2 polygon drawing function.
@ -189,7 +188,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
xoffset = yoffset = 0; xoffset = yoffset = 0;
command = "PR"; command = "PR";
} }
/* Begin the polygon */ /* Begin the polygon */
sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ yoffset, command ); + yoffset, command );
@ -198,13 +197,13 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
/* Seed the bounding box */ /* Seed the bounding box */
xtop = xbottom = pPoints[0].x + xoffset; xtop = xbottom = pPoints[0].x + xoffset;
yleft = yright = pPoints[0].y + yoffset; yleft = yright = pPoints[0].y + yoffset;
/* Add the rest of the points to the polygon */ /* Add the rest of the points to the polygon */
for( i = 1; i < nPoints; i++ ) for( i = 1; i < nPoints; i++ )
{ {
if( i != 1 ) if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," ); SAVE_PCL( outFile, pConPriv, "," );
sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y + sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
yoffset ); yoffset );
SAVE_PCL( outFile, pConPriv, t ); SAVE_PCL( outFile, pConPriv, t );
@ -222,7 +221,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
fillRule = 0; fillRule = 0;
else else
fillRule = 1; fillRule = 1;
sprintf( t, ";PM2;FP%d;\033%%0A", fillRule ); sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
SAVE_PCL( outFile, pConPriv, t ); SAVE_PCL( outFile, pConPriv, t );
MACRO_END ( outFile ); MACRO_END ( outFile );
@ -234,16 +233,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
box.y1 = yleft; box.y1 = yleft;
box.x2 = xbottom; box.x2 = xbottom;
box.y2 = yright; box.y2 = yright;
drawRegion = miRegionCreate( &box, 0 ); drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
if( mode == CoordModePrevious ) if( mode == CoordModePrevious )
miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y ); REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion, region = REGION_CREATE( pGC->pScreen, NULL, 0 );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip ); REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
@ -251,22 +248,22 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
*/ */
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0); PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
} }
void void
PclPolyFillRect( pDrawable, pGC, nRects, pRects ) PclPolyFillRect(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nRects; int nRects,
xRectangle *pRects; xRectangle *pRects)
{ {
char t[80]; char t[80];
FILE *outFile; FILE *outFile;
@ -278,24 +275,24 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
short fudge; short fudge;
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr) pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
/* /*
* Allocate the storage required to deal with the clipping * Allocate the storage required to deal with the clipping
* regions. * regions.
*/ */
region = miRegionCreate( NULL, 0 ); region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1; fudge = 3 * pGC->lineWidth + 1;
/* /*
* Generate the PCL code to draw the filled rectangles, by * Generate the PCL code to draw the filled rectangles, by
* defining them as a macro which uses the HP-GL/2 rectangle * defining them as a macro which uses the HP-GL/2 rectangle
@ -303,19 +300,19 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
*/ */
MACRO_START( outFile, pConPriv ); MACRO_START( outFile, pConPriv );
SAVE_PCL( outFile, pConPriv, "\033%0B" ); SAVE_PCL( outFile, pConPriv, "\033%0B" );
xoffset = pDrawable->x; xoffset = pDrawable->x;
yoffset = pDrawable->y; yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nRects; i++, r++ ) for( i = 0, r = drawRects; i < nRects; i++, r++ )
{ {
xRectangle rect = pRects[i]; xRectangle rect = pRects[i];
/* Draw the rectangle */ /* Draw the rectangle */
sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y + sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
yoffset, rect.width, rect.height ); yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t ); SAVE_PCL( outFile, pConPriv, t );
/* Build the bounding box */ /* Build the bounding box */
r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge; r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
r->y = MIN( rect.y, rect.y + rect.height ) + yoffset - r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
@ -325,30 +322,28 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
} }
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile ); MACRO_END( outFile );
/* /*
* Convert the collection of rectangles to a proper region, then * Convert the collection of rectangles to a proper region, then
* intersect it with the clip region. * intersect it with the clip region.
*/ */
drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED ); drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
miIntersect( region, drawRegion, drawRects, CT_UNSORTED );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it. * window" and render the set of rectangles to it.
*/ */
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0); PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects ); xfree( drawRects );
} }

View File

@ -43,6 +43,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPrint.c,v 1.7 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -63,20 +64,14 @@ copyright holders.
#include "AttrValid.h" #include "AttrValid.h"
#include "Oid.h" #include "Oid.h"
extern PclSoftFontInfoPtr PclCreateSoftFontInfo();
extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr);
int int
PclStartJob( pCon, sendClientData, client ) PclStartJob(
XpContextPtr pCon; XpContextPtr pCon,
Bool sendClientData; Bool sendClientData,
ClientPtr client; ClientPtr client)
{ {
PclContextPrivPtr pConPriv = PclContextPrivPtr pConPriv =
(PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
char *jobHeader;
char s[40];
PclPaletteMap *pal; PclPaletteMap *pal;
/* /*
@ -128,9 +123,9 @@ PclStartJob( pCon, sendClientData, client )
} }
int int
PclEndJob( pCon, cancel ) PclEndJob(
XpContextPtr pCon; XpContextPtr pCon,
Bool cancel; Bool cancel)
{ {
PclContextPrivPtr priv = (PclContextPrivPtr) PclContextPrivPtr priv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
@ -143,7 +138,7 @@ PclEndJob( pCon, cancel )
char *fileName, *trailer; char *fileName, *trailer;
struct stat statBuf; struct stat statBuf;
int n; int n;
PclPaletteMapPtr p, t; PclPaletteMapPtr p;
trailer = "\033%-12345X@PJL RESET\n"; trailer = "\033%-12345X@PJL RESET\n";
@ -152,7 +147,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) { if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient ); XpFinishDocData( priv->getDocClient );
priv->getDocClient == NULL; priv->getDocClient = NULL;
priv->getDocBufSize = 0; priv->getDocBufSize = 0;
} }
@ -183,7 +178,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) { if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient ); XpFinishDocData( priv->getDocClient );
priv->getDocClient == NULL; priv->getDocClient = NULL;
priv->getDocBufSize = 0; priv->getDocBufSize = 0;
} }
@ -249,11 +244,10 @@ PclEndJob( pCon, cancel )
* ClearArea the window and all descendant windows * ClearArea the window and all descendant windows
*/ */
int int
PclStartPage( pCon, pWin ) PclStartPage(
XpContextPtr pCon; XpContextPtr pCon,
WindowPtr pWin; WindowPtr pWin)
{ {
register WindowPtr pChild;
PclContextPrivPtr pConPriv = (PclContextPrivPtr) PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv = PclWindowPrivPtr pWinPriv =
@ -261,9 +255,7 @@ PclStartPage( pCon, pWin )
xRectangle repro; xRectangle repro;
char t[80]; char t[80];
XpOid orient, plex, tray, medium; XpOid orient, plex, tray, medium;
unsigned short wid, ht;
int dir, plexNum, num; int dir, plexNum, num;
xEvent event;
/* /*
* Put a pointer to the context in the window private structure * Put a pointer to the context in the window private structure
@ -490,14 +482,12 @@ SendDocData( PclContextPrivPtr pPriv )
* Write page file to job file * Write page file to job file
*/ */
int int
PclEndPage( pCon, pWin ) PclEndPage(
XpContextPtr pCon; XpContextPtr pCon,
WindowPtr pWin; WindowPtr pWin)
{ {
PclContextPrivPtr pConPriv = (PclContextPrivPtr) PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv =
(PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
struct stat statBuf; struct stat statBuf;
@ -566,9 +556,9 @@ PclStartDoc(XpContextPtr pCon,
} }
int int
PclEndDoc( pCon, cancel ) PclEndDoc(
XpContextPtr pCon; XpContextPtr pCon,
Bool cancel; Bool cancel)
{ {
/* /*
* XXX What should I do if I get cancel == TRUE? * XXX What should I do if I get cancel == TRUE?
@ -588,18 +578,18 @@ PclEndDoc( pCon, cancel )
#define DOC_HPGL 2 #define DOC_HPGL 2
int int
PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client) PclDocumentData(
XpContextPtr pCon; XpContextPtr pCon,
DrawablePtr pDraw; DrawablePtr pDraw,
char *pData; char *pData,
int len_data; int len_data,
char *pFmt; char *pFmt,
int len_fmt; int len_fmt,
char *pOpt; char *pOpt,
int len_opt; int len_opt,
ClientPtr client; ClientPtr client)
{ {
int type; int type = 0;
PclContextPrivPtr pPriv = (PclContextPrivPtr) PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;
XpOidDocFmtList *formats; XpOidDocFmtList *formats;
@ -703,10 +693,10 @@ PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, cli
*/ */
int int
PclGetDocumentData( pCon, client, maxBufferSize ) PclGetDocumentData(
XpContextPtr pCon; XpContextPtr pCon,
ClientPtr client; ClientPtr client,
int maxBufferSize; int maxBufferSize)
{ {
PclContextPrivPtr pPriv = (PclContextPrivPtr) PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr; pCon->devPrivates[PclContextPrivateIndex].ptr;

View File

@ -45,6 +45,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h> #include <stdio.h>
@ -75,8 +76,7 @@ PclDownloadSoftFont8(
PclSoftFontInfoPtr pSoftFontInfo, PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead8Ptr pfh, PclFontHead8Ptr pfh,
PclCharDataPtr pcd, PclCharDataPtr pcd,
unsigned char *code, unsigned char *code
int flag
) )
{ {
/* /*
@ -103,8 +103,7 @@ PclDownloadSoftFont16(
PclFontHead16Ptr pfh, PclFontHead16Ptr pfh,
PclCharDataPtr pcd, PclCharDataPtr pcd,
unsigned char row, unsigned char row,
unsigned char col, unsigned char col
int flag
) )
{ {
/* /*
@ -129,8 +128,7 @@ PclDownloadSoftFont16(
* of the downloaded soft font. * of the downloaded soft font.
* **************************************************************************/ * **************************************************************************/
PclSoftFontInfoPtr PclSoftFontInfoPtr
PclCreateSoftFontInfo( PclCreateSoftFontInfo(void)
)
{ {
PclSoftFontInfoPtr pSoftFontInfo; PclSoftFontInfoPtr pSoftFontInfo;
@ -154,7 +152,7 @@ PclFontHead8Ptr pfh8, pfh8_next;
PclFontHead16Ptr pfh16, pfh16_next; PclFontHead16Ptr pfh16, pfh16_next;
PclInternalFontPtr pin, pin_next; PclInternalFontPtr pin, pin_next;
unsigned char nindex_row, nindex_col; unsigned char nindex_row, nindex_col;
int i, j; int i;
if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL ) if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
return; return;

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95 ** * Created: 10/23/95
** * ** *
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* /*
(c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 Hewlett-Packard Company
@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.6 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h" #include "Pcl.h"
@ -51,33 +52,33 @@ copyright holders.
#include "windowstr.h" #include "windowstr.h"
void void
PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted ) PclFillSpans(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int nSpans; int nSpans,
DDXPointPtr pPoints; DDXPointPtr pPoints,
int *pWidths; int *pWidths,
int fSorted; int fSorted)
{ {
char t[80]; char t[80];
FILE *outFile; FILE *outFile;
int xoffset, yoffset; int xoffset, yoffset;
xRectangle *rects, *r; xRectangle *rects, *r;
RegionPtr fillRegion, region; RegionPtr fillRegion, region = 0;
int i; int i;
int nbox; int nbox;
BoxPtr pbox; BoxPtr pbox;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return; return;
/* /*
* Build a region out of the spans * Build a region out of the spans
*/ */
rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) ); rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
xoffset = pDrawable->x; xoffset = pDrawable->x;
yoffset = pDrawable->y; yoffset = pDrawable->y;
for( i = 0, r = rects; i < nSpans; i++, r++ ) for( i = 0, r = rects; i < nSpans; i++, r++ )
{ {
r->x = pPoints[i].x + xoffset; r->x = pPoints[i].x + xoffset;
@ -85,15 +86,15 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
r->width = pWidths[i]; r->width = pWidths[i];
r->height = 1; r->height = 1;
} }
fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ? fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
CT_YSORTED : CT_UNSORTED ); CT_YSORTED : CT_UNSORTED );
/* /*
* Intersect this region with the clip region. Whatever's left, * Intersect this region with the clip region. Whatever's left,
* should be filled. * should be filled.
*/ */
miIntersect( region, fillRegion, pGC->clientClip ); REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
pbox = REGION_RECTS( region ); pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region ); nbox = REGION_NUM_RECTS( region );
@ -102,35 +103,33 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
while( nbox ) while( nbox )
{ {
sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
pbox->x2, pbox->y2 ); pbox->x2, pbox->y2 );
SEND_PCL( outFile, t ); SEND_PCL( outFile, t );
nbox--; nbox--;
pbox++; pbox++;
} }
/* Go back to PCL */ /* Go back to PCL */
SEND_PCL( outFile, "\27%0A" ); SEND_PCL( outFile, "\27%0A" );
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( fillRegion ); REGION_DESTROY( pGC->pScreen, fillRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
xfree( rects ); xfree( rects );
} }
void void
PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted ) PclSetSpans(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
char *pSrc; char *pSrc,
DDXPointPtr pPoints; DDXPointPtr pPoints,
int *pWidths; int *pWidths,
int nSpans; int nSpans,
int fSorted; int fSorted)
{ {
} }

View File

@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclText.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#ifdef DO_TWO_BYTE_PCL #ifdef DO_TWO_BYTE_PCL
#include "iconv.h" #include "iconv.h"
@ -81,13 +82,13 @@ static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
#define INTERNAL_FONT 1 #define INTERNAL_FONT 1
int int
PclPolyText8( pDrawable, pGC, x, y, count, string ) PclPolyText8(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x; int x,
int y; int y,
int count; int count,
char *string; char *string)
{ {
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
@ -181,8 +182,6 @@ char font_type;
MACRO_END( outFile ); MACRO_END( outFile );
} else { } else {
char *internalFont;
int pixel_size;
int fid = 0; int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo); pin = makeInternalFont(pGC->font, pSoftFontInfo);
@ -231,9 +230,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 ); drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 ); region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion, miIntersect( region, drawRegion, pGC->pCompositeClip );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
@ -247,20 +244,20 @@ char font_type;
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
return x+w; return x+w;
} }
int int
PclPolyText16( pDrawable, pGC, x, y, count, string ) PclPolyText16(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x; int x,
int y; int y,
int count; int count,
unsigned short *string; unsigned short *string)
{ {
XpContextPtr pCon; XpContextPtr pCon;
PclContextPrivPtr pConPriv; PclContextPrivPtr pConPriv;
@ -271,7 +268,6 @@ CharInfoPtr charinfo[255], *chinfo;
FILE *outFile; FILE *outFile;
PclSoftFontInfoPtr pSoftFontInfo; PclSoftFontInfoPtr pSoftFontInfo;
PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL; PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
PclCharDataRec cd; PclCharDataRec cd;
FontInfoPtr pfi; FontInfoPtr pfi;
unsigned char row, col; unsigned char row, col;
@ -321,8 +317,8 @@ char font_type;
col = col - pfi->firstCol; col = col - pfi->firstCol;
} else { } else {
def = pfi->defaultCh; def = pfi->defaultCh;
row = (def>>8)&0xff - pfi->firstRow; row = ((def>>8)&0xff) - pfi->firstRow;
col = def&0xff - pfi->firstCol; col = (def&0xff) - pfi->firstCol;
} }
if ( !pfh16->index[row][col].fid ) { if ( !pfh16->index[row][col].fid ) {
fillCharDescData(&cd, *chinfo); fillCharDescData(&cd, *chinfo);
@ -356,8 +352,8 @@ char font_type;
col = col - pfi->firstCol; col = col - pfi->firstCol;
} else { } else {
def = pfi->defaultCh; def = pfi->defaultCh;
row = (def>>8)&0xff - pfi->firstRow; row = ((def>>8)&0xff) - pfi->firstRow;
col = def&0xff - pfi->firstCol; col = (def&0xff) - pfi->firstCol;
} }
if ( last_fid != pfh16->index[row][col].fid ) { if ( last_fid != pfh16->index[row][col].fid ) {
sprintf(t, "%cFI%d;SS;LB", sprintf(t, "%cFI%d;SS;LB",
@ -380,8 +376,7 @@ char font_type;
} else { } else {
#ifdef DO_TWO_BYTE_PCL #ifdef DO_TWO_BYTE_PCL
char *internalFont; PclInternalFontPtr pin;
int pixel_size;
int fid = 0; int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo); pin = makeInternalFont(pGC->font, pSoftFontInfo);
@ -432,9 +427,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 ); drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 ); region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion, miIntersect( region, drawRegion, pGC->pCompositeClip );
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
/* /*
* For each rectangle in the clip region, set the HP-GL/2 "input * For each rectangle in the clip region, set the HP-GL/2 "input
@ -448,52 +441,52 @@ char font_type;
/* /*
* Clean up the temporary regions * Clean up the temporary regions
*/ */
miRegionDestroy( drawRegion ); REGION_DESTROY( pGC->pScreen, drawRegion );
miRegionDestroy( region ); REGION_DESTROY( pGC->pScreen, region );
return x+w; return x+w;
} }
void void
PclImageText8( pDrawable, pGC, x, y, count, string ) PclImageText8(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x, y; int x, int y,
int count; int count,
char *string; char *string)
{ {
} }
void void
PclImageText16( pDrawable, pGC, x, y, count, string ) PclImageText16(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x; int x,
int y; int y,
int count; int count,
unsigned short *string; unsigned short *string)
{ {
} }
void void
PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase ) PclImageGlyphBlt(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x, y; int x, int y,
unsigned int nGlyphs; unsigned int nGlyphs,
CharInfoPtr *pCharInfo; CharInfoPtr *pCharInfo,
pointer pGlyphBase; pointer pGlyphBase)
{ {
} }
void void
PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase ) PclPolyGlyphBlt(
DrawablePtr pDrawable; DrawablePtr pDrawable,
GCPtr pGC; GCPtr pGC,
int x, y; int x, int y,
unsigned int nGlyphs; unsigned int nGlyphs,
CharInfoPtr *pCharInfo; CharInfoPtr *pCharInfo,
pointer pGlyphBase; pointer pGlyphBase)
{ {
} }
@ -509,7 +502,7 @@ PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
FontInfoPtr pfi; FontInfoPtr pfi;
char *fontname; char *fontname;
unsigned char nindex; unsigned char nindex;
int i, j; int i;
unsigned long n; unsigned long n;
CharInfoPtr charinfo[1]; CharInfoPtr charinfo[1];
unsigned int space_width; unsigned int space_width;
@ -680,7 +673,7 @@ FontPropPtr props;
FontInfoPtr pfi; FontInfoPtr pfi;
char *fontname; char *fontname;
Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing; Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
int res, width; int res, width = 1;
int mask; int mask;
int i; int i;
@ -723,19 +716,19 @@ int i;
mask = 0; mask = 0;
for (i=0; i<pfi->nprops; i++, props++) { for (i=0; i<pfi->nprops; i++, props++) {
if ( props->name == xa_pcl_font_name ) { if ( (Atom) props->name == xa_pcl_font_name ) {
pin->pcl_font_name = NameForAtom(props->value); pin->pcl_font_name = NameForAtom(props->value);
mask |= 0x1; mask |= 0x1;
} else if ( props->name == XA_POINT_SIZE ) { } else if ( props->name == XA_POINT_SIZE ) {
pin->height = (float) props->value / 10.0; pin->height = (float) props->value / 10.0;
mask |= 0x2; mask |= 0x2;
} else if ( props->name == xa_res ) { } else if ( (Atom) props->name == xa_res ) {
res = (int) props->value; res = (int) props->value;
mask |= 0x4; mask |= 0x4;
} else if ( props->name == xa_ave_width ) { } else if ( (Atom) props->name == xa_ave_width ) {
width = (int) props->value / 10; width = (int) props->value / 10;
mask |= 0x8; mask |= 0x8;
} else if ( props->name == xa_spacing ) { } else if ( (Atom) props->name == xa_spacing ) {
pin->spacing = NameForAtom(props->value); pin->spacing = NameForAtom(props->value);
mask |= 0x10; mask |= 0x10;
} }
@ -746,8 +739,11 @@ int i;
return (PclInternalFontPtr) NULL; return (PclInternalFontPtr) NULL;
} }
if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) {
if (width == 0)
width = 1;
pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */ pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
}
pin->next = (PclInternalFontPtr)NULL; pin->next = (PclInternalFontPtr)NULL;
if ( prev == (PclInternalFontPtr) NULL) if ( prev == (PclInternalFontPtr) NULL)
@ -791,7 +787,7 @@ unsigned int byte_width;
unsigned char *p; unsigned char *p;
register int nbyGlyphWidth; register int nbyGlyphWidth;
unsigned char *pglyph, *pg; unsigned char *pglyph, *pg;
int i, j; unsigned int i, j;
pcd->h_offset = pci->metrics.leftSideBearing; pcd->h_offset = pci->metrics.leftSideBearing;
pcd->v_offset = pci->metrics.ascent; pcd->v_offset = pci->metrics.ascent;
@ -868,7 +864,7 @@ Atom dest;
pfi = (FontInfoRec *)&pfont->info; pfi = (FontInfoRec *)&pfont->info;
props = pfi->props; props = pfi->props;
for (i=0; i<pfi->nprops; i++, props++) { for (i=0; i<pfi->nprops; i++, props++) {
if ( props->name == dest && props->value == 2 ) if ( (Atom) props->name == dest && props->value == 2 )
return INTERNAL_FONT; return INTERNAL_FONT;
} }
return DOWNLOAD_FONT; return DOWNLOAD_FONT;

View File

@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclWindow.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "mistruct.h" #include "mistruct.h"
@ -57,8 +59,7 @@ copyright holders.
#include "Pcl.h" #include "Pcl.h"
extern WindowPtr *WindowTable; #if 0
/* /*
* The following list of strings defines the properties which will be * The following list of strings defines the properties which will be
* placed on the screen's root window if the property was defined in * placed on the screen's root window if the property was defined in
@ -75,7 +76,7 @@ static /* const */ char *propStrings[] = {
DT_PRINT_PAGE_COMMAND, DT_PRINT_PAGE_COMMAND,
(char *)NULL (char *)NULL
}; };
#endif
/* /*
* PclCreateWindow - watch for the creation of the root window. * PclCreateWindow - watch for the creation of the root window.
@ -207,7 +208,6 @@ PclPaintWindow(
RegionPtr pRegion, RegionPtr pRegion,
int what) int what)
{ {
int status;
WindowPtr pRoot; WindowPtr pRoot;
#define FUNCTION 0 #define FUNCTION 0
@ -367,13 +367,13 @@ PclPaintWindow(
} }
break; break;
case GCClipMask: case GCClipMask:
if ((pointer) pGC->clientClipType != (pointer)CT_NONE) { if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
gcmask |= index; gcmask |= index;
gcval[i++] = (pointer)CT_NONE; gcval[i++] = (pointer)CT_NONE;
} }
break; break;
case GCSubwindowMode: case GCSubwindowMode:
if ((pointer) pGC->subWindowMode != newValues[SUBWINDOW]) { if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
gcmask |= index; gcmask |= index;
gcval[i++] = newValues[SUBWINDOW]; gcval[i++] = newValues[SUBWINDOW];
} }
@ -387,7 +387,7 @@ PclPaintWindow(
} }
break; break;
case GCFillStyle: case GCFillStyle:
if ((pointer) pGC->fillStyle != newValues[FILLSTYLE]) { if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
gcmask |= index; gcmask |= index;
gcval[i++] = newValues[FILLSTYLE]; gcval[i++] = newValues[FILLSTYLE];
} }

View File

@ -30,166 +30,180 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCLMAP_H_ #ifndef _PCLMAP_H_
#define _PCLMAP_H_ #define _PCLMAP_H_
#ifdef XP_PCL_COLOR #ifdef XP_PCL_COLOR
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #ifdef CATNAME
#define NAME(subname) PclCr##subname #undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclCr##subname
#define CATNAME(prefix,subname) prefix##Color##subname #define CATNAME(prefix,subname) prefix##Color##subname
#else #else
#define NAME(subname) PclCr/**/subname #define PCLNAME(subname) PclCr/**/subname
#define CATNAME(prefix,subname) prefix/**/Color/**/subname #define CATNAME(prefix,subname) prefix/**/Color/**/subname
#endif #endif
#endif /* XP_PCL_COLOR */ #endif /* XP_PCL_COLOR */
#ifdef XP_PCL_MONO #ifdef XP_PCL_MONO
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #ifdef CATNAME
#define NAME(subname) PclMn##subname #undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclMn##subname
#define CATNAME(prefix,subname) prefix##Mono##subname #define CATNAME(prefix,subname) prefix##Mono##subname
#else #else
#define NAME(subname) PclMn/**/subname #define PCLNAME(subname) PclMn/**/subname
#define CATNAME(prefix,subname) prefix/**/Mono/**/subname #define CATNAME(prefix,subname) prefix/**/Mono/**/subname
#endif #endif
#endif /* XP_PCL_MONO */ #endif /* XP_PCL_MONO */
#ifdef XP_PCL_LJ3 #ifdef XP_PCL_LJ3
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #ifdef CATNAME
#define NAME(subname) PclLj3##subname #undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclLj3##subname
#define CATNAME(prefix,subname) prefix##Lj3##subname #define CATNAME(prefix,subname) prefix##Lj3##subname
#else #else
#define NAME(subname) PclLj3/**/subname #define PCLNAME(subname) PclLj3/**/subname
#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname #define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
#endif #endif
#endif /* XP_PCL_LJ3 */ #endif /* XP_PCL_LJ3 */
#ifdef PCLNAME
/* PclInit.c */ /* PclInit.c */
#define InitializePclDriver CATNAME(Initialize, PclDriver) #define InitializePclDriver CATNAME(Initialize, PclDriver)
#define PclCloseScreen NAME(CloseScreen) #define PclCloseScreen PCLNAME(CloseScreen)
#define PclGetContextFromWindow NAME(GetContextFromWindow) #define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
#define PclScreenPrivateIndex NAME(ScreenPrivateIndex) #define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex)
#define PclWindowPrivateIndex NAME(WindowPrivateIndex) #define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex)
#define PclContextPrivateIndex NAME(ContextPrivateIndex) #define PclContextPrivateIndex PCLNAME(ContextPrivateIndex)
#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex) #define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex)
#define PclGCPrivateIndex NAME(GCPrivateIndex) #define PclGCPrivateIndex PCLNAME(GCPrivateIndex)
/* PclPrint.c */ /* PclPrint.c */
#define PclStartJob NAME(StartJob) #define PclStartJob PCLNAME(StartJob)
#define PclEndJob NAME(EndJob) #define PclEndJob PCLNAME(EndJob)
#define PclStartPage NAME(StartPage) #define PclStartPage PCLNAME(StartPage)
#define PclEndPage NAME(EndPage) #define PclEndPage PCLNAME(EndPage)
#define PclStartDoc NAME(StartDoc) #define PclStartDoc PCLNAME(StartDoc)
#define PclEndDoc NAME(EndDoc) #define PclEndDoc PCLNAME(EndDoc)
#define PclDocumentData NAME(DocumentData) #define PclDocumentData PCLNAME(DocumentData)
#define PclGetDocumentData NAME(GetDocumentData) #define PclGetDocumentData PCLNAME(GetDocumentData)
/* PclWindow.c */ /* PclWindow.c */
#define PclCreateWindow NAME(CreateWindow) #define PclCreateWindow PCLNAME(CreateWindow)
#define PclMapWindow NAME(MapWindow) #define PclMapWindow PCLNAME(MapWindow)
#define PclPositionWindow NAME(PositionWindow) #define PclPositionWindow PCLNAME(PositionWindow)
#define PclUnmapWindow NAME(UnmapWindow) #define PclUnmapWindow PCLNAME(UnmapWindow)
#define PclCopyWindow NAME(CopyWindow) #define PclCopyWindow PCLNAME(CopyWindow)
#define PclChangeWindowAttributes NAME(ChangeWindowAttributes) #define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
#define PclPaintWindow NAME(PaintWindow) #define PclPaintWindow PCLNAME(PaintWindow)
#define PclDestroyWindow NAME(DestroyWindow) #define PclDestroyWindow PCLNAME(DestroyWindow)
/* PclGC.c */ /* PclGC.c */
#define PclCreateGC NAME(CreateGC) #define PclCreateGC PCLNAME(CreateGC)
#define PclDestroyGC NAME(DestroyGC) #define PclDestroyGC PCLNAME(DestroyGC)
#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff) #define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC) #define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
#define PclSendPattern NAME(SendPattern) #define PclSendPattern PCLNAME(SendPattern)
#define PclUpdateDrawableGC NAME(UpdateDrawableGC) #define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
#define PclComputeCompositeClip NAME(ComputeCompositeClip) #define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
#define PclValidateGC NAME(ValidateGC) #define PclValidateGC PCLNAME(ValidateGC)
/* PclAttr.c */ /* PclAttr.c */
#define PclGetAttributes NAME(GetAttributes) #define PclGetAttributes PCLNAME(GetAttributes)
#define PclGetOneAttribute NAME(GetOneAttribute) #define PclGetOneAttribute PCLNAME(GetOneAttribute)
#define PclAugmentAttributes NAME(AugmentAttributes) #define PclAugmentAttributes PCLNAME(AugmentAttributes)
#define PclSetAttributes NAME(SetAttributes) #define PclSetAttributes PCLNAME(SetAttributes)
/* PclColor.c */ /* PclColor.c */
#define PclLookUp NAME(LookUp) #define PclLookUp PCLNAME(LookUp)
#define PclCreateDefColormap NAME(CreateDefColormap) #define PclCreateDefColormap PCLNAME(CreateDefColormap)
#define PclCreateColormap NAME(CreateColormap) #define PclCreateColormap PCLNAME(CreateColormap)
#define PclDestroyColormap NAME(DestroyColormap) #define PclDestroyColormap PCLNAME(DestroyColormap)
#define PclInstallColormap NAME(InstallColormap) #define PclInstallColormap PCLNAME(InstallColormap)
#define PclUninstallColormap NAME(UninstallColormap) #define PclUninstallColormap PCLNAME(UninstallColormap)
#define PclListInstalledColormaps NAME(ListInstalledColormaps) #define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
#define PclStoreColors NAME(StoreColors) #define PclStoreColors PCLNAME(StoreColors)
#define PclResolveColor NAME(ResolveColor) #define PclResolveColor PCLNAME(ResolveColor)
#define PclFindPaletteMap NAME(FindPaletteMap) #define PclFindPaletteMap PCLNAME(FindPaletteMap)
#define PclUpdateColormap NAME(UpdateColormap) #define PclUpdateColormap PCLNAME(UpdateColormap)
#define PclReadMap NAME(ReadMap) #define PclReadMap PCLNAME(ReadMap)
/* PclPixmap.c */ /* PclPixmap.c */
#define PclCreatePixmap NAME(CreatePixmap) #define PclCreatePixmap PCLNAME(CreatePixmap)
#define PclDestroyPixmap NAME(DestroyPixmap) #define PclDestroyPixmap PCLNAME(DestroyPixmap)
/* PclArc.c */ /* PclArc.c */
#define PclDoArc NAME(DoArc) #define PclDoArc PCLNAME(DoArc)
#define PclPolyArc NAME(PolyArc) #define PclPolyArc PCLNAME(PolyArc)
#define PclPolyFillArc NAME(PolyFillArc) #define PclPolyFillArc PCLNAME(PolyFillArc)
/* PclArea.c */ /* PclArea.c */
#define PclPutImage NAME(PutImage) #define PclPutImage PCLNAME(PutImage)
#define PclCopyArea NAME(CopyArea) #define PclCopyArea PCLNAME(CopyArea)
#define PclCopyPlane NAME(CopyPlane) #define PclCopyPlane PCLNAME(CopyPlane)
/* PclLine */ /* PclLine */
#define PclPolyLine NAME(PolyLine) #define PclPolyLine PCLNAME(PolyLine)
#define PclPolySegment NAME(PolySegment) #define PclPolySegment PCLNAME(PolySegment)
/* PclPixel.c */ /* PclPixel.c */
#define PclPolyPoint NAME(PolyPoint) #define PclPolyPoint PCLNAME(PolyPoint)
#define PclPushPixels NAME(PushPixels) #define PclPushPixels PCLNAME(PushPixels)
/* PclPolygon.c */ /* PclPolygon.c */
#define PclPolyRectangle NAME(PolyRectangle) #define PclPolyRectangle PCLNAME(PolyRectangle)
#define PclFillPolygon NAME(FillPolygon) #define PclFillPolygon PCLNAME(FillPolygon)
#define PclPolyFillRect NAME(PolyFillRect) #define PclPolyFillRect PCLNAME(PolyFillRect)
/* PclSpans.c */ /* PclSpans.c */
#define PclFillSpans NAME(FillSpans) #define PclFillSpans PCLNAME(FillSpans)
#define PclSetSpans NAME(SetSpans) #define PclSetSpans PCLNAME(SetSpans)
/* PclText.c */ /* PclText.c */
#define PclPolyText8 NAME(PolyText8) #define PclPolyText8 PCLNAME(PolyText8)
#define PclPolyText16 NAME(PolyText16) #define PclPolyText16 PCLNAME(PolyText16)
#define PclImageText8 NAME(ImageText8) #define PclImageText8 PCLNAME(ImageText8)
#define PclImageText16 NAME(ImageText16) #define PclImageText16 PCLNAME(ImageText16)
#define PclImageGlyphBlt NAME(ImageGlyphBlt) #define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
#define PclPolyGlyphBlt NAME(PolyGlyphBlt) #define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
#define PclPolyGlyphBlt NAME(PolyGlyphBlt) #define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
/* PclFonts.c */ /* PclFonts.c */
#define PclRealizeFont NAME(RealizeFont) #define PclRealizeFont PCLNAME(RealizeFont)
#define PclUnrealizeFont NAME(UnrealizeFont) #define PclUnrealizeFont PCLNAME(UnrealizeFont)
/* PclSFonts.c */ /* PclSFonts.c */
#define PclDownloadSoftFont8 NAME(DownloadSoftFont8) #define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
#define PclDownloadSoftFont16 NAME(DownloadSoftFont16) #define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo) #define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo) #define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
/* PclMisc.c */ /* PclMisc.c */
#define PclQueryBestSize NAME(QueryBestSize) #define PclQueryBestSize PCLNAME(QueryBestSize)
#define GetPropString NAME(GetPropString) #define GetPropString PCLNAME(GetPropString)
#define SystemCmd NAME(SystemCmd) #define SystemCmd PCLNAME(SystemCmd)
#define PclGetMediumDimensions NAME(GetMediumDimensions) #define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
#define PclGetReproducibleArea NAME(GetReproducibleArea) #define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
#define PclSpoolFigs NAME(SpoolFigs) #define PclSpoolFigs PCLNAME(SpoolFigs)
#define PclSendData NAME(SendData) #define PclSendData PCLNAME(SendData)
/* PclCursor.c */ /* PclCursor.c */
#define PclConstrainCursor NAME(ConstrainCursor) #define PclConstrainCursor PCLNAME(ConstrainCursor)
#define PclCursorLimits NAME(CursorLimits) #define PclCursorLimits PCLNAME(CursorLimits)
#define PclDisplayCursor NAME(DisplayCursor) #define PclDisplayCursor PCLNAME(DisplayCursor)
#define PclRealizeCursor NAME(RealizeCursor) #define PclRealizeCursor PCLNAME(RealizeCursor)
#define PclUnrealizeCursor NAME(UnrealizeCursor) #define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
#define PclRecolorCursor NAME(RecolorCursor) #define PclRecolorCursor PCLNAME(RecolorCursor)
#define PclSetCursorPosition NAME(SetCursorPosition) #define PclSetCursorPosition PCLNAME(SetCursorPosition)
#endif
#endif /* _PCLMAP_H_ */ #endif /* _PCLMAP_H_ */

View File

@ -7,7 +7,6 @@ Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
@ -74,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.13 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PS_H_ #ifndef _PS_H_
#define _PS_H_ #define _PS_H_
@ -87,24 +87,11 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.h" #include "scrnintstr.h"
#include "dix.h" #include "dix.h"
/*
#include "X.h"
#include "Xproto.h"
#include "Xatom.h"
#include "misc.h"
#include "screenint.h"
#include "colormapst.h"
#include "windowstr.h"
#include "propertyst.h"
#include "servermd.h"*/ /* needed for IMAGE_BUFSIZE */
#include "PsDef.h" #include "PsDef.h"
#include "psout.h" #include "psout.h"
#define _XP_PRINT_SERVER_ #include <X11/extensions/Print.h>
#include "Print.h" #include <X11/extensions/Printstr.h>
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include "miscstruct.h" #include "miscstruct.h"
#include "fontstruct.h" #include "fontstruct.h"
@ -114,13 +101,17 @@ in this Software without prior written authorization from The Open Group.
/* /*
* Some sleazes to force the XrmDB stuff into the server * Some sleazes to force the XrmDB stuff into the server
*/ */
#ifndef HAVE_XPointer
typedef char *XPointer; typedef char *XPointer;
#define Status int #define Status int
#define True 1 #define True 1
#define False 0 #define False 0
#endif
#include "misc.h" #include "misc.h"
#include <Xfuncproto.h> #include <X11/Xfuncproto.h>
#include "../Xresource.h" #include <X11/Xresource.h>
#include "attributes.h"
/* /*
* Public index variables from PsInit.c * Public index variables from PsInit.c
@ -130,7 +121,7 @@ extern int PsScreenPrivateIndex;
extern int PsWindowPrivateIndex; extern int PsWindowPrivateIndex;
extern int PsContextPrivateIndex; extern int PsContextPrivateIndex;
extern int PsPixmapPrivateIndex; extern int PsPixmapPrivateIndex;
extern int PsGCPrivateIndex; extern XpValidatePoolsRec PsValidatePoolsRec;
/* /*
* Display list structures * Display list structures
@ -255,7 +246,7 @@ typedef struct
{ {
XrmDatabase resDB; XrmDatabase resDB;
ColormapPtr CMap; ColormapPtr CMap;
Bool (*DestroyWindow)(); Bool (*DestroyWindow)(WindowPtr);
} PsScreenPrivRec, *PsScreenPrivPtr; } PsScreenPrivRec, *PsScreenPrivPtr;
typedef struct typedef struct
@ -276,12 +267,6 @@ typedef struct
XpContextPtr context; XpContextPtr context;
} PsWindowPrivRec, *PsWindowPrivPtr; } PsWindowPrivRec, *PsWindowPrivPtr;
typedef struct
{
unsigned freeCompClip;
RegionPtr pCompositeClip;
} PsGCPrivRec, *PsGCPrivPtr;
typedef struct typedef struct
{ {
XpContextPtr context; XpContextPtr context;
@ -296,7 +281,9 @@ typedef struct
#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f ) #define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
#define MIN(a,b) (((a)<(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b))
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))
#endif
/* /*
* Functions in PsInit.c * Functions in PsInit.c
@ -304,7 +291,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc, extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv); char **argv);
static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win); extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/* /*
@ -328,9 +314,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/ */
extern Bool PsCreateGC(GCPtr pGC); extern Bool PsCreateGC(GCPtr pGC);
static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
unsigned long *valid, PsOutPtr *psOut,
ColormapPtr *cMap);
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable, extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
PsOutPtr *psOut, ColormapPtr *cMap); PsOutPtr *psOut, ColormapPtr *cMap);
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
@ -383,6 +366,9 @@ extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format, int x, int y, int w, int h, int leftPad, int format,
char *pImage); char *pImage);
extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *pImage);
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int width, int height, int srcx, int srcy, int width, int height,
int dstx, int dsty); int dstx, int dsty);
@ -517,4 +503,14 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms); extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms); extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
/*
* Functions in PsCache.c
*/
#ifdef BM_CACHE
extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
extern void PsBmClearImageCache(void);
#endif
#endif /* _PS_H_ */ #endif /* _PS_H_ */

View File

@ -228,7 +228,7 @@ error:
return; return;
} }
void static void
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, int imageRes, char *pImage) int w, int h, int leftPad, int format, int imageRes, char *pImage)
{ {
@ -269,9 +269,9 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
ColormapPtr cMap; ColormapPtr cMap;
int pageRes, sw, sh; int pageRes, sw, sh;
#ifdef BM_CACHE #ifdef BM_CACHE
long cache_id = 0; long cache_id = 0;
#endif #endif
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
if (!imageRes) { if (!imageRes) {
sw = w; sw = w;
@ -296,100 +296,100 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id); PsOut_BeginImageCache(psOut, cache_id);
#endif #endif
if( depth==24 ) if( depth==24 )
{
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
if( format==XYPixmap )
{ {
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3); int rowsiz = PixmapBytePad(w, depth);
if( format==XYPixmap ) char *planes[3];
planes[0] = pImage;
planes[1] = &pImage[rowsiz*h];
planes[2] = &pImage[rowsiz*h*2];
for( r=0 ; r<h ; r++ )
{ {
int rowsiz = PixmapBytePad(w, depth); char *pt[3];
char *planes[3]; for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
planes[0] = pImage; for( c=0 ; c<w ; c++ )
planes[1] = &pImage[rowsiz*h];
planes[2] = &pImage[rowsiz*h*2];
for( r=0 ; r<h ; r++ )
{ {
char *pt[3]; for( i=0 ; i<3 ; i++ )
for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r]; { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
for( c=0 ; c<w ; c++ )
{
for( i=0 ; i<3 ; i++ )
{ PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
}
} }
} }
else if( format==ZPixmap )
{
int rowsiz = PixmapBytePad(w, depth);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt+=4 )
{
if( swap )
{
char tmp[4];
tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
PsOut_OutImageBytes(psOut, 3, &pt[1]);
}
}
}
else goto error;
PsOut_EndImage(psOut);
} }
else if( depth==8 ) else if( format==ZPixmap )
{ {
int rowsiz = PixmapBytePad(w, depth); int rowsiz = PixmapBytePad(w, depth);
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ ) for( r=0 ; r<h ; r++ )
{ {
char *pt = &pImage[rowsiz*r]; char *pt = &pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ ) for( c=0 ; c<w ; c++,pt+=4 )
{ {
int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
char *ipt = (char *)&val;
if( swap ) if( swap )
{ {
char tmp[4]; char tmp[4];
tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0]; tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]); PsOut_OutImageBytes(psOut, 3, &tmp[1]);
} }
else else
PsOut_OutImageBytes(psOut, 3, &ipt[1]); PsOut_OutImageBytes(psOut, 3, &pt[1]);
}
}
}
else goto error;
PsOut_EndImage(psOut);
}
else if( depth==8 )
{
int rowsiz = PixmapBytePad(w, depth);
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ )
{
int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
PsOut_EndImage(psOut);
}
else if( depth==1 )
{
{
int rowsiz = BitmapBytePad(w);
int psrsiz = (w+7)/8;
PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel),
x, y, w, h, sw, sh, 1);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
for( i=0 ; i<psrsiz ; i++ )
{
int iv_, iv = (int)pt[i]&0xFF;
char c;
if( swap )
{ for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
else
iv_ = iv;
c = iv_;
PsOut_OutImageBytes(psOut, 1, &c);
} }
} }
PsOut_EndImage(psOut); PsOut_EndImage(psOut);
} }
else if( depth==1 ) }
{
{
int rowsiz = BitmapBytePad(w);
int psrsiz = (w+7)/8;
PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel),
x, y, w, h, sw, sh, 1);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
for( i=0 ; i<psrsiz ; i++ )
{
int iv_, iv = (int)pt[i]&0xFF;
char c;
if( swap )
{ for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
else
iv_ = iv;
c = iv_;
PsOut_OutImageBytes(psOut, 1, &c);
}
}
PsOut_EndImage(psOut);
}
}
#ifdef BM_CACHE #ifdef BM_CACHE
PsOut_EndImageCache(psOut); PsOut_EndImageCache(psOut);
} }
PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel), PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel)); PsGetPixelColor(cMap, pGC->fgPixel));

View File

@ -32,6 +32,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said dealings in this Software without prior written authorization from said
copyright holders. copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttVal.c,v 1.5 2001/12/19 21:28:44 dawes Exp $ */
#include "Ps.h" #include "Ps.h"
#include "AttrValid.h" #include "AttrValid.h"
@ -142,6 +143,13 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts) DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
}; };
/*
** So filtered printers that accept other raw formats can be
** used with this driver.
**
** Noah Roberts (jik-)
*/
#if 0
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = { static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL } { "Postscript", "2", NULL }
@ -149,6 +157,7 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
static XpOidDocFmtList ValidRawFormatsSupported = { static XpOidDocFmtList ValidRawFormatsSupported = {
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts) ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
}; };
#endif
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = { static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL } { "Postscript", "2", NULL }
@ -196,7 +205,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
&ValidPrinterResolutions, &DefaultPrinterResolutions, &ValidPrinterResolutions, &DefaultPrinterResolutions,
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported, &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
&ValidListfontsModes, &DefaultListfontsModes, &ValidListfontsModes, &DefaultListfontsModes,
&ValidRawFormatsSupported, &DefaultRawFormatsSupported, NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
&ValidSetupProviso, &ValidSetupProviso,
&DefaultDocumentFormat &DefaultDocumentFormat
}; };

View File

@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization * or other dealings in this Software without prior written authorization
* from said copyright holders. * from said copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttr.c,v 1.5 2001/12/14 19:59:15 dawes Exp $ */
/******************************************************************* /*******************************************************************
** **
@ -75,7 +76,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************************/ ********************************************************************/
#include "Ps.h" #include "Ps.h"
#include "attributes.h"
char * char *
PsGetAttributes( PsGetAttributes(

View File

@ -79,21 +79,21 @@ in this Software without prior written authorization from The Open Group.
#include "fntfil.h" #include "fntfil.h"
#include "fntfilst.h" #include "fntfilst.h"
#define GET 0 #define GET 0
#define RESET 1 #define RESET 1
struct bm_cache_list { struct bm_cache_list {
struct bm_cache_list *next; struct bm_cache_list *next;
struct bm_cache_list *prev; struct bm_cache_list *prev;
int height; int height;
long id; long id;
char *pBuffer; char *pBuffer;
}; };
struct bm_cache_head { struct bm_cache_head {
struct bm_cache_list *head; struct bm_cache_list *head;
int width; int width;
struct bm_cache_head *next; struct bm_cache_head *next;
struct bm_cache_head *prev; struct bm_cache_head *prev;
}; };
@ -106,14 +106,14 @@ PsBmUniqueId(int func)
if(func == RESET) if(func == RESET)
{ {
unique_id = 0; unique_id = 0;
return 0; return 0;
} }
else else
return ++unique_id; return ++unique_id;
} }
int int
PsBmIsImageCached( PsBmIsImageCached(
int gWidth, int gWidth,
int gHeight, int gHeight,
@ -126,28 +126,28 @@ PsBmIsImageCached(
{ {
if(pList->width == gWidth) if(pList->width == gWidth)
{ {
struct bm_cache_list *pItem = pList->head; struct bm_cache_list *pItem = pList->head;
while(pItem != NULL) while(pItem != NULL)
{ {
if(pItem->height == gHeight) if(pItem->height == gHeight)
{ {
int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight; int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length)) if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
{ {
return_val = pItem->id; return_val = pItem->id;
break; break;
} }
} }
else if(pItem->height > gHeight) else if(pItem->height > gHeight)
break; break;
pItem = pItem->next; pItem = pItem->next;
} }
} }
else if(pList->width > gWidth) else if(pList->width > gWidth)
break; break;
pList = pList->next; pList = pList->next;
} }
@ -180,39 +180,39 @@ PsBmPutImageInCache(
while(pList != NULL) while(pList != NULL)
{ {
if(pList->width == gWidth) if(pList->width == gWidth)
{ {
struct bm_cache_list *pItem = pList->head; struct bm_cache_list *pItem = pList->head;
while(pItem != NULL) while(pItem != NULL)
{ {
if(pItem->height >= gHeight) if(pItem->height >= gHeight)
{ {
pNew->next = pItem; pNew->next = pItem;
pNew->prev = pItem->prev; pNew->prev = pItem->prev;
if(pItem->prev != NULL) if(pItem->prev != NULL)
pItem->prev->next = pNew; pItem->prev->next = pNew;
else else
pList->head = pNew; pList->head = pNew;
pItem->prev = pNew; pItem->prev = pNew;
return_val = pNew->id; return_val = pNew->id;
break; break;
} }
else if(pItem->next == NULL) else if(pItem->next == NULL)
{ {
pNew->prev = pItem; pNew->prev = pItem;
pItem->next = pNew; pItem->next = pNew;
return_val = pNew->id; return_val = pNew->id;
break; break;
} }
pItem = pItem->next; pItem = pItem->next;
} }
break; break;
} }
pList = pList->next; pList = pList->next;
@ -223,50 +223,50 @@ PsBmPutImageInCache(
struct bm_cache_head *pNewList; struct bm_cache_head *pNewList;
pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head)); pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
pNewList->next = NULL; pNewList->next = NULL;
pNewList->prev = NULL; pNewList->prev = NULL;
pNewList->width = gWidth; pNewList->width = gWidth;
pNewList->head = pNew; pNewList->head = pNew;
if(bm_cache == NULL) if(bm_cache == NULL)
{ {
bm_cache = pNewList; bm_cache = pNewList;
return_val = pNew->id; return_val = pNew->id;
} }
else else
{ {
pList = bm_cache; pList = bm_cache;
while(pList != NULL) while(pList != NULL)
{ {
if(pList->width > gWidth) if(pList->width > gWidth)
{ {
pNewList->next = pList; pNewList->next = pList;
pNewList->prev = pList->prev; pNewList->prev = pList->prev;
if(pList->prev != NULL) if(pList->prev != NULL)
pList->prev->next = pNewList; pList->prev->next = pNewList;
else else
bm_cache = pNewList; bm_cache = pNewList;
pList->prev = pNewList; pList->prev = pNewList;
return_val = pNew->id; return_val = pNew->id;
break; break;
} }
else if(pList->next == NULL) else if(pList->next == NULL)
{ {
pNewList->prev = pList; pNewList->prev = pList;
pList->next = pNewList; pList->next = pNewList;
return_val = pNew->id; return_val = pNew->id;
break; break;
} }
pList = pList->next; pList = pList->next;
} }
} }
} }
@ -280,35 +280,35 @@ PsBmClearImageCacheItem(
{ {
if(pItem != NULL) if(pItem != NULL)
{ {
if(pItem->pBuffer != NULL) if(pItem->pBuffer != NULL)
free(pItem->pBuffer); free(pItem->pBuffer);
pItem->pBuffer = NULL; pItem->pBuffer = NULL;
if(pItem->next) if(pItem->next)
PsBmClearImageCacheItem(pItem->next); PsBmClearImageCacheItem(pItem->next);
pItem->next = NULL; pItem->next = NULL;
free(pItem); free(pItem);
pItem = NULL; pItem = NULL;
} }
} }
static void static void
PsBmClearImageCacheList( PsBmClearImageCacheList(
struct bm_cache_head *pList) struct bm_cache_head *pList)
{ {
if(pList != NULL) if(pList != NULL)
{ {
if(pList->head) if(pList->head)
PsBmClearImageCacheItem(pList->head); PsBmClearImageCacheItem(pList->head);
pList->head = NULL; pList->head = NULL;
if(pList->next) if(pList->next)
PsBmClearImageCacheList(pList->next); PsBmClearImageCacheList(pList->next);
pList->next = NULL; pList->next = NULL;
free(pList); free(pList);
pList = NULL; pList = NULL;
} }
} }

View File

@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** ********************************************************* ** *********************************************************
** **
********************************************************************/ ********************************************************************/
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsColor.c,v 1.3 2001/12/14 19:59:15 dawes Exp $ */
#include "Ps.h" #include "Ps.h"
#include "gcstruct.h" #include "gcstruct.h"
@ -85,7 +86,6 @@ PsCreateColormap(ColormapPtr pColor)
int i; int i;
unsigned short rgb; unsigned short rgb;
VisualPtr pVisual = pColor->pVisual; VisualPtr pVisual = pColor->pVisual;
Pixel pix;
if( pVisual->class==TrueColor ) if( pVisual->class==TrueColor )
{ {

View File

@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization * or other dealings in this Software without prior written authorization
* from said copyright holders. * from said copyright holders.
*/ */
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsFonts.c,v 1.6 2001/12/19 21:55:59 dawes Exp $ */
/******************************************************************* /*******************************************************************
** **
@ -109,7 +110,7 @@ PsGetFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ ) for( i=0 ; i<nprops ; i++ )
{ {
if( props[i].name==name ) if( (Atom)props[i].name == name )
{ value = props[i].value; break; } { value = props[i].value; break; }
} }
if( !value ) return (char *)0; if( !value ) return (char *)0;
@ -149,7 +150,7 @@ PsGetPSFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ ) for( i=0 ; i<nprops ; i++ )
{ {
if( props[i].name==name ) if( (Atom)props[i].name == name )
{ value = props[i].value; break; } { value = props[i].value; break; }
} }
if( !value ) return (char *)0; if( !value ) return (char *)0;
@ -170,8 +171,8 @@ PsIsISOLatin1Encoding(FontPtr pFont)
for( i=0 ; i<nprops ; i++ ) for( i=0 ; i<nprops ; i++ )
{ {
if( props[i].name==reg ) rv = props[i].value; if( (Atom)props[i].name == reg ) rv = props[i].value;
if( props[i].name==enc ) ev = props[i].value; if( (Atom)props[i].name == enc ) ev = props[i].value;
} }
if( rv ) rp = NameForAtom(rv); if( rv ) rp = NameForAtom(rv);
if( ev ) ep = NameForAtom(ev); if( ev ) ep = NameForAtom(ev);

Some files were not shown because too many files have changed in this diff Show More