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
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 "Xproto.h"
#include "dixstruct.h"
@ -34,7 +36,7 @@ static EviPrivPtr eviPriv;
static int
ProcEVIQueryVersion(ClientPtr client)
{
REQUEST(xEVIQueryVersionReq);
/* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
@ -167,11 +169,11 @@ EVIResetProc(ExtensionEntry *extEntry)
void
EVIExtensionInit(void)
{
ExtensionEntry *extEntry, *AddExtension();
if (extEntry = AddExtension(EVINAME, 0, 0,
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch,
SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode))
EVIResetProc, StandardMinorOpcode)))
{
XEVIReqCode = (unsigned char)extEntry->base;
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
@ -74,9 +75,9 @@ static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL;
extern WindowPtr* WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo;
extern int connBlockScreenStart;
static
int XagAppGroupFree (what, id)
@ -121,7 +122,7 @@ void XagClientStateChange (pcbl, nulldata, calldata)
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp;
XID authId;
XID authId = 0;
if (!pClient->appgroup) {
switch (pClient->clientState) {
@ -220,13 +221,13 @@ XagExtensionInit ()
{
ExtensionEntry* extEntry;
if (extEntry = AddExtension (XAGNAME,
if ((extEntry = AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
StandardMinorOpcode)) {
StandardMinorOpcode))) {
XagReqCode = (unsigned char)extEntry->base;
XagErrorBase = extEntry->errorBase;
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
@ -247,7 +248,7 @@ static
int ProcXagQueryVersion (client)
register ClientPtr client;
{
REQUEST (xXagQueryVersionReq);
/* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep;
register int n;
@ -309,8 +310,6 @@ static
void CreateConnectionInfo (pAppGrp)
AppGroupPtr pAppGrp;
{
extern int connBlockScreenStart;
xConnSetup *setup = (xConnSetup*) ConnectionInfo;
xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS];
@ -376,7 +375,6 @@ AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
CARD32* attribs;
{
AppGroupPtr pAppGrp;
int i;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) {
@ -570,7 +568,7 @@ int ProcXagCreateAssoc (client)
if (stuff->window_type != XagWindowTypeX11)
#endif
return BadMatch;
#ifdef WIN32 /* and Mac, etc */
#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client))
return BadAccess;
#endif
@ -584,7 +582,7 @@ static
int ProcXagDestroyAssoc (client)
register ClientPtr client;
{
REQUEST (xXagDestroyAssocReq);
/* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* 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.
*/
/* $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 "Xproto.h"
#include "misc.h"
@ -36,17 +38,23 @@ from The Open Group.
#include "bigreqstr.h"
static unsigned char XBigReqCode;
static int ProcBigReqDispatch();
static void BigReqResetProc();
static void BigReqResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
#endif
);
static DISPATCH_PROC(ProcBigReqDispatch);
void
BigReqExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
if (extEntry = AddExtension(XBigReqExtensionName, 0, 0,
if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode))
BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base;
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.
*/
/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.10 2001/12/14 19:58:48 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
@ -35,11 +36,16 @@ in this Software without prior written authorization from The Open Group.
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "swapreq.h"
#define _XCUP_SERVER_
#include "Xcupstr.h"
#include "Xfuncproto.h"
#ifndef EXTMODULE
#include "../os/osdep.h"
#else
#include "xf86_ansic.h"
#endif
static int ProcDispatch (), SProcDispatch ();
static void ResetProc ();
@ -121,13 +127,13 @@ XcupExtensionInit ()
{
ExtensionEntry* extEntry;
if (extEntry = AddExtension (XCUPNAME,
if ((extEntry = AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode)) {
StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
@ -146,7 +152,7 @@ static
int ProcQueryVersion (client)
register ClientPtr client;
{
REQUEST (xXcupQueryVersionReq);
/* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep;
register int n;
@ -214,7 +220,6 @@ int ProcStoreColors (client)
int ncolors, n;
xXcupStoreColorsReply rep;
xColorItem* cptr;
Pixel pixel;
if (!(pcmp->class & DynamicClass))
return BadMatch;
@ -302,7 +307,7 @@ int SProcGetReservedColormapEntries (client)
}
static
int SProcStoreColors (client)
int SProcXcupStoreColors (client)
ClientPtr client;
{
register int n;
@ -331,7 +336,7 @@ int SProcDispatch (client)
case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
return SProcStoreColors (client);
return SProcXcupStoreColors (client);
default:
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 "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#define DPMS_SERVER
#include "dpms.h"
#include "dpmsstr.h"
#include <stdio.h>
#include "dpmsproc.h"
static unsigned char DPMSCode;
static int ProcDPMSDispatch(), SProcDPMSDispatch();
static void DPMSResetProc();
static int ProcDPMSGetVersion(), SProcDPMSGetVersion();
static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts();
static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts();
static int ProcDPMSEnable(), ProcDPMSEnable();
static int ProcDPMSDisable(), ProcDPMSDisable();
static int ProcDPMSForceLevel(), ProcDPMSForceLevel();
extern void Swap32Write(); /* XXX should be in header file */
extern CARD32 ScreenSaverTime;
extern CARD32 DPMSStandbyTime;
extern CARD32 DPMSSuspendTime;
extern CARD32 DPMSOffTime;
extern BOOL DPMSCapableFlag;
extern BOOL DPMSEnabled;
extern CARD16 DPMSPowerLevel;
static DISPATCH_PROC(ProcDPMSDispatch);
static DISPATCH_PROC(SProcDPMSDispatch);
static DISPATCH_PROC(ProcDPMSGetVersion);
static DISPATCH_PROC(SProcDPMSGetVersion);
static DISPATCH_PROC(ProcDPMSGetTimeouts);
static DISPATCH_PROC(SProcDPMSGetTimeouts);
static DISPATCH_PROC(ProcDPMSSetTimeouts);
static DISPATCH_PROC(SProcDPMSSetTimeouts);
static DISPATCH_PROC(ProcDPMSEnable);
static DISPATCH_PROC(SProcDPMSEnable);
static DISPATCH_PROC(ProcDPMSDisable);
static DISPATCH_PROC(SProcDPMSDisable);
static DISPATCH_PROC(ProcDPMSForceLevel);
static DISPATCH_PROC(SProcDPMSForceLevel);
static DISPATCH_PROC(ProcDPMSInfo);
static DISPATCH_PROC(SProcDPMSInfo);
static DISPATCH_PROC(ProcDPMSCapable);
static DISPATCH_PROC(SProcDPMSCapable);
static void DPMSResetProc(ExtensionEntry* extEntry);
void
DPMSExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
if (extEntry = AddExtension(DPMSExtensionName, 0, 0,
if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode))
DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base;
return;
}
@ -79,7 +91,7 @@ static int
ProcDPMSGetVersion(client)
register ClientPtr client;
{
REQUEST(xDPMSGetVersionReq);
/* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep;
register int n;
@ -100,10 +112,9 @@ ProcDPMSGetVersion(client)
}
static int
ProcDPMSCapable(client)
register ClientPtr client;
ProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
/* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep;
register int n;
@ -114,6 +125,9 @@ ProcDPMSCapable(client)
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
}
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
return(client->noClientException);
}
@ -122,7 +136,7 @@ static int
ProcDPMSGetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSGetTimeoutsReq);
/* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep;
register int n;
@ -150,7 +164,6 @@ ProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
register int n;
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
@ -176,7 +189,7 @@ static int
ProcDPMSEnable(client)
register ClientPtr client;
{
REQUEST(xDPMSEnableReq);
/* REQUEST(xDPMSEnableReq); */
REQUEST_SIZE_MATCH(xDPMSEnableReq);
@ -190,13 +203,11 @@ static int
ProcDPMSDisable(client)
register ClientPtr client;
{
REQUEST(xDPMSDisableReq);
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
#ifdef DPMSExtension
DPMSSet(DPMSModeOn);
#endif
DPMSEnabled = FALSE;
@ -217,9 +228,7 @@ ProcDPMSForceLevel(client)
if (stuff->level == DPMSModeOn) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis();
}
#if 0
else if (stuff->level == DPMSModeStandby) {
} else if (stuff->level == DPMSModeStandby) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis() - DPMSStandbyTime;
} else if (stuff->level == DPMSModeSuspend) {
@ -232,20 +241,16 @@ ProcDPMSForceLevel(client)
client->errorValue = stuff->level;
return BadValue;
}
#endif
#ifdef DPMSExtension
DPMSSet(stuff->level);
#endif
return(client->noClientException);
}
static int
ProcDPMSInfo(client)
register ClientPtr client;
ProcDPMSInfo(register ClientPtr client)
{
REQUEST(xDPMSInfoReq);
/* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep;
register int n;
@ -309,8 +314,7 @@ SProcDPMSGetVersion(client)
}
static int
SProcDPMSCapable(client)
register ClientPtr client;
SProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
register int n;

View File

@ -26,23 +26,23 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* $XFree86: xc/programs/Xserver/Xext/dpmsstubs.c,v 3.4 2001/01/17 22:13:15 dawes Exp $ */
typedef int Bool;
#define FALSE 0
Bool DPMSSupported()
Bool DPMSSupported(void)
{
return FALSE;
}
int DPSMGet(level)
int *level;
int DPSMGet(int *level)
{
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
@ -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 $ */
#define NEED_REPLIES
#define NEED_EVENTS
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "window.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "sleepuntil.h"
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#include "multibufst.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "inputstr.h"
#ifndef WIN32
#ifdef EXTMODULE
#include "xf86_ansic.h"
#else
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
#ifdef PANORAMIX
#include "panoramiX.h"
#endif
/* 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)
#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 int MultibufferEventBase;
static int MultibufferErrorBase;
int MultibufferScreenIndex = -1;
int MultibufferWindowIndex = -1;
static void PerformDisplayRequest ();
static void DisposeDisplayRequest ();
static Bool QueueDisplayRequest ();
static void PerformDisplayRequest (
#if NeedFunctionPrototypes
MultibuffersPtr * /* ppMultibuffers */,
MultibufferPtr * /* pMultibuffer */,
int /* nbuf */
#endif
);
static Bool QueueDisplayRequest (
#if NeedFunctionPrototypes
ClientPtr /* client */,
TimeStamp /* activateTime */
#endif
);
static void BumpTimeStamp ();
void MultibufferExpose ();
void MultibufferUpdate ();
static void AliasMultibuffer ();
int CreateImageBuffers ();
void DestroyImageBuffers ();
int DisplayImageBuffers ();
static void RecalculateMultibufferOtherEvents ();
static int EventSelectForMultibuffer();
static void BumpTimeStamp (
#if NeedFunctionPrototypes
TimeStamp * /* ts */,
CARD32 /* inc */
#endif
);
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
* with this type
*/
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 resource id of the per-buffer data is the same as the resource
* id of the pixmap
*/
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,
* using the window resource id
*/
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
* OtherClient structures; each has a resource of this type.
*/
static RESTYPE OtherClientResType;
static int OtherClientDelete ();
static int OtherClientDelete (
#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
#endif
);
/****************
* MultibufferExtensionInit
@ -183,10 +162,70 @@ static int OtherClientDelete ();
*
****************/
static int ProcMultibufferDispatch(), SProcMultibufferDispatch();
static void MultibufferResetProc();
static void SClobberNotifyEvent(), SUpdateNotifyEvent();
static Bool MultibufferPositionWindow();
extern DISPATCH_PROC(ProcGetBufferAttributes);
static DISPATCH_PROC(ProcClearImageBufferArea);
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
MultibufferExtensionInit()
@ -243,8 +282,8 @@ MultibufferExtensionInit()
MultibufferReqCode = (unsigned char)extEntry->base;
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = SClobberNotifyEvent;
EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = SUpdateNotifyEvent;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
}
}
@ -275,7 +314,6 @@ static int
ProcGetBufferVersion (client)
register ClientPtr client;
{
REQUEST(xMbufGetBufferVersionReq);
xMbufGetBufferVersionReply rep;
register int n;
@ -331,8 +369,8 @@ SetupBackgroundPainter (pWin, pGC)
case BackgroundPixmap:
gcvalues[0] = (pointer) FillTiled;
gcvalues[1] = (pointer) background.pixmap;
gcvalues[2] = (pointer) ts_x_origin;
gcvalues[3] = (pointer) ts_y_origin;
gcvalues[2] = (pointer)(long) ts_x_origin;
gcvalues[3] = (pointer)(long) ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
@ -430,80 +468,8 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
return Success;
}
#ifdef PANORAMIX
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)
register ClientPtr client;
{
@ -565,10 +531,7 @@ ProcCreateImageBuffers (client)
swapl(&rep.length, n);
swaps(&rep.numberBuffer, n);
}
#ifdef PANORAMIX
if (noPanoramiXExtension)
#endif
WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
return (client->noClientException);
}
@ -585,16 +548,6 @@ ProcDisplayImageBuffers (client)
CARD32 minDelay;
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);
nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
@ -602,23 +555,6 @@ ProcDisplayImageBuffers (client)
return Success;
minDelay = stuff->minDelay;
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));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer)
@ -632,81 +568,6 @@ ProcDisplayImageBuffers (client)
activateTime.milliseconds = 0;
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],
MultibufferResType);
if (!pMultibuffer[i])
@ -728,9 +589,6 @@ MultibufferResType);
}
}
bufferTime = ppMultibuffers[i]->lastUpdate;
#ifdef PANORAMIX
}
#endif
BumpTimeStamp (&bufferTime, minDelay);
if (CompareTimeStamps (bufferTime, activateTime) == LATER)
activateTime = bufferTime;
@ -742,54 +600,15 @@ MultibufferResType);
;
}
else
#ifdef PANORAMIX
if (!noPanoramiXExtension){
PerformDisplayRequest (ppMultibuffers, pMultibuffer, panoramiX_buf);
}else
#endif
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
#ifdef PANORAMIX
if (!noPanoramiXExtension){
DEALLOCATE_LOCAL(ppScrn0Multibuffers);
DEALLOCATE_LOCAL(pScrn0Multibuffer);
}
#endif
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
return Success;
}
#ifdef PANORAMIX
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)
register ClientPtr client;
{
@ -803,34 +622,7 @@ ProcDestroyImageBuffers (client)
return Success;
}
#ifdef PANORAMIX
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)
register ClientPtr client;
{
@ -839,7 +631,7 @@ ProcSetMBufferAttributes (client)
MultibuffersPtr pMultibuffers;
int len;
Mask vmask;
Mask index;
Mask index2;
CARD32 updateHint;
XID *vlist;
@ -857,9 +649,9 @@ ProcSetMBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
index = (Mask) lowbit (vmask);
vmask &= ~index;
switch (index)
index2 = (Mask) lowbit (vmask);
vmask &= ~index2;
switch (index2)
{
case MultibufferWindowUpdateHint:
updateHint = (CARD32) *vlist;
@ -936,7 +728,7 @@ ProcSetBufferAttributes (client)
REQUEST(xMbufSetBufferAttributesReq);
MultibufferPtr pMultibuffer;
int len;
Mask vmask, index;
Mask vmask, index2;
XID *vlist;
Mask eventMask;
int result;
@ -952,9 +744,9 @@ ProcSetBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
index = (Mask) lowbit (vmask);
vmask &= ~index;
switch (index)
index2 = (Mask) lowbit (vmask);
vmask &= ~index2;
switch (index2)
{
case MultibufferBufferEventMask:
eventMask = (Mask) *vlist;
@ -971,6 +763,7 @@ ProcSetBufferAttributes (client)
return Success;
}
int
ProcGetBufferAttributes (client)
register ClientPtr client;
{
@ -1150,34 +943,13 @@ ProcMultibufferDispatch (client)
case X_MbufGetBufferVersion:
return ProcGetBufferVersion (client);
case X_MbufCreateImageBuffers:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXCreateImageBuffers (client);
else
return ProcCreateImageBuffers (client);
#else
return ProcCreateImageBuffers (client);
#endif
case X_MbufDisplayImageBuffers:
return ProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXDestroyImageBuffers (client);
else
return ProcDestroyImageBuffers (client);
#else
return ProcDestroyImageBuffers (client);
#endif
case X_MbufSetMBufferAttributes:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXSetMBufferAttributes (client);
else
return ProcSetMBufferAttributes (client);
#else
return ProcSetMBufferAttributes (client);
#endif
case X_MbufGetMBufferAttributes:
return ProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes:
@ -1447,8 +1219,6 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
if (pExposed)
{
RegionPtr pWinSize;
ScreenPtr pScreen = pWin->drawable.pScreen;
extern RegionPtr CreateUnclippedWinSize();
pWinSize = CreateUnclippedWinSize (pWin);
/* pExposed is window-relative, but at this point
@ -1456,13 +1226,13 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
* window-relative so that region ops involving
* pExposed and pWinSize behave sensibly.
*/
REGION_TRANSLATE(pScreen, pWinSize,
-pWin->drawable.x,
-pWin->drawable.y);
REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
REGION_DESTROY(pScreen, pWinSize);
REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
-pWin->drawable.x, -pWin->drawable.y);
REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
pExposed, pWinSize);
REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
MultibufferExpose (pPrevMultibuffer, pExposed);
REGION_DESTROY(pScreen, pExposed);
REGION_DESTROY(pWin->drawable.pScreen, pExposed);
}
graphicsExpose = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
@ -1590,8 +1360,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
return 0;
/* maybe send event to owner */
if (attempt = TryClientEvents(
bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0))
if ((attempt = TryClientEvents(
bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@ -1602,8 +1372,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
/* maybe send event to other clients */
for (other = pMultibuffer->otherClients; other; other=other->next)
{
if (attempt = TryClientEvents(
rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0))
if ((attempt = TryClientEvents(
rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@ -1664,15 +1434,15 @@ MultibufferExpose (pMultibuffer, pRegion)
/* send UpdateNotify event */
void
MultibufferUpdate (pMultibuffer, time)
MultibufferUpdate (pMultibuffer, time2)
MultibufferPtr pMultibuffer;
CARD32 time;
CARD32 time2;
{
xMbufUpdateNotifyEvent event;
event.type = MultibufferEventBase + MultibufferUpdateNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id;
event.timeStamp = time;
event.timeStamp = time2;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
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

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

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
@ -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 $ */
#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@ -40,17 +42,28 @@ in this Software without prior written authorization from The Open Group.
extern Bool permitOldBugs;
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
MITMiscExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
if (extEntry = AddExtension(MITMISCNAME, 0, 0,
if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode))
MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base;
}
@ -81,7 +94,6 @@ static int
ProcMITGetBugMode(client)
register ClientPtr client;
{
REQUEST(xMITGetBugModeReq);
xMITGetBugModeReply rep;
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
Equipment Corporation.
******************************************************************/
/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.8 2001/08/23 13:01:36 alanh Exp $ */
#include <stdio.h>
#include "X.h"
@ -44,20 +45,16 @@ Equipment Corporation.
#endif
#include "panoramiX.h"
#include "panoramiXproto.h"
#include "panoramiXsrv.h"
#include "globals.h"
/*
/*
* External references for data variables
*/
extern Bool noPanoramiXExtension;
extern Bool PanoramiXVisibilityNotifySent;
extern WindowPtr *WindowTable;
extern int defaultBackingStore;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
extern int (* ProcVector[256]) ();
#if NeedFunctionPrototypes
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
@ -68,50 +65,38 @@ extern int (* ProcVector[256]) ();
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
PROC_EXTERN(PropPanoramiXGetScreenSize);
PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaIsActive);
PROC_EXTERN(ProcXineramaQueryScreens);
static int
#if NeedFunctionPrototypes
SProcPanoramiXQueryVersion (ClientPtr client)
#else
SProcPanoramiXQueryVersion (client)
register ClientPtr client;
#endif
{
register int n;
REQUEST(xPanoramiXQueryVersionReq);
REQUEST(xPanoramiXQueryVersionReq);
register int n;
swaps(&stuff->length,n);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
swaps(&stuff->length,n);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int
#if NeedFunctionPrototypes
SProcPanoramiXGetState(ClientPtr client)
#else
SProcPanoramiXGetState(client)
register ClientPtr client;
#endif
{
REQUEST(xPanoramiXGetStateReq);
register int n;
register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
return ProcPanoramiXGetState(client);
}
static int
#if NeedFunctionPrototypes
SProcPanoramiXGetScreenCount(ClientPtr client)
#else
SProcPanoramixGetScreenCount(client)
register ClientPtr client;
#endif
{
REQUEST(xPanoramiXGetScreenCountReq);
register int n;
register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@ -119,29 +104,43 @@ SProcPanoramixGetScreenCount(client)
}
static int
#if NeedFunctionPrototypes
SProcPanoramiXGetScreenSize(ClientPtr client)
#else
SProcPanoramiXGetScreenSize(client)
register ClientPtr client;
#endif
{
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
register int n;
register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
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
#if NeedFunctionPrototypes
SProcPanoramiXDispatch (ClientPtr client)
#else
SProcPanoramiXDispatch (client)
ClientPtr client;
#endif
{ REQUEST(xReq);
switch (stuff->data)
{
@ -153,6 +152,10 @@ SProcPanoramiXDispatch (client)
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
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.
*/
/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.11 2002/05/31 18:45:53 dawes Exp $ */
#include "dixstruct.h"
#include "extnsionst.h"
@ -50,7 +51,7 @@ extern unsigned char LbxReqCode;
#ifndef DEFAULTPOLICYFILE
# define DEFAULTPOLICYFILE NULL
#endif
#ifdef WIN32
#if defined(WIN32) || defined(__CYGWIN__)
#include <X11/Xos.h>
#undef index
#endif
@ -82,9 +83,6 @@ int (*SwappedUntrustedProcVector[256])(
#endif
);
extern int ProcBadRequest();
/* SecurityAudit
*
* Arguments:
@ -150,7 +148,7 @@ SecurityDeleteAuthorization(value, id)
/* send revoke events */
while (pEventClient = pAuth->eventClients)
while ((pEventClient = pAuth->eventClients))
{
/* send revocation event event */
ClientPtr client = rClient(pEventClient);
@ -318,7 +316,7 @@ static int
ProcSecurityQueryVersion(client)
ClientPtr client;
{
REQUEST(xSecurityQueryVersionReq);
/* REQUEST(xSecurityQueryVersionReq); */
xSecurityQueryVersionReply rep;
/* paranoia: this "can't happen" because this extension is hidden
@ -395,7 +393,6 @@ ProcSecurityGenerateAuthorization(client)
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */
int status; /* return value from os functions */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
@ -788,7 +785,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
Bool untrusted_got_event;
Bool found_event_window;
Mask eventmask;
int reqtype;
int reqtype = 0;
/* trusted clients always allowed to do anything */
if (client->trustLevel == XSecurityClientTrusted)
@ -1361,8 +1358,11 @@ SecurityFreePropertyAccessList()
}
} /* SecurityFreePropertyAccessList */
#ifndef __UNIXOS2__
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
#else
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
#endif
static char *
SecuritySkipWhitespace(p)
@ -1441,7 +1441,6 @@ SecurityParsePropertyAccessRule(p)
char action = SecurityDefaultAction;
char readAction, writeAction, destroyAction;
PropertyAccessPtr pacl, prev, cur;
ATOM atom;
char *mustHaveProperty = NULL;
char *mustHaveValue = NULL;
Bool invalid;
@ -1641,7 +1640,11 @@ SecurityLoadPropertyAccessList()
if (!SecurityPolicyFile)
return;
#ifndef __UNIXOS2__
f = fopen(SecurityPolicyFile, "r");
#else
f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
#endif
if (!f)
{
ErrorF("error opening security policy file %s\n",
@ -1969,7 +1972,7 @@ SecurityExtensionInit()
SecurityEventBase = extEntry->eventBase;
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
SwapSecurityAuthorizationRevokedEvent;
(EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
/* 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
@ -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 $ */
#define NEED_REPLIES
#define NEED_EVENTS
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@ -43,26 +43,101 @@ in this Software without prior written authorization from The Open Group.
#include "shapestr.h"
#include "regionstr.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
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
static int ShapeFreeClient(), ShapeFreeEvents();
static void SendShapeNotify();
static int ProcShapeDispatch(), SProcShapeDispatch();
static void ShapeResetProc(), SShapeNotifyEvent();
static unsigned char ShapeReqCode = 0;
static int ShapeEventBase = 0;
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
* ShapeNotify events. Each client has a resource
@ -91,7 +166,7 @@ typedef struct _ShapeEvent {
void
ShapeExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
ClientType = CreateNewResourceType(ShapeFreeClient);
EventType = CreateNewResourceType(ShapeFreeEvents);
@ -102,7 +177,7 @@ ShapeExtensionInit()
{
ShapeReqCode = (unsigned char)extEntry->base;
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)
ClientPtr client;
WindowPtr pWin;
@ -121,7 +196,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
RegionPtr *destRgnp, srcRgn;
int op;
int xoff, yoff;
RegionPtr (*create)(); /* creates a reasonable *destRgnp */
CreateDftPtr create; /* creates a reasonable *destRgnp */
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@ -133,7 +208,31 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
REGION_DESTROY(pScreen, srcRgn);
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:
if (*destRgnp)
REGION_DESTROY(pScreen, *destRgnp);
@ -204,7 +303,6 @@ static int
ProcShapeQueryVersion (client)
register ClientPtr client;
{
REQUEST(xShapeQueryVersionReq);
xShapeQueryVersionReply rep;
register int n;
@ -228,42 +326,8 @@ ProcShapeQueryVersion (client)
* ProcShapeRectangles
*
*****************/
#ifdef PANORAMIX
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)
register ClientPtr client;
{
@ -274,7 +338,7 @@ ProcShapeRectangles (client)
int nrects, ctype;
RegionPtr srcRgn;
RegionPtr *destRgn;
RegionPtr (*createDefault)();
CreateDftPtr createDefault;
int destBounding;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
@ -324,49 +388,37 @@ ProcShapeRectangles (client)
stuff->xOff, stuff->yOff, createDefault);
}
/**************
* ProcShapeMask
**************/
#ifdef PANORAMIX
static int
ProcPanoramiXShapeMask (client)
ProcPanoramiXShapeRectangles (client)
register ClientPtr client;
{
WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xShapeMaskReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
RegionPtr (*createDefault)();
int destBounding;
REQUEST(xShapeRectanglesReq);
PanoramiXRes *win;
int j, result = 0;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
PanoramiXPmap *pPmap = PanoramiXPmapRoot;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
REQUEST_SIZE_MATCH (xShapeMaskReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
IF_RETURN(!pPanoramiXWin, BadRequest);
PANORAMIXFIND_ID(pPmap, stuff->src);
IF_RETURN(!pPmap, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id;
stuff->src = pPmap->info[j].id;
result = ProcShapeMask (client);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ProcShapeRectangles (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
/**************
* ProcShapeMask
**************/
static int
#endif
ProcShapeMask (client)
register ClientPtr client;
{
@ -376,7 +428,7 @@ ProcShapeMask (client)
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
RegionPtr (*createDefault)();
CreateDftPtr createDefault;
int destBounding;
REQUEST_SIZE_MATCH (xShapeMaskReq);
@ -425,45 +477,45 @@ ProcShapeMask (client)
stuff->xOff, stuff->yOff, createDefault);
}
/************
* ProcShapeCombine
************/
#ifdef PANORAMIX
static int
ProcPanoramiXShapeCombine (client)
ProcPanoramiXShapeMask (client)
register ClientPtr client;
{
WindowPtr pSrcWin, pDestWin;
ScreenPtr pScreen;
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
RegionPtr (*createDefault)();
RegionPtr (*createSrc)();
RegionPtr tmp;
int destBounding;
REQUEST(xShapeMaskReq);
PanoramiXRes *win, *pmap;
int j, result = 0;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_SIZE_MATCH (xShapeMaskReq);
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
IF_RETURN(!pPanoramiXWin, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id;
result = ProcShapeCombine (client);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
return BadWindow;
if(stuff->src != None) {
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);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
/************
* ProcShapeCombine
************/
static int
#endif
ProcShapeCombine (client)
register ClientPtr client;
{
@ -472,8 +524,8 @@ ProcShapeCombine (client)
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
RegionPtr (*createDefault)();
RegionPtr (*createSrc)();
CreateDftPtr createDefault;
CreateDftPtr createSrc;
RegionPtr tmp;
int destBounding;
@ -539,40 +591,41 @@ ProcShapeCombine (client)
stuff->xOff, stuff->yOff, createDefault);
}
/*************
* ProcShapeOffset
*************/
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset (client)
ProcPanoramiXShapeCombine (client)
register ClientPtr client;
{
WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xShapeOffsetReq);
RegionPtr srcRgn;
REQUEST(xShapeCombineReq);
PanoramiXRes *win, *win2;
int j, result = 0;
register int result;
int j;
PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
IF_RETURN(!pPanoramiXWin, BadRequest);
FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
stuff->dest = pPanoramiXWin->info[j].id;
result = ProcShapeOffset (client);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
return BadWindow;
if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
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);
}
return (result);
}
#endif
#ifdef PANORAMIX
int
#else
/*************
* ProcShapeOffset
*************/
static int
#endif
ProcShapeOffset (client)
register ClientPtr client;
{
@ -607,6 +660,32 @@ ProcShapeOffset (client)
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
ProcShapeQueryExtents (client)
register ClientPtr client;
@ -616,6 +695,7 @@ ProcShapeQueryExtents (client)
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
register int n;
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client);
@ -626,9 +706,9 @@ ProcShapeQueryExtents (client)
rep.sequenceNumber = client->sequence;
rep.boundingShaped = (wBoundingShape(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 */
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin));
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = -wBorderWidth (pWin);
@ -640,9 +720,9 @@ ProcShapeQueryExtents (client)
rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1;
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 */
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin));
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = 0;
@ -1001,37 +1081,29 @@ ProcShapeDispatch (client)
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeRectangles (client);
else
return ProcShapeRectangles (client);
#else
return ProcShapeRectangles (client);
#endif
return ProcShapeRectangles (client);
case X_ShapeMask:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeMask (client);
else
return ProcShapeMask (client);
#else
return ProcShapeMask (client);
#endif
return ProcShapeMask (client);
case X_ShapeCombine:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeCombine (client);
else
return ProcShapeCombine (client);
#else
return ProcShapeCombine (client);
#endif
return ProcShapeCombine (client);
case X_ShapeOffset:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeOffset (client);
else
return ProcShapeOffset (client);
#else
return ProcShapeOffset (client);
#endif
return ProcShapeOffset (client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents (client);
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
@ -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 $ */
#include <sys/types.h>
#ifndef Lynx
#include <sys/ipc.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_EVENTS
#include "X.h"
@ -48,6 +56,14 @@ in this Software without prior written authorization from The Open Group.
#define _XSHM_SERVER_
#include "shmstr.h"
#include "Xfuncproto.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
typedef struct _ShmDesc {
struct _ShmDesc *next;
@ -58,21 +74,57 @@ typedef struct _ShmDesc {
unsigned long size;
} ShmDescRec, *ShmDescPtr;
static void miShmPutImage(), fbShmPutImage();
static PixmapPtr fbShmCreatePixmap();
static int ProcShmDispatch(), SProcShmDispatch();
static int ShmDetachSegment();
static void ShmResetProc(), SShmCompletionEvent();
static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(
#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 int ShmCompletionCode;
static int BadShmSegCode;
static RESTYPE ShmSegType, ShmPixType;
int ShmCompletionCode;
int BadShmSegCode;
RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
static int pixmapFormat;
static int shmPixFormat[MAXSCREENS];
static ShmFuncsPtr shmFuncs[MAXSCREENS];
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
#ifdef PIXPRIV
static int shmPixmapPrivate;
#endif
static ShmFuncs miFuncs = {NULL, miShmPutImage};
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
ShmExtensionInit()
{
ExtensionEntry *extEntry;
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;
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])
shmFuncs[i] = &miFuncs;
if (!shmFuncs[i]->CreatePixmap)
@ -129,13 +221,29 @@ ShmExtensionInit()
sharedPixmaps = xFalse;
pixmapFormat = 0;
}
}
if (!pixmapFormat)
}
if (!pixmapFormat)
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
}
}
ShmSegType = CreateNewResourceType(ShmDetachSegment);
ShmPixType = CreateNewResourceType(ShmDetachSegment);
if (ShmSegType && ShmPixType &&
if (ShmSegType &&
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
ProcShmDispatch, SProcShmDispatch,
ShmResetProc, StandardMinorOpcode)))
@ -143,7 +251,7 @@ ShmExtensionInit()
ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase;
EventSwapVector[ShmCompletionCode] = SShmCompletionEvent;
EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
}
}
@ -177,6 +285,41 @@ ShmSetPixmapFormat(pScreen, 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
ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen;
@ -188,7 +331,6 @@ static int
ProcShmQueryVersion(client)
register ClientPtr client;
{
REQUEST(xShmQueryVersionReq);
xShmQueryVersionReply rep;
register int n;
@ -214,6 +356,47 @@ ProcShmQueryVersion(client)
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
ProcShmAttach(client)
register ClientPtr client;
@ -252,6 +435,17 @@ ProcShmAttach(client)
xfree(shmdesc);
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->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
@ -342,7 +536,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
/*XXX*/depth, PixmapBytePad(w, depth), (pointer)data);
BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
if (!pPixmap)
return;
if (format == XYBitmap)
@ -358,6 +552,251 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, 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
ProcShmPutImage(client)
register ClientPtr client;
@ -365,11 +804,6 @@ ProcShmPutImage(client)
register GCPtr pGC;
register DrawablePtr pDraw;
long length;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
long lengthProto;
char *tmpImage;
int tmpAlloced = 0;
#endif
ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq);
@ -383,9 +817,6 @@ ProcShmPutImage(client)
if (stuff->depth != 1)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
#endif
}
else if (stuff->format == XYPixmap)
{
@ -393,19 +824,12 @@ ProcShmPutImage(client)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
length *= stuff->depth;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
lengthProto *= stuff->depth;
#endif
}
else if (stuff->format == ZPixmap)
{
if (pDraw->depth != stuff->depth)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth);
#endif
}
else
{
@ -413,13 +837,8 @@ ProcShmPutImage(client)
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,
client);
#endif
if (stuff->srcX > stuff->totalWidth)
{
client->errorValue = stuff->srcX;
@ -441,63 +860,6 @@ ProcShmPutImage(client)
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)) ||
((stuff->format != ZPixmap) &&
(stuff->srcX < screenInfo.bitmapScanlinePad) &&
@ -509,11 +871,7 @@ ProcShmPutImage(client)
stuff->dstX, stuff->dstY,
stuff->totalWidth, stuff->srcHeight,
stuff->srcX, stuff->format,
#ifdef INTERNAL_VS_EXTERNAL_PADDING
tmpImage +
#else
shmdesc->addr + stuff->offset +
#endif
(stuff->srcY * length));
else
(*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
@ -522,12 +880,7 @@ ProcShmPutImage(client)
stuff->srcX, stuff->srcY,
stuff->srcWidth, stuff->srcHeight,
stuff->dstX, stuff->dstY,
#ifdef INTERNAL_VS_EXTERNAL_PADDING
tmpImage);
#else
shmdesc->addr + stuff->offset);
#endif
if (stuff->sendEvent)
{
@ -543,12 +896,7 @@ ProcShmPutImage(client)
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
#ifdef INTERNAL_VS_EXTERNAL_PADDING
if (tmpAlloced)
DEALLOCATE_LOCAL(tmpImage);
#endif
return (client->noClientException);
return (client->noClientException);
}
@ -558,17 +906,11 @@ ProcShmGetImage(client)
register ClientPtr client;
{
register DrawablePtr pDraw;
long lenPer, length;
Mask plane;
long lenPer = 0, length;
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int n;
#ifdef INTERNAL_VS_EXTERNAL_PADDING
long widthBytesLine,widthBytesLineProto;
long lenPerProto,lengthProto;
char *tmpImage;
int tmpAlloced = 0;
#endif
REQUEST(xShmGetImageReq);
@ -616,43 +958,18 @@ ProcShmGetImage(client)
xgi.depth = pDraw->depth;
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;
#endif
}
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;
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
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);
xgi.size = length;
#endif
if (length == 0)
{
@ -660,105 +977,25 @@ ProcShmGetImage(client)
}
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,
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
#endif
}
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;
for (; plane; plane >>= 1)
{
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,
stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
length += lenPer;
#endif
}
}
}
@ -771,11 +1008,6 @@ ProcShmGetImage(client)
}
WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
#ifdef INTERNAL_VS_EXTERNAL_PADDING
if (tmpAlloced)
DEALLOCATE_LOCAL(tmpImage);
#endif
return(client->noClientException);
}
@ -794,8 +1026,10 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
return NullPixmap;
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 pPixmap;
}
@ -841,14 +1075,15 @@ CreatePmap:
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 = stuff->pid;
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
{
shmdesc->refcnt++;
if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc))
return(client->noClientException);
FreeResource(stuff->pid, RT_NONE);
return(client->noClientException);
}
}
return (BadAlloc);
@ -868,11 +1103,23 @@ ProcShmDispatch (client)
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmPutImage(client);
#endif
return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmGetImage(client);
#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
return ProcShmCreatePixmap(client);
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShmCreatePixmap(client);
#endif
return ProcShmCreatePixmap(client);
default:
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
*/
/* $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 */
#include "sleepuntil.h"
#include "X.h"
#include "Xmd.h"
#include "misc.h"
@ -41,7 +43,13 @@ typedef struct _Sertafied {
TimeStamp revive;
ClientPtr pClient;
XID id;
void (*notifyFunc)();
void (*notifyFunc)(
#if NeedNestedPrototypes
ClientPtr /* client */,
pointer /* closure */
#endif
);
pointer closure;
} SertafiedRec, *SertafiedPtr;
@ -49,11 +57,35 @@ static SertafiedPtr pPending;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
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)
ClientPtr client;
TimeStamp *revive;
@ -152,7 +184,7 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pointer LastSelectMask;
{
SertafiedPtr pReq, pNext;
unsigned long newdelay, olddelay;
unsigned long delay;
TimeStamp now;
if (!pPending)
@ -177,8 +209,8 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pReq = pPending;
if (!pReq)
return;
newdelay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay (wt, newdelay);
delay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay (wt, delay);
}
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.
*/
/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.11 2001/12/14 19:58:51 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "Xmd.h"
@ -67,6 +67,15 @@ PERFORMANCE OF THIS SOFTWARE.
#include "sync.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
*/
@ -87,13 +96,254 @@ static SyncCounter **SysCounterList = NULL;
#define XSyncCAAllTrigger \
(XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
static void SyncComputeBracketValues(
static int
FreeAlarm(
#if NeedFunctionPrototypes
SyncCounter * /* pCounter */,
Bool /* startOver */
pointer /* addr */,
XID /* id */
#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
* interested in the counter. The two functions below are used to
* delete and add triggers on this list.
@ -462,26 +712,26 @@ SyncAlarmTriggerFired(pTrigger)
{
Bool overflow;
CARD64 oldvalue;
SyncTrigger *pTrigger = &pAlarm->trigger;
SyncTrigger *paTrigger = &pAlarm->trigger;
/* "The alarm is updated by repeatedly adding delta to the
* value of the trigger and re-initializing it until it
* becomes FALSE."
*/
oldvalue = pTrigger->test_value;
oldvalue = paTrigger->test_value;
/* XXX really should do something smarter here */
do
{
XSyncValueAdd(&pTrigger->test_value, pTrigger->test_value,
XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
pAlarm->delta, &overflow);
} while (!overflow &&
(*pTrigger->CheckTrigger)(pTrigger,
pTrigger->pCounter->value));
(*paTrigger->CheckTrigger)(paTrigger,
paTrigger->pCounter->value));
new_test_value = pTrigger->test_value;
pTrigger->test_value = oldvalue;
new_test_value = paTrigger->test_value;
paTrigger->test_value = oldvalue;
/* "If this update would cause value to fall outside the range
* for an INT64...no change is made to value (test-value) and
@ -710,7 +960,6 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
Mask mask;
CARD32 *values;
{
SyncAlarmClientList *pClients;
int status;
XSyncCounter counter;
Mask origmask = mask;
@ -719,9 +968,9 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
while (mask)
{
int index = lowbit(mask);
mask &= ~index;
switch (index)
int index2 = lowbit(mask);
mask &= ~index2;
switch (index2)
{
case XSyncCACounter:
mask &= ~XSyncCACounter;
@ -998,7 +1247,6 @@ FreeAlarm(addr, id)
XID id;
{
SyncAlarm *pAlarm = (SyncAlarm *) addr;
SyncAlarmClientList *pClient;
pAlarm->state = XSyncAlarmDestroyed;
@ -1139,7 +1387,6 @@ static int
ProcSyncInitialize(client)
ClientPtr client;
{
REQUEST(xSyncInitializeReq);
xSyncInitializeReply rep;
int n;
@ -1166,10 +1413,9 @@ static int
ProcSyncListSystemCounters(client)
ClientPtr client;
{
REQUEST(xSyncListSystemCountersReq);
xSyncListSystemCountersReply rep;
int i, len;
xSyncSystemCounter *list, *walklist;
xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
@ -1318,7 +1564,6 @@ ProcSyncCreateCounter(client)
ClientPtr client;
{
REQUEST(xSyncCreateCounterReq);
SyncCounter *pCounter;
CARD64 initial;
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
@ -1440,9 +1685,8 @@ ProcSyncAwait(client)
{
REQUEST(xSyncAwaitReq);
int len, items;
int n, i;
int i;
xSyncWaitCondition *pProtocolWaitConds;
int ret;
SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait;
int status;
@ -1606,7 +1850,6 @@ ProcSyncCreateAlarm(client)
REQUEST(xSyncCreateAlarmReq);
SyncAlarm *pAlarm;
int status;
int i;
unsigned long len, vmask;
SyncTrigger *pTrigger;
@ -2063,8 +2306,6 @@ static int
SProcSyncDispatch(client)
ClientPtr client;
{
int n;
REQUEST(xReq);
switch (stuff->data)
@ -2154,8 +2395,6 @@ SyncResetProc(extEntry)
}
static void SyncInitServerTime();
/*
* ** Initialise the extension.
*/
@ -2188,8 +2427,8 @@ SyncExtensionInit()
SyncReqCode = extEntry->base;
SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase;
EventSwapVector[SyncEventBase + XSyncCounterNotify] = SCounterNotifyEvent;
EventSwapVector[SyncEventBase + XSyncAlarmNotify] = SAlarmNotifyEvent;
EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
/*
* 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 XSyncValue Now;

View File

@ -26,28 +26,44 @@ other dealings in this Software without prior written authorization
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 "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include "xcmiscstr.h"
static unsigned char XCMiscCode;
static int ProcXCMiscDispatch(), SProcXCMiscDispatch();
static void XCMiscResetProc();
extern void Swap32Write(); /* XXX should be in header file */
static void XCMiscResetProc(
#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
XCMiscExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
if (extEntry = AddExtension(XCMiscExtensionName, 0, 0,
if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode))
XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
}
@ -63,7 +79,6 @@ static int
ProcXCMiscGetVersion(client)
register ClientPtr client;
{
REQUEST(xXCMiscGetVersionReq);
xXCMiscGetVersionReply rep;
register int n;
@ -86,7 +101,6 @@ static int
ProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
REQUEST(xXCMiscGetXIDRangeReq);
xXCMiscGetXIDRangeReply rep;
register int n;
XID min_id, max_id;
@ -137,7 +151,7 @@ ProcXCMiscGetXIDList(client)
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
if (count)
{
client->pSwapReplyFunc = Swap32Write;
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), 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.
*/
/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.7 2001/12/14 19:58:51 dawes Exp $ */
#include "X.h"
#define NEED_EVENTS
@ -37,6 +38,8 @@ from The Open Group.
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#define _XTEST_SERVER_
#include "XTest.h"
#include "xteststr.h"
@ -44,27 +47,49 @@ from The Open Group.
#include "XI.h"
#include "XIproto.h"
#define EXTENSION_EVENT_BASE 64
#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
static unsigned char XTestReqCode;
static int ProcXTestDispatch(), SProcXTestDispatch();
static void XTestResetProc();
static int XTestSwapFakeInput();
CursorPtr GetSpriteCursor();
WindowPtr GetCurrentRootWindow();
#ifdef XINPUT
extern int DeviceValuator;
DeviceIntPtr LookupDeviceIntRec();
#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
XTestExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
ExtensionEntry *extEntry;
if (extEntry = AddExtension(XTestExtensionName, 0, 0,
if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode))
XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base;
}
@ -79,7 +104,6 @@ static int
ProcXTestGetVersion(client)
register ClientPtr client;
{
REQUEST(xXTestGetVersionReq);
xXTestGetVersionReply rep;
register int n;
@ -142,12 +166,12 @@ ProcXTestFakeInput(client)
int nev;
int n;
xEvent *ev;
DeviceIntPtr dev;
DeviceIntPtr dev = NULL;
WindowPtr root;
int type;
#ifdef XINPUT
Bool extension = FALSE;
deviceValuator *dv;
deviceValuator *dv = NULL;
int base;
int *values;
#endif /* XINPUT */
@ -468,7 +492,7 @@ XTestSwapFakeInput(client, req)
register int nev;
register xEvent *ev;
xEvent sev;
void (*proc)(), NotImplemented();
EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
@ -476,7 +500,7 @@ XTestSwapFakeInput(client, req)
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) {
if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}

View File

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

View File

@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.3 2001/12/14 19:58:52 dawes Exp $ */
/*****************************************************************************
* include files
@ -72,6 +73,8 @@ University of California.
#define XTestSERVER_SIDE
#include "xtestext1.h"
#include "xtest1dd.h"
/*****************************************************************************
* defines
****************************************************************************/
@ -80,10 +83,6 @@ University of California.
* externals
****************************************************************************/
/*
* holds the addresses of the routines that handle byte-swapping of replys
*/
extern void (* ReplySwapVector[256]) ();
/*
* id of client using XTestGetInput
*
@ -137,31 +136,44 @@ static XID current_client_id;
* function declarations
****************************************************************************/
static int ProcXTestDispatch();
static int SProcXTestDispatch();
static void XTestResetProc();
static int ProcTestFakeInput();
static int SProcTestFakeInput();
static int ProcTestGetInput();
static int SProcTestGetInput();
static int ProcTestStopInput();
static int SProcTestStopInput();
static int ProcTestReset();
static int SProcTestReset();
static int ProcTestQueryInputSize();
static int SProcTestQueryInputSize();
static void SReplyXTestDispatch();
static void SEventXTestDispatch();
void NotImplemented();
static DISPATCH_PROC(ProcXTestDispatch);
static DISPATCH_PROC(SProcXTestDispatch);
static DISPATCH_PROC(ProcTestFakeInput);
static DISPATCH_PROC(SProcTestFakeInput);
static DISPATCH_PROC(ProcTestGetInput);
static DISPATCH_PROC(SProcTestGetInput);
static DISPATCH_PROC(ProcTestStopInput);
static DISPATCH_PROC(SProcTestStopInput);
static DISPATCH_PROC(ProcTestReset);
static DISPATCH_PROC(SProcTestReset);
static DISPATCH_PROC(ProcTestQueryInputSize);
static DISPATCH_PROC(SProcTestQueryInputSize);
void abort_play_back();
void return_input_array_size();
void steal_input();
void stop_stealing_input();
void flush_input_actions();
void parse_fake_input();
static void XTestResetProc(
#if NeedFunctionPrototypes
ExtensionEntry * /* unused */
#endif
);
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
*/
ExtensionEntry *extEntry;
/*
* This routine adds the extension to the server extension table.
*/
ExtensionEntry *AddExtension();
extEntry = AddExtension(XTestEXTENSION_NAME,
XTestEVENT_COUNT,
@ -213,7 +221,7 @@ XTestExtension1Init()
* install the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
ReplySwapVector[XTestReqCode] = SReplyXTestDispatch;
ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
/*
* install the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table
@ -647,7 +655,6 @@ static int
ProcTestStopInput(client)
register ClientPtr client;
{
REQUEST(xTestStopInputReq);
REQUEST_SIZE_MATCH(xTestStopInputReq);
if (on_steal_input && (current_xtest_client == client))
{
@ -686,7 +693,6 @@ static int
ProcTestReset(client)
register ClientPtr client;
{
REQUEST(xTestResetReq);
REQUEST_SIZE_MATCH(xTestResetReq);
on_steal_input = FALSE;
exclusive_steal = FALSE;
@ -711,7 +717,6 @@ static int
ProcTestQueryInputSize(client)
register ClientPtr client;
{
REQUEST(xTestQueryInputSizeReq);
REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
/*
* defined in xtest1dd.c
@ -728,14 +733,16 @@ ProcTestQueryInputSize(client)
* connected to it. It must put eveything back the way it was before
* this extension was installed.
*/
/*ARGSUSED*/
static void
XTestResetProc()
XTestResetProc(unused)
ExtensionEntry * unused;
{
/*
* remove the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
ReplySwapVector[XTestReqCode] = NotImplemented;
ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
/*
* remove the routine to handle byte-swapping the events
* 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
* 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.
********************************************************/
/* $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 "XIproto.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "allowev.h"
#include "dixevents.h"
/***********************************************************************
*
@ -96,7 +99,6 @@ ProcXAllowDeviceEvents(client)
{
TimeStamp time;
DeviceIntPtr thisdev;
void AllowSome ();
REQUEST(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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h" /* control constants */
#include "XIstubs.h"
extern int IReqCode;
extern int BadDevice, DeviceBusy;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "chgdctl.h"
/***********************************************************************
*
@ -91,10 +94,12 @@ SProcXChangeDeviceControl(client)
*
*/
int
ProcXChangeDeviceControl(client)
ClientPtr client;
{
int i, len, status;
unsigned len;
int i, status;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
@ -150,7 +155,7 @@ ProcXChangeDeviceControl(client)
BadValue);
return Success;
}
status = ChangeDeviceControl(client, dev, r);
status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
if (status == Success)
{
a = &dev->valuator->axes[r->first_valuator];
@ -195,6 +200,7 @@ ProcXChangeDeviceControl(client)
*
*/
void
SRepXChangeDeviceControl (client, size, rep)
ClientPtr client;
int size;

View File

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

View File

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

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern int DeviceMappingNotify;
DeviceIntPtr LookupDeviceIntRec();
#include "chgkmap.h"
/***********************************************************************
*
@ -99,6 +101,7 @@ SProcXChangeDeviceKeyMapping(client)
*
*/
int
ProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
@ -120,7 +123,7 @@ ProcXChangeDeviceKeyMapping(client)
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
&stuff[1]);
(KeySym *)&stuff[1]);
if (ret != Success)
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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
extern int BadMode;
extern int BadClass;
extern int IReqCode;
DeviceIntPtr LookupDeviceIntRec();
#include "exevents.h"
#include "exglobals.h"
#include "chgprop.h"
#include "grabdev.h"
/***********************************************************************
*
@ -100,6 +104,7 @@ SProcXChangeDeviceDontPropagateList(client)
*
*/
int
ProcXChangeDeviceDontPropagateList (client)
register ClientPtr client;
{

View File

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

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern ScreenInfo screenInfo;
extern WindowPtr *WindowTable;
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "closedev.h"
/***********************************************************************
*
@ -137,6 +137,7 @@ ProcXCloseDevice(client)
*
*/
void
DeleteEventsFromChildren(dev, p1, client)
DeviceIntPtr dev;
WindowPtr p1;
@ -160,6 +161,7 @@ DeleteEventsFromChildren(dev, p1, client)
*
*/
void
DeleteDeviceEvents (dev, pWin, client)
DeviceIntPtr dev;
WindowPtr pWin;
@ -169,7 +171,7 @@ DeleteDeviceEvents (dev, pWin, client)
OtherInputMasks *pOthers;
GrabPtr grab, next;
if (pOthers=wOtherInputMasks(pWin))
if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others;
others = others->next)
if (SameClient(others,client))

View File

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

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 NEED_EVENTS
#define NEED_REPLIES
#include "X.h"
#include "Xproto.h"
#include "inputstr.h"
@ -63,6 +65,51 @@ SOFTWARE.
#include "XI.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;
int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
@ -141,10 +188,8 @@ int RT_INPUTCLIENT;
*
*/
extern void (* ReplySwapVector[256]) ();
extern void (* EventSwapVector[128]) ();
extern XExtensionVersion AllExtensionVersions[];
extern InputInfo inputInfo;
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 =
{XI_Present,
XI_Add_XChangeDeviceControl_Major,
@ -177,10 +216,8 @@ static XExtensionVersion thisversion =
void
XInputExtensionInit()
{
ExtensionEntry *extEntry, *AddExtension();
int XShutDownDevice();
int InputClientGone();
{
ExtensionEntry *extEntry;
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
@ -189,9 +226,9 @@ XInputExtensionInit()
IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion;
MakeDeviceTypeAtoms ();
RT_INPUTCLIENT = CreateNewResourceType(InputClientGone);
RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
FixExtensionEvents (extEntry);
ReplySwapVector[IReqCode] = SReplyIDispatch;
ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@ -224,7 +261,7 @@ XInputExtensionInit()
int
ProcIDispatch (client)
register ClientPtr client;
{
{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client));
@ -315,7 +352,7 @@ ProcIDispatch (client)
int
SProcIDispatch(client)
register ClientPtr client;
{
{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
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
SReplyIDispatch (client, len, rep)
ClientPtr client;
int len;
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)
SRepXGetExtensionVersion (client, len, rep);
SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices (client, len, rep);
SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice (client, len, rep);
SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode (client, len, rep);
SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents (client, len, rep);
SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
SRepXGetDeviceDontPropagateList (client, len, rep);
SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents (client, len, rep);
SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice)
SRepXChangeKeyboardDevice (client, len, rep);
SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice)
SRepXChangePointerDevice (client, len, rep);
SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice (client, len, rep);
SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus (client, len, rep);
SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl (client, len, rep);
SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping (client, len, rep);
SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping (client, len, rep);
SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping (client, len, rep);
SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping (client, len, rep);
SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping (client, len, rep);
SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState (client, len, rep);
SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators (client, len, rep);
SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl (client, len, rep);
SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl (client, len, rep);
SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
else
{
FatalError("XINPUT confused sending swapped reply");
@ -461,15 +503,17 @@ SReplyIDispatch (client, len, rep)
*
* Swap any events defined in this extension.
*/
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
void
SEventIDispatch (from, to)
xEvent *from;
xEvent *to;
{
{
int type = from->u.u.type & 0177;
if (type == DeviceValuator)
SEventDeviceValuator (from, to);
DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress)
{
SKeyButtonPtrEvent (from, to);
@ -496,9 +540,9 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceFocusIn)
SEventFocus (from, to);
DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut)
SEventFocus (from, to);
DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn)
{
SKeyButtonPtrEvent (from, to);
@ -510,15 +554,15 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceStateNotify)
SDeviceStateNotifyEvent (from, to);
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify)
SDeviceKeyStateNotifyEvent (from, to);
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify)
SDeviceButtonStateNotifyEvent (from, to);
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify)
SDeviceMappingNotifyEvent (from, to);
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify)
SChangeDeviceNotifyEvent (from, to);
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else
{
FatalError("XInputExtension: Impossible event!\n");
@ -531,6 +575,7 @@ SEventIDispatch (from, to)
*
*/
void
SEventDeviceValuator (from, to)
deviceValuator *from;
deviceValuator *to;
@ -549,10 +594,11 @@ SEventDeviceValuator (from, to)
}
}
void
SEventFocus (from, to)
deviceFocus *from;
deviceFocus *to;
{
{
register char n;
*to = *from;
@ -561,10 +607,11 @@ SEventFocus (from, to)
swapl(&to->window, n);
}
void
SDeviceStateNotifyEvent (from, to)
deviceStateNotify *from;
deviceStateNotify *to;
{
{
register int i;
register char n;
INT32 *ip B32;
@ -579,30 +626,33 @@ SDeviceStateNotifyEvent (from, to)
}
}
void
SDeviceKeyStateNotifyEvent (from, to)
deviceKeyStateNotify *from;
deviceKeyStateNotify *to;
{
{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
void
SDeviceButtonStateNotifyEvent (from, to)
deviceButtonStateNotify *from;
deviceButtonStateNotify *to;
{
{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
void
SChangeDeviceNotifyEvent (from, to)
changeDeviceNotify *from;
changeDeviceNotify *to;
{
{
register char n;
*to = *from;
@ -610,10 +660,11 @@ SChangeDeviceNotifyEvent (from, to)
swapl(&to->time, n);
}
void
SDeviceMappingNotifyEvent (from, to)
deviceMappingNotify *from;
deviceMappingNotify *to;
{
{
register char n;
*to = *from;
@ -627,14 +678,11 @@ SDeviceMappingNotifyEvent (from, to)
*
*/
void
FixExtensionEvents (extEntry)
ExtensionEntry *extEntry;
{
Mask mask, GetNextExtEventMask();
void SetMaskForExtEvent();
void SetEventInfo();
void AllowPropagateSuppress();
void SetExclusiveAccess();
{
Mask mask;
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
@ -733,8 +781,9 @@ FixExtensionEvents (extEntry)
*
*/
void
RestoreExtensionEvents ()
{
{
int i;
IReqCode = 0;
@ -781,10 +830,11 @@ RestoreExtensionEvents ()
*/
void
IResetProc()
IResetProc(unused)
ExtensionEntry *unused;
{
ReplySwapVector[IReqCode] = NotImplemented;
ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented;
@ -809,12 +859,12 @@ IResetProc()
*
*/
int
void
AssignTypeAndName (dev, type, name)
DeviceIntPtr dev;
Atom type;
char *name;
{
{
dev->type = type;
dev->name = (char *) xalloc(strlen(name)+1);
strcpy (dev->name, name);
@ -826,7 +876,7 @@ AssignTypeAndName (dev, type, name)
*
*/
int
void
MakeDeviceTypeAtoms ()
{
int i;
@ -844,9 +894,14 @@ MakeDeviceTypeAtoms ()
*/
DeviceIntPtr
#if NeedFunctionPrototypes
LookupDeviceIntRec (
CARD8 id)
#else
LookupDeviceIntRec (id)
CARD8 id;
{
#endif
{
DeviceIntPtr dev;
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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "getbmap.h"
/***********************************************************************
*
@ -88,6 +89,7 @@ SProcXGetDeviceButtonMapping(client)
*
*/
int
ProcXGetDeviceButtonMapping (client)
register ClientPtr client;
{
@ -134,6 +136,7 @@ ProcXGetDeviceButtonMapping (client)
*
*/
void
SRepXGetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
void CopySwapDeviceResolution();
#include "getdctl.h"
/***********************************************************************
*
@ -92,6 +92,7 @@ SProcXGetDeviceControl(client)
*
*/
int
ProcXGetDeviceControl(client)
ClientPtr client;
{
@ -134,7 +135,7 @@ ProcXGetDeviceControl(client)
return Success;
}
buf = (char *) Xalloc (total_length);
buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
@ -156,7 +157,7 @@ ProcXGetDeviceControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
Xfree (savbuf);
xfree (savbuf);
return Success;
}
@ -210,6 +211,7 @@ CopySwapDeviceResolution (client, v, buf, length)
*
*/
void
SRepXGetDeviceControl (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
void CopySwapKbdFeedback();
void CopySwapPtrFeedback();
void CopySwapIntegerFeedback();
void CopySwapStringFeedback();
void CopySwapLedFeedback();
void CopySwapBellFeedback();
#include "getfctl.h"
/***********************************************************************
*
@ -95,6 +90,7 @@ SProcXGetFeedbackControl(client)
*
*/
int
ProcXGetFeedbackControl(client)
ClientPtr client;
{
@ -165,7 +161,7 @@ ProcXGetFeedbackControl(client)
return Success;
}
buf = (char *) Xalloc (total_length);
buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
@ -190,7 +186,7 @@ ProcXGetFeedbackControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
Xfree (savbuf);
xfree (savbuf);
return Success;
}
@ -407,6 +403,7 @@ CopySwapBellFeedback (client, b, buf)
*
*/
void
SRepXGetFeedbackControl (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "getfocus.h"
/***********************************************************************
*
@ -136,6 +137,7 @@ ProcXGetDeviceFocus(client)
*
*/
void
SRepXGetDeviceFocus (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "getkmap.h"
/***********************************************************************
*
@ -89,10 +91,10 @@ SProcXGetDeviceKeyMapping(client)
*
*/
int
ProcXGetDeviceKeyMapping(client)
register ClientPtr client;
{
extern void CopySwap32Write();
xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev;
KeySymsPtr k;
@ -140,7 +142,7 @@ ProcXGetDeviceKeyMapping(client)
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = CopySwap32Write;
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(
client,
k->mapWidth * stuff->count * sizeof(KeySym),
@ -157,6 +159,7 @@ ProcXGetDeviceKeyMapping(client)
*
*/
void
SRepXGetDeviceKeyMapping (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h" /* Request macro */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "getmmap.h"
/***********************************************************************
*
@ -89,6 +90,7 @@ SProcXGetDeviceModifierMapping(client)
*
*/
int
ProcXGetDeviceModifierMapping(client)
ClientPtr client;
{
@ -138,6 +140,7 @@ ProcXGetDeviceModifierMapping(client)
*
*/
void
SRepXGetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.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[];
DeviceIntPtr LookupDeviceIntRec();
extern int ExtEventIndex;
/***********************************************************************
*
@ -91,16 +96,15 @@ SProcXGetDeviceDontPropagateList(client)
*
*/
int
ProcXGetDeviceDontPropagateList (client)
register ClientPtr client;
{
CARD16 count = 0;
int i;
XEventClass *buf, *tbuf;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
XEventClass *ClassFromMask ();
void Swap32Write();
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
@ -121,7 +125,7 @@ ProcXGetDeviceDontPropagateList (client)
return Success;
}
if (others = wOtherInputMasks(pWin))
if ((others = wOtherInputMasks(pWin)) != 0)
{
for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
@ -129,7 +133,7 @@ ProcXGetDeviceDontPropagateList (client)
if (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;
tbuf = buf;
@ -144,9 +148,9 @@ ProcXGetDeviceDontPropagateList (client)
if (count)
{
client->pSwapReplyFunc = Swap32Write;
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
Xfree (buf);
xfree (buf);
}
return Success;
}
@ -169,7 +173,6 @@ XEventClass
int i,j;
int id = maskndx;
Mask tmask = 0x80000000;
extern int ExtEventIndex;
for (i=0; i<32; i++,tmask>>=1)
if (tmask & mask)
@ -193,6 +196,7 @@ XEventClass
*
*/
void
SRepXGetDeviceDontPropagateList (client, size, rep)
ClientPtr client;
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
@ -60,10 +61,13 @@ SOFTWARE.
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
extern int IReqCode;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "getprop.h"
#include "getselev.h"
/***********************************************************************
*
@ -99,11 +103,9 @@ ProcXGetSelectedExtensionEvents(client)
int total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf;
XEventClass *buf = NULL;
XEventClass *tclient;
XEventClass *aclient;
XEventClass *ClassFromMask ();
void Swap32Write();
OtherInputMasks *pOthers;
InputClientsPtr others;
@ -124,7 +126,7 @@ ProcXGetSelectedExtensionEvents(client)
return Success;
}
if (pOthers=wOtherInputMasks(pWin))
if ((pOthers = wOtherInputMasks(pWin)) != 0)
{
for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++)
@ -143,7 +145,7 @@ ProcXGetSelectedExtensionEvents(client)
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass);
rep.length = (total_length + 3) >> 2;
buf = (XEventClass *) Xalloc (total_length);
buf = (XEventClass *) xalloc (total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
@ -160,9 +162,9 @@ ProcXGetSelectedExtensionEvents(client)
if (total_length)
{
client->pSwapReplyFunc = Swap32Write;
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf);
Xfree (buf);
xfree (buf);
}
return Success;
}
@ -174,6 +176,7 @@ ProcXGetSelectedExtensionEvents(client)
*
*/
void
SRepXGetSelectedExtensionEvents (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.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];
/***********************************************************************
@ -90,6 +93,7 @@ SProcXGetExtensionVersion(client)
*
*/
int
ProcXGetExtensionVersion (client)
register ClientPtr client;
{
@ -133,6 +137,7 @@ ProcXGetExtensionVersion (client)
*
*/
void
SRepXGetExtensionVersion (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.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 void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
extern int ExtEventIndex;
/***********************************************************************
*
@ -171,7 +174,6 @@ CreateMaskFromList (client, list, count, mask, dev, req)
int i,j;
int device;
DeviceIntPtr tdev;
extern int ExtEventIndex;
for (i=0; i<EMASKSIZE; i++)
{
@ -212,6 +214,7 @@ CreateMaskFromList (client, list, count, mask, dev, req)
*
*/
void
SRepXGrabDevice (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "grabdev.h"
#include "grabdevb.h"
/***********************************************************************
*
@ -154,7 +157,7 @@ ProcXGrabDeviceButton(client)
return Success;
ret = GrabButton(client, dev, stuff->this_device_mode,
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);
if (ret != Success)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadClass;
extern int BadDevice;
extern InputInfo inputInfo;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "grabdev.h"
#include "grabdevk.h"
/***********************************************************************
*

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "gtmotion.h"
/***********************************************************************
*
@ -97,11 +99,11 @@ ProcXGetDeviceMotionEvents(client)
{
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
int i, j, num_events, axes, size, tsize;
unsigned long i;
int num_events, axes, size = 0, tsize;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;
void XSwapTimeCoordWrite();
int length = 0;
ValuatorClassPtr v;
@ -192,6 +194,7 @@ ProcXGetDeviceMotionEvents(client)
*
*/
void
SRepXGetDeviceMotionEvents (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.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 */
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)
register ClientPtr client;
{
@ -114,7 +108,6 @@ ProcXListInputDevices (client)
xDeviceInfo *dev;
DeviceIntPtr d;
REQUEST(xListInputDevicesReq);
REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep.repType = X_Reply;
@ -131,7 +124,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
devbuf = (char *) Xalloc (total_length);
devbuf = (char *) xalloc (total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@ -146,7 +139,7 @@ ProcXListInputDevices (client)
rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
Xfree (savbuf);
xfree (savbuf);
return Success;
}
@ -396,6 +389,7 @@ CopySwapValuatorClass (client, v, buf)
*
*/
void
SRepXListInputDevices (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#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 InputInfo inputInfo;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@ -102,7 +104,6 @@ ProcXOpenDevice(client)
int status = Success;
xOpenDeviceReply rep;
DeviceIntPtr dev;
void OpenInputDevice();
REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq);
@ -186,6 +187,7 @@ ProcXOpenDevice(client)
*
*/
void
SRepXOpenDevice (client, size, rep)
ClientPtr client;
int size;

View File

@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "queryst.h"
/***********************************************************************
*
@ -129,7 +131,7 @@ ProcXQueryDeviceState(client)
(v->numAxes * sizeof(int)));
num_classes++;
}
buf = (char *) Xalloc (total_length);
buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
@ -184,7 +186,7 @@ ProcXQueryDeviceState(client)
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient (client, total_length, savbuf);
Xfree (savbuf);
xfree (savbuf);
return Success;
}
@ -195,6 +197,7 @@ ProcXQueryDeviceState(client)
*
*/
void
SRepXQueryDeviceState (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.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 ExtValidMasks[];
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@ -137,7 +142,7 @@ ProcXSelectExtensionEvent (client)
for (i=0; i<EMASKSIZE; i++)
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)
{
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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
extern void (* EventSwapVector[128]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "grabdev.h"
#include "sendexev.h"
extern int lastEvent; /* Defined in extension.c */
/***********************************************************************
*
@ -83,7 +87,7 @@ SProcXSendExtensionEvent(client)
register int i;
xEvent eventT;
xEvent *eventP;
void (*proc)(), NotImplemented();
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length, n);
@ -116,11 +120,11 @@ SProcXSendExtensionEvent(client)
*
*/
int
ProcXSendExtensionEvent (client)
register ClientPtr client;
{
int ret;
extern int lastEvent; /* Defined in extension.c */
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
@ -163,7 +167,7 @@ ProcXSendExtensionEvent (client)
return Success;
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));
if (ret != Success)

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern int DeviceMappingNotify;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "setbmap.h"
/***********************************************************************
*
@ -92,6 +93,7 @@ SProcXSetDeviceButtonMapping(client)
*
*/
int
ProcXSetDeviceButtonMapping (client)
register ClientPtr client;
{
@ -124,7 +126,7 @@ ProcXSetDeviceButtonMapping (client)
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)
{
@ -150,6 +152,7 @@ ProcXSetDeviceButtonMapping (client)
*
*/
void
SRepXSetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "setdval.h"
/***********************************************************************
*
@ -154,6 +156,7 @@ ProcXSetDeviceValuators(client)
*
*/
void
SRepXSetDeviceValuators (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XIproto.h"
extern int IReqCode;
extern int BadDevice;
extern InputInfo inputInfo;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "dixevents.h"
#include "extnsionst.h"
#include "extinit.h" /* 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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h"
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern int DeviceMappingNotify;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "setmmap.h"
/***********************************************************************
*
@ -90,6 +91,7 @@ SProcXSetDeviceModifierMapping(client)
*
*/
int
ProcXSetDeviceModifierMapping(client)
ClientPtr client;
{
@ -116,7 +118,7 @@ ProcXSetDeviceModifierMapping(client)
ret = SetModifierMapping(client, dev, stuff->length,
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
&stuff[1], &kp);
(BYTE *)&stuff[1], &kp);
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
{
@ -143,6 +145,7 @@ ProcXSetDeviceModifierMapping(client)
*
*/
void
SRepXSetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "setmode.h"
/***********************************************************************
*
@ -138,6 +140,7 @@ ProcXSetDeviceMode(client)
*
*/
void
SRepXSetDeviceMode (client, size, rep)
ClientPtr client;
int size;

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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
@ -62,6 +63,7 @@ SOFTWARE.
#include "inputstr.h"
#include "XI.h"
#include "XIproto.h"
#include "XIstubs.h"
/***********************************************************************
*
@ -95,6 +97,7 @@ ChangeKeyboardDevice (old_dev, new_dev)
/***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/
return BadMatch;
}
@ -129,9 +132,17 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/
int
#if NeedFunctionPrototypes
ChangePointerDevice (
DeviceIntPtr old_dev,
DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
#else
ChangePointerDevice (old_dev, new_dev, x, y)
DeviceIntPtr old_dev, new_dev;
unsigned char x, y;
#endif
{
/***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
@ -143,6 +154,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
else
axes_changed = FALSE;
*************************************************************************/
return BadMatch;
}
/***********************************************************************
@ -194,13 +206,13 @@ CloseInputDevice (d, client)
void
AddOtherInputDevices ()
{
/**********************************************************************
for each uninitialized device, do something like:
DeviceIntPtr dev;
DeviceProc deviceProc;
pointer private;
/**********************************************************************
for each uninitialized device, do something like:
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
dev->public.devicePrivate = private;
RegisterOtherDevice(dev);

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "windowstr.h" /* window structure */
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
extern int IReqCode;
extern int BadDevice;
extern void (* ReplySwapVector[256]) ();
DeviceIntPtr LookupDeviceIntRec();
#include "ungrdev.h"
/***********************************************************************
*

View File

@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevb.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
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.
********************************************************/
/* $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 "XI.h"
#include "XIproto.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevk.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.5 2001/12/21 21:02:04 dawes Exp $ */
#include <scrnintstr.h>
#define _XP_PRINT_SERVER_
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include "AttrValid.h"
#include "attributes.h"
/*
* default medium-source-sizes supported = na-letter w/.25" margins
@ -48,7 +46,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
&DefaultMediumSize, 1
};
static XpOidMediumSourceSize DefaultMediumSourceSize = {
xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
};
static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1
@ -300,7 +298,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
}
const XpOidMediumSS*
XpGetDefaultMediumSS()
XpGetDefaultMediumSS(void)
{
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.7 2001/12/21 21:02:04 dawes Exp $ */
#ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h
#include <X11/extensions/Printstr.h>
#include "Oid.h"
#include "attributes.h"
#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
@ -83,6 +84,9 @@ typedef struct
(const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
#define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
/*
* XpOid-valued attribute access
*/
@ -175,7 +179,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidMediumSS* msss);
const XpOidMediumSS* XpGetDefaultMediumSS();
const XpOidMediumSS* XpGetDefaultMediumSS(void);
/*
* XpOidTrayMediumList-valued attribute access
@ -189,12 +193,15 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidTrayMediumList* tm);
BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
/*
* Attribute pool validation
*/
void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool,
const XpValidatePoolsRec* vpr);
void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext,
@ -203,6 +210,10 @@ void XpValidateDocumentPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext,
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 */

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
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
* 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
* the requesting client.
*/
#ifndef _XpDiPrint_H_
#define _XpDiPrint_H_ 1
#include "scrnintstr.h"
typedef struct _diListEntry {
char *name;
char *description;
@ -52,3 +59,17 @@ extern XpDiListEntry **XpDiGetPrinterList(
char *name,
int localeLen,
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 <stdlib.h>
@ -74,53 +75,23 @@ copyright holders.
#include "cursor.h"
#include "misc.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "inputstr.h"
#include "gcstruct.h"
#include "fonts/fontstruct.h"
#include "errno.h"
#define _XP_PRINT_SERVER_
#include "Printstr.h"
#undef _XP_PRINT_SERVER_
typedef char *XPointer;
#define HAVE_XPointer 1
#define Status int
#include <Xresource.h>
#include "DiPrint.h"
#include "AttrValid.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"
#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(
int index,
ScreenPtr pScreen,
@ -132,15 +103,6 @@ static Bool InitPrintDrivers(
int argc,
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 "*" 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)"
" }' | sort";
#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' | "
"sed -e /:/s/// | sort";
#else
@ -209,12 +171,11 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
static
PixmapFormatRec RasterPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD
{ 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
extern Bool InitializeRasterDriver();
extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
#include "raster/Raster.h"
#endif
@ -222,51 +183,45 @@ extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
static
PixmapFormatRec ColorPclPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD,
8, 8, BITMAP_SCANLINE_PAD,
24,32, BITMAP_SCANLINE_PAD
{ 1, 1, BITMAP_SCANLINE_PAD },
{ 8, 8, BITMAP_SCANLINE_PAD },
{ 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
extern Bool InitializeColorPclDriver();
extern XpValidatePoolsRec PclValidatePoolsRec;
#endif
#ifdef XPMONOPCLDDX
static
PixmapFormatRec MonoPclPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD
{ 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
extern Bool InitializeMonoPclDriver();
extern XpValidatePoolsRec PclValidatePoolsRec;
#endif
#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
#include "pcl/Pcl.h"
#endif
#ifdef XPPSDDX
static
PixmapFormatRec PSPixmapFormats[] = {
1, 1, BITMAP_SCANLINE_PAD,
8, 8, BITMAP_SCANLINE_PAD,
24,32, BITMAP_SCANLINE_PAD
{ 1, 1, BITMAP_SCANLINE_PAD },
{ 8, 8, BITMAP_SCANLINE_PAD },
{ 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
extern Bool InitializePsDriver();
extern XpValidatePoolsRec PsValidatePoolsRec;
#include "ps/Ps.h"
#endif
typedef Bool (*pBFunc)();
typedef void (*pVFunc)();
/*
* The driverInitArray contains an entry for each driver 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 int printScreenPrivIndex,
printWindowPrivIndex,
printGCPrivIndex;
static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL;
@ -389,12 +340,11 @@ static char *origFontPath = (char *)NULL;
* of the next option to process.
*/
int
XprintOptions(argc, argv, i)
int argc;
char **argv;
int i;
XprintOptions(
int argc,
char **argv,
int i)
{
extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0)
{
if ((i + 1) >= argc) {
@ -427,9 +377,7 @@ static pIFunc
GetInitFunc(driverName)
*/
static Bool (*
GetInitFunc(driverName))()
char *driverName;
static pBFunc GetInitFunc(char *driverName)
{
driverInitRec *pInitRec;
int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
@ -441,7 +389,7 @@ GetInitFunc(driverName))()
return pInitRec->initFunc;
}
return (Bool(*)())NULL;
return 0;
}
static void
@ -464,17 +412,17 @@ GetDimFuncAndRec(
}
}
*dimensionsFunc = (pVFunc)NULL;
*pValRec = (XpValidatePoolsRec *)NULL;
*dimensionsFunc = 0;
*pValRec = 0;
return;
}
static void
FreePrinterDb()
FreePrinterDb(void)
{
PrinterDbPtr pCurEntry, pNextEntry;
for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
for(pCurEntry = printerDb, pNextEntry = 0;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{
pNextEntry = pCurEntry->next;
@ -486,7 +434,7 @@ FreePrinterDb()
*/
xfree(pCurEntry);
}
printerDb = (PrinterDbPtr)NULL;
printerDb = 0;
}
/*
@ -496,8 +444,7 @@ FreePrinterDb()
* XXX AddPrinterDbName needs to check for (and not add) duplicate names.
*/
static Bool
AddPrinterDbName(name)
char *name;
AddPrinterDbName(char *name)
{
PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
@ -519,8 +466,7 @@ AddPrinterDbName(name)
}
static void
AugmentPrinterDb(command)
char *command;
AugmentPrinterDb(const char *command)
{
FILE *fp;
char name[256];
@ -539,7 +485,7 @@ AugmentPrinterDb(command)
* FreeNameMap frees all remaining memory associated with the nameMap.
*/
static void
FreeNameMap()
FreeNameMap(void)
{
NameMapPtr pEntry, pTmp;
@ -561,9 +507,7 @@ FreeNameMap()
* AddNameMap adds an element to the nameMap linked list.
*/
static Bool
AddNameMap(name, qualifier)
char *name;
char *qualifier;
AddNameMap(char *name, char *qualifier)
{
NameMapPtr pEntry;
@ -585,7 +529,7 @@ AddNameMap(name, qualifier)
* is NULLed out.
*/
static void
MergeNameMap()
MergeNameMap(void)
{
NameMapPtr pMap;
PrinterDbPtr pDb;
@ -608,7 +552,7 @@ MergeNameMap()
* each printer in the printerDb.
*/
static void
CreatePrinterAttrs()
CreatePrinterAttrs(void)
{
PrinterDbPtr pDb;
@ -642,7 +586,7 @@ CreatePrinterAttrs()
* the screens.
*/
static void
StoreDriverNames()
StoreDriverNames(void)
{
PrinterDbPtr pEntry;
@ -653,7 +597,7 @@ StoreDriverNames()
"xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL ||
strlen(pEntry->driverName) == 0 ||
GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
GetInitFunc(pEntry->driverName) == 0)
{
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
ErrorF("Xp Extension: Can't load driver %s\n",
@ -670,7 +614,7 @@ StoreDriverNames()
}
}
char *
static char *
MbStrchr(
char *str,
int ch)
@ -699,7 +643,7 @@ MbStrchr(
* string must be freed by the caller.
*/
static char *
GetConfigFileName()
GetConfigFileName(void)
{
/*
* We need to find the system-wide file, if one exists. This
@ -711,7 +655,7 @@ GetConfigFileName()
/*
* Check for a LANG-specific file.
*/
if(dirName = XpGetConfigDir(TRUE))
if ((dirName = XpGetConfigDir(TRUE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@ -730,7 +674,7 @@ GetConfigFileName()
xfree(filePath);
}
if(dirName = XpGetConfigDir(FALSE))
if ((dirName = XpGetConfigDir(FALSE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@ -760,9 +704,8 @@ GetConfigFileName()
* XXX
*/
static PrinterDbPtr
BuildPrinterDb()
BuildPrinterDb(void)
{
char *printerList, *augmentCmd = (char *)NULL;
Bool defaultAugment = TRUE, freeConfigFileName;
if(configFileName && access(configFileName, R_OK) != 0)
@ -789,7 +732,7 @@ BuildPrinterDb()
{
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
{
if(ptr = MbStrchr(tok, '\012'))
if ((ptr = MbStrchr(tok, '\012')) != 0)
*ptr = (char)'\0';
AddPrinterDbName(tok);
}
@ -855,8 +798,7 @@ BuildPrinterDb()
}
static void
FreeDriverMap(driverMap)
DriverMapPtr driverMap;
FreeDriverMap(DriverMapPtr driverMap)
{
DriverMapPtr pCurEntry, pNextEntry;
@ -882,7 +824,7 @@ FreeDriverMap(driverMap)
* the next rehash or server recycle.
*/
int
XpRehashPrinterList()
XpRehashPrinterList(void)
{
PrinterDbPtr pEntry, pPrev;
DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
@ -1014,7 +956,7 @@ FindFontDir(
return (char *)NULL;
configDir = XpGetConfigDir(TRUE);
if(fontDir = ValidateFontDir(configDir, modelName))
if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
{
xfree(configDir);
return fontDir;
@ -1074,10 +1016,10 @@ AddToFontPath(
* and to properly free the modified version upon server recycle.
*/
static void
AugmentFontPath()
AugmentFontPath(void)
{
char *newPath, *modelID, **allIDs = (char **)NULL;
PrinterDbPtr pDb, pDbEntry;
char *modelID, **allIDs = (char **)NULL;
PrinterDbPtr pDbEntry;
int numModels, i;
if(!origFontPath)
@ -1135,7 +1077,7 @@ AugmentFontPath()
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
{
char *fontDir;
if(fontDir = FindFontDir(allIDs[i]))
if ((fontDir = FindFontDir(allIDs[i])) != 0)
{
AddToFontPath(fontDir);
xfree(fontDir);
@ -1225,7 +1167,7 @@ XpClientIsPrintClient(
* fpe->name.
*/
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,
fpe->name_length - PATH_PREFIX_LEN))
{
@ -1237,9 +1179,7 @@ XpClientIsPrintClient(
}
static void
AddFormats(pScreenInfo, driverName)
ScreenInfo *pScreenInfo;
char *driverName;
AddFormats(ScreenInfo *pScreenInfo, char *driverName)
{
int i, j;
driverInitRec *pInitRec;
@ -1290,10 +1230,10 @@ AddFormats(pScreenInfo, driverName)
************************************************************/
void
PrinterInitOutput(pScreenInfo, argc, argv)
ScreenInfo *pScreenInfo;
int argc;
char **argv;
PrinterInitOutput(
ScreenInfo *pScreenInfo,
int argc,
char **argv)
{
PrinterDbPtr pDb, pDbEntry;
int driverCount = 0, i;
@ -1454,11 +1394,11 @@ PrinterInitOutput(pScreenInfo, argc, argv)
* screen.
*/
static Bool
InitPrintDrivers(index, pScreen, argc, argv)
int index;
ScreenPtr pScreen;
int argc;
char **argv;
InitPrintDrivers(
int index,
ScreenPtr pScreen,
int argc,
char **argv)
{
PrinterDbPtr pDb, pDb2;
@ -1479,7 +1419,7 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
if(callInit == TRUE)
{
Bool (*initFunc)();
pBFunc initFunc;
initFunc = GetInitFunc(pDb->driverName);
if(initFunc(index, pScreen, argc, argv) == FALSE)
{
@ -1492,13 +1432,13 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
void
_XpVoidNoop()
_XpVoidNoop(void)
{
return;
}
Bool
_XpBoolNoop()
_XpBoolNoop(void)
{
return TRUE;
}
@ -1510,16 +1450,15 @@ _XpBoolNoop()
*/
static void
GenericScreenInit( index, pScreen, argc, argv )
int index;
ScreenPtr pScreen;
int argc;
char **argv;
GenericScreenInit(
int index,
ScreenPtr pScreen,
int argc,
char **argv)
{
int i;
float fWidth, fHeight, maxWidth, maxHeight;
unsigned short width, height;
PrinterDbPtr pDb, pDb2;
PrinterDbPtr pDb;
int res, maxRes;
/*
@ -1543,7 +1482,6 @@ GenericScreenInit( index, pScreen, argc, argv )
{
if(pDb->screenNum == index)
{
XpValidatePoolsRec *pValRec;
pVFunc dimensionsFunc;
@ -1582,9 +1520,9 @@ GenericScreenInit( index, pScreen, argc, argv )
* freeing the associated memory.
*/
static char *
QualifyName(fileName, searchPath)
char *fileName;
char *searchPath;
QualifyName(
char *fileName,
char *searchPath)
{
char * curPath = searchPath;
char * nextPath;
@ -1632,11 +1570,11 @@ QualifyName(fileName, searchPath)
* XXX "localeName" elements of the XpDiListEntry to the specified locale.
*/
static void
FillPrinterListEntry(pEntry, pDb, localeLen, locale)
XpDiListEntry *pEntry;
PrinterDbPtr pDb;
int localeLen;
char *locale;
FillPrinterListEntry(
XpDiListEntry *pEntry,
PrinterDbPtr pDb,
int localeLen,
char *locale)
{
static char *localeStr = (char *)NULL;
@ -1659,18 +1597,19 @@ FillPrinterListEntry(pEntry, pDb, localeLen, locale)
*
*/
static Bool
GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
XpDiListEntry *pEntry;
int nameLen;
char *name;
int localeLen;
char *locale;
GetPrinterListInfo(
XpDiListEntry *pEntry,
int nameLen,
char *name,
int localeLen,
char *locale)
{
PrinterDbPtr pDb, pDb2;
PrinterDbPtr pDb;
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);
return TRUE;
@ -1684,8 +1623,7 @@ GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
* for a printer list.
*/
void
XpDiFreePrinterList(list)
XpDiListEntry **list;
XpDiFreePrinterList(XpDiListEntry **list)
{
int i;
@ -1705,18 +1643,18 @@ XpDiFreePrinterList(list)
* the information for all printers is desired.
*/
XpDiListEntry **
XpDiGetPrinterList(nameLen, name, localeLen, locale)
int nameLen;
char *name;
int localeLen;
char *locale;
XpDiGetPrinterList(
int nameLen,
char *name,
int localeLen,
char *locale)
{
XpDiListEntry **pList;
if(!nameLen || name == (char *)NULL)
{
int i;
PrinterDbPtr pDb, pDb2;
PrinterDbPtr pDb;
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
pDb = pDb->next, i++)
@ -1763,17 +1701,14 @@ XpDiGetPrinterList(nameLen, name, localeLen, locale)
}
WindowPtr
XpDiValidatePrinter(printerName, printerNameLen)
char *printerName;
int printerNameLen;
XpDiValidatePrinter(char *printerName, int printerNameLen)
{
PrinterDbPtr pCurEntry;
WindowPtr pWin;
for(pCurEntry = printerDb;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
{
if(strlen(pCurEntry->name) == printerNameLen &&
if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
!strncmp(pCurEntry->name, printerName, printerNameLen))
return WindowTable[pCurEntry->screenNum];
}
@ -1786,9 +1721,7 @@ XpDiValidatePrinter(printerName, printerNameLen)
* on the specified screen.
*/
char *
XpDiGetDriverName(index, printerName)
int index;
char *printerName;
XpDiGetDriverName(int index, char *printerName)
{
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
copyright holders.
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "Oid.h"
#include <X11/Xfuncs.h> /* for memmove */
/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5 2001/10/28 03:32:53 tsi Exp $ */
#include "attributes.h"
/*
* XpOidNotify value strings
@ -753,7 +751,7 @@ XpOidLinkedListFirstOid(XpOidLinkedList* me)
XpOid
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;
else
return xpoid_none;
@ -1654,8 +1652,6 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
const XpOidMediumSS* msss)
{
int i_mss, i_ds, i_itm;
XpOidMediumDiscreteSizeList* ds_list;
int tray_count;
XpOid current_tray, current_medium;
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
XpOidMediumDiscreteSizeList* tray_ds;
@ -1715,6 +1711,7 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
* list
*/
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
/*
@ -1725,7 +1722,10 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
continue;
}
else
{
tray_ds = unspecified_tray_ds;
}
}
/*
* loop through the discrete sizes list, looking for a size that
* matches the medium for the current input tray
@ -2107,15 +2107,13 @@ const char* XpOidNotifyString(XpOidNotify notify)
{
switch(notify)
{
default:
case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL;
break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
break;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
break;
}
}
@ -2240,7 +2238,7 @@ XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
const char* first_nonws_ptr;
const char* format;
const char* variant;
const char* version;
const char* version = 0;
int format_len;
int variant_len;
int version_len;
@ -2553,10 +2551,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* variants must both be NULL or match
*/
if(fmt->variant == (char*)NULL)
{
if(list->list[i].variant == (char*)NULL)
return xTrue;
else
continue;
}
if(list->list[i].variant == (char*)NULL)
continue;
if(strcmp(fmt->variant, list->list[i].variant) != 0)
@ -2565,10 +2565,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* versions must both be NULL or match
*/
if(fmt->version == (char*)NULL)
{
if(list->list[i].version == (char*)NULL)
return xTrue;
else
continue;
}
if(list->list[i].version == (char*)NULL)
continue;
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
#ifndef _Xp_Oid_h
#define _Xp_Oid_h
@ -205,7 +206,7 @@ char* XpOidListString(const XpOidList*);
/*
* XpOidLinkedList public methods
*/
XpOidLinkedList* XpOidLinkedListNew();
XpOidLinkedList* XpOidLinkedListNew(void);
void XpOidLinkedListDelete(XpOidLinkedList*);
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
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
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;
#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
static const XpOidStringMapEntry XpOidStringMap[] = {
{ "", 0 },
{ "", 0 },
{ "descriptor", 10 },
{ "content-orientation", 19 },
{ "copy-count", 10 },
{ "default-printer-resolution", 26 },
{ "default-input-tray", 18 },
{ "default-medium", 14 },
{ "document-format", 15 },
{ "plex", 4 },
{ "xp-listfonts-modes", 18 },
{ "job-name", 8 },
{ "job-owner", 9 },
{ "notification-profile", 20 },
{ "xp-setup-state", 14 },
{ "xp-spooler-command-options", 26 },
{ "content-orientations-supported", 30 },
{ "document-formats-supported", 26 },
{ "dt-pdm-command", 14 },
{ "input-trays-medium", 18 },
{ "medium-source-sizes-supported", 29 },
{ "plexes-supported", 16 },
{ "printer-model", 13 },
{ "printer-name", 12 },
{ "printer-resolutions-supported", 29 },
{ "xp-embedded-formats-supported", 29 },
{ "xp-listfonts-modes-supported", 28 },
{ "xp-page-attributes-supported", 28 },
{ "xp-raw-formats-supported", 24 },
{ "xp-setup-proviso", 16 },
{ "document-attributes-supported", 29 },
{ "job-attributes-supported", 24 },
{ "locale", 6 },
{ "multiple-documents-supported", 28 },
{ "available-compression", 21 },
{ "available-compressions-supported", 32 },
{ "portrait", 8 },
{ "landscape", 9 },
{ "reverse-portrait", 16 },
{ "reverse-landscape", 17 },
{ "iso-a0", 6 },
{ "iso-a1", 6 },
{ "iso-a2", 6 },
{ "iso-a3", 6 },
{ "iso-a4", 6 },
{ "iso-a5", 6 },
{ "iso-a6", 6 },
{ "iso-a7", 6 },
{ "iso-a8", 6 },
{ "iso-a9", 6 },
{ "iso-a10", 7 },
{ "iso-b0", 6 },
{ "iso-b1", 6 },
{ "iso-b2", 6 },
{ "iso-b3", 6 },
{ "iso-b4", 6 },
{ "iso-b5", 6 },
{ "iso-b6", 6 },
{ "iso-b7", 6 },
{ "iso-b8", 6 },
{ "iso-b9", 6 },
{ "iso-b10", 7 },
{ "na-letter", 9 },
{ "na-legal", 8 },
{ "executive", 9 },
{ "folio", 5 },
{ "invoice", 7 },
{ "ledger", 6 },
{ "quarto", 6 },
{ "iso-c3", 6 },
{ "iso-c4", 6 },
{ "iso-c5", 6 },
{ "iso-c6", 6 },
{ "iso-designated-long", 19 },
{ "na-10x13-envelope", 17 },
{ "na-9x12-envelope", 16 },
{ "na-number-10-envelope", 21 },
{ "na-7x9-envelope", 15 },
{ "na-9x11-envelope", 16 },
{ "na-10x14-envelope", 17 },
{ "na-number-9-envelope", 20 },
{ "na-6x9-envelope", 15 },
{ "na-10x15-envelope", 17 },
{ "monarch-envelope", 16 },
{ "a", 1 },
{ "b", 1 },
{ "c", 1 },
{ "d", 1 },
{ "e", 1 },
{ "jis-b0", 6 },
{ "jis-b1", 6 },
{ "jis-b2", 6 },
{ "jis-b3", 6 },
{ "jis-b4", 6 },
{ "jis-b5", 6 },
{ "jis-b6", 6 },
{ "jis-b7", 6 },
{ "jis-b8", 6 },
{ "jis-b9", 6 },
{ "jis-b10", 7 },
{ "simplex", 7 },
{ "duplex", 6 },
{ "tumble", 6 },
{ "top", 3 },
{ "middle", 6 },
{ "bottom", 6 },
{ "envelope", 8 },
{ "manual", 6 },
{ "large-capacity", 14 },
{ "main", 4 },
{ "side", 4 },
{ "event-report-job-completed", 26 },
{ "electronic-mail", 15 },
{ "xp-setup-mandatory", 18 },
{ "xp-setup-optional", 17 },
{ "xp-setup-ok", 11 },
{ "xp-setup-incomplete", 19 },
{ "xp-list-glyph-fonts", 19 },
{ "xp-list-internal-printer-fonts", 30 },
{ "0", 1 },
{ "01", 2 },
{ "02", 2 },
{ "03", 2 },
{ "012", 3 },
{ "013", 3 },
{ "023", 3 },
{ "0123", 4 }
OIDATA(""),
OIDATA(""),
OIDATA("descriptor"),
OIDATA("content-orientation"),
OIDATA("copy-count"),
OIDATA("default-printer-resolution"),
OIDATA("default-input-tray"),
OIDATA("default-medium"),
OIDATA("document-format"),
OIDATA("plex"),
OIDATA("xp-listfonts-modes"),
OIDATA("job-name"),
OIDATA("job-owner"),
OIDATA("notification-profile"),
OIDATA("xp-setup-state"),
OIDATA("xp-spooler-command-options"),
OIDATA("content-orientations-supported"),
OIDATA("document-formats-supported"),
OIDATA("dt-pdm-command"),
OIDATA("input-trays-medium"),
OIDATA("medium-source-sizes-supported"),
OIDATA("plexes-supported"),
OIDATA("printer-model"),
OIDATA("printer-name"),
OIDATA("printer-resolutions-supported"),
OIDATA("xp-embedded-formats-supported"),
OIDATA("xp-listfonts-modes-supported"),
OIDATA("xp-page-attributes-supported"),
OIDATA("xp-raw-formats-supported"),
OIDATA("xp-setup-proviso"),
OIDATA("document-attributes-supported"),
OIDATA("job-attributes-supported"),
OIDATA("locale"),
OIDATA("multiple-documents-supported"),
OIDATA("available-compression"),
OIDATA("available-compressions-supported"),
OIDATA("portrait"),
OIDATA("landscape"),
OIDATA("reverse-portrait"),
OIDATA("reverse-landscape"),
OIDATA("iso-a0"),
OIDATA("iso-a1"),
OIDATA("iso-a2"),
OIDATA("iso-a3"),
OIDATA("iso-a4"),
OIDATA("iso-a5"),
OIDATA("iso-a6"),
OIDATA("iso-a7"),
OIDATA("iso-a8"),
OIDATA("iso-a9"),
OIDATA("iso-a10"),
OIDATA("iso-b0"),
OIDATA("iso-b1"),
OIDATA("iso-b2"),
OIDATA("iso-b3"),
OIDATA("iso-b4"),
OIDATA("iso-b5"),
OIDATA("iso-b6"),
OIDATA("iso-b7"),
OIDATA("iso-b8"),
OIDATA("iso-b9"),
OIDATA("iso-b10"),
OIDATA("na-letter"),
OIDATA("na-legal"),
OIDATA("executive"),
OIDATA("folio"),
OIDATA("invoice"),
OIDATA("ledger"),
OIDATA("quarto"),
OIDATA("iso-c3"),
OIDATA("iso-c4"),
OIDATA("iso-c5"),
OIDATA("iso-c6"),
OIDATA("iso-designated-long"),
OIDATA("na-10x13-envelope"),
OIDATA("na-9x12-envelope"),
OIDATA("na-number-10-envelope"),
OIDATA("na-7x9-envelope"),
OIDATA("na-9x11-envelope"),
OIDATA("na-10x14-envelope"),
OIDATA("na-number-9-envelope"),
OIDATA("na-6x9-envelope"),
OIDATA("na-10x15-envelope"),
OIDATA("monarch-envelope"),
OIDATA("a"),
OIDATA("b"),
OIDATA("c"),
OIDATA("d"),
OIDATA("e"),
OIDATA("jis-b0"),
OIDATA("jis-b1"),
OIDATA("jis-b2"),
OIDATA("jis-b3"),
OIDATA("jis-b4"),
OIDATA("jis-b5"),
OIDATA("jis-b6"),
OIDATA("jis-b7"),
OIDATA("jis-b8"),
OIDATA("jis-b9"),
OIDATA("jis-b10"),
OIDATA("simplex"),
OIDATA("duplex"),
OIDATA("tumble"),
OIDATA("top"),
OIDATA("middle"),
OIDATA("bottom"),
OIDATA("envelope"),
OIDATA("manual"),
OIDATA("large-capacity"),
OIDATA("main"),
OIDATA("side"),
OIDATA("event-report-job-completed"),
OIDATA("electronic-mail"),
OIDATA("xp-setup-mandatory"),
OIDATA("xp-setup-optional"),
OIDATA("xp-setup-ok"),
OIDATA("xp-setup-incomplete"),
OIDATA("xp-list-glyph-fonts"),
OIDATA("xp-list-internal-printer-fonts"),
OIDATA("0"),
OIDATA("01"),
OIDATA("02"),
OIDATA("03"),
OIDATA("012"),
OIDATA("013"),
OIDATA("023"),
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
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 <sys/wait.h>
#include <sys/stat.h>
#include "dixstruct.h"
#include "scrnintstr.h"
#include "misc.h"
#include "dixstruct.h"
#define _XP_PRINT_SERVER_
#include "extensions/Print.h"
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include <X11/extensions/Print.h>
#include "attributes.h"
#define IN_FILE_STRING "%(InFile)%"
#define OUT_FILE_STRING "%(OutFile)%"
@ -89,10 +94,10 @@ ReplaceAnyString(
* and the caller is responsible for freeing whatever string is returned.
*/
char *
ReplaceFileString(string, inFileName, outFileName)
char *string;
char *inFileName;
char *outFileName;
ReplaceFileString(
char *string,
char *inFileName,
char *outFileName)
{
char *pKeyString,
*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.
*/
void
ExecCommand(pCommand, argVector)
char *pCommand;
char **argVector;
ExecCommand(
char *pCommand,
char **argVector)
{
pid_t childPid;
int status;
@ -169,17 +174,19 @@ ExecCommand(pCommand, argVector)
* beginning the transfer.
*/
int
TransferBytes(pSrcFile, pDstFile, numBytes)
TransferBytes(
FILE *pSrcFile,
*pDstFile;
int numBytes;
FILE *pDstFile,
int numBytes)
{
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 = min(sizeof(buf)*sizeof(char), numBytes - bytesWritten))
bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten)))
{
if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
return bytesWritten;
@ -195,10 +202,10 @@ TransferBytes(pSrcFile, pDstFile, numBytes)
* pre, no, and post raster files as well as the raster file itself.
*/
Bool
CopyContentsAndDelete(ppSrcFile, pSrcFileName, pDstFile)
CopyContentsAndDelete(
FILE **ppSrcFile,
*pDstFile;
char **pSrcFileName;
char **pSrcFileName,
FILE *pDstFile)
{
struct stat statBuf;
@ -228,7 +235,8 @@ XpSendDocumentData(
int maxBufSize)
{
xPrintGetDocumentDataReply *pRep;
int bytesWritten, bytesToWrite;
int bytesWritten;
unsigned bytesToWrite;
int result = Success;
if(client->clientGone)
@ -247,8 +255,7 @@ XpSendDocumentData(
pRep->length = (QUADPAD(bytesToWrite)) >> 2;
pRep->dataLen = bytesToWrite;
if(fread((void *)(pRep + 1), (size_t) 1, bytesToWrite, fp) <
bytesToWrite)
if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite)
{
result = BadAlloc; /* XXX poor error choice? */
pRep->statusCode = 2; /* XXX Is this the right value??? */
@ -316,6 +323,7 @@ XpFinishDocData(
return Success;
}
#ifndef HAS_MKSTEMP
static
char *XpDirName(char *fname)
{
@ -334,6 +342,7 @@ char *XpDirName(char *fname)
}
return fn;
}
#endif
Bool
XpOpenTmpFile(
@ -341,6 +350,7 @@ XpOpenTmpFile(
char **fname,
FILE **stream)
{
#ifndef HAS_MKSTEMP
char *fn = NULL;
/* note that there is a small race condition here... */
@ -348,6 +358,7 @@ XpOpenTmpFile(
!(fn = XpDirName(*fname)) ||
access(fn, W_OK) ||
!(*stream = fopen(*fname, mode)))
{
xfree(fn);
xfree(*fname);
@ -356,5 +367,26 @@ XpOpenTmpFile(
return FALSE;
}
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;
}

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 <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
#if defined(sun) && defined(SVR4)
#include <wchar.h>
#endif
#include <scrnintstr.h>
#include "scrnintstr.h"
#define _XP_PRINT_SERVER_
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include <X11/extensions/Printstr.h>
#include "attributes.h"
#include "Xrm.c"
static XrmDatabase CopyDb(XrmDatabase inDb);
extern XrmDatabase XpSpoolerGetServerAttributes();
extern XrmDatabase XpSpoolerGetServerAttributes(void);
static int attrGeneration = 0;
static unsigned long attrGeneration = 0;
typedef struct {
XrmDatabase *pDb;
@ -137,8 +141,7 @@ static char NULL_STRING[] = "\0";
* $LANG. It makes no attempt to ensure that the directory actually exists.
*/
char *
XpGetConfigDir(useLocale)
Bool useLocale;
XpGetConfigDir(Bool useLocale)
{
char *dirName, *langName, *langDir, *configDir;
Bool freeLangDir = False;
@ -182,8 +185,7 @@ XpGetConfigDir(useLocale)
* locale (if other than the top-level).
*/
static XrmDatabase
GetMergedDatabase(attrName)
char *attrName;
GetMergedDatabase(const char *attrName)
{
char *dirName, *fileName;
XrmDatabase db;
@ -220,7 +222,7 @@ GetMergedDatabase(attrName)
* the context.
*/
static void
BuildSystemAttributes()
BuildSystemAttributes(void)
{
if(systemAttributes.printers != (XrmDatabase)NULL)
XrmDestroyDatabase(systemAttributes.printers);
@ -243,13 +245,13 @@ BuildSystemAttributes()
* passed as the client_data (aka "closure").
*/
static Bool
AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
XrmDatabase *sourceDB;
XrmBindingList bindings;
XrmQuarkList quarks;
XrmRepresentation *type;
XrmValue *value;
XPointer client_data;
AddDbEntry(
XrmDatabase *sourceDB,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer client_data)
{
DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
XrmName xrm_name[5];
@ -293,15 +295,15 @@ AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
* printer.
*/
static XrmDatabase
BuildPrinterAttrs(printerName, qualifierName)
char *printerName;
char *qualifierName;
BuildPrinterAttrs(
char *printerName,
char *qualifierName)
{
XrmDatabase printerDB = (XrmDatabase)NULL;
if(systemAttributes.printers != (XrmDatabase)NULL)
{
char *dirName, *fileName;
char *fileName;
XrmDatabase modelDB = (XrmDatabase)NULL;
XrmName xrm_name[5], xrm_class[2];
XrmRepresentation rep_type;
@ -374,10 +376,10 @@ BuildPrinterAttrs(printerName, qualifierName)
* level doc and job databases.
*/
static XrmDatabase
BuildABase(printerName, qualifierName, sourceBase)
char *printerName;
char *qualifierName;
XrmDatabase sourceBase;
BuildABase(
char *printerName,
char *qualifierName,
XrmDatabase sourceBase)
{
XrmDatabase builtDB = (XrmDatabase)NULL;
@ -425,7 +427,7 @@ BuildABase(printerName, qualifierName, sourceBase)
* databases stored in the global attrList.
*/
static void
FreeAttrList()
FreeAttrList(void)
{
PrAttrPtr pAttr, pNext;
@ -454,7 +456,7 @@ FreeAttrList()
* by calling XpBuildAttributeStore for a new list of printers.
*/
int
XpRehashAttributes()
XpRehashAttributes(void)
{
if(attrList != (PrAttrPtr)NULL)
FreeAttrList();
@ -468,9 +470,9 @@ XpRehashAttributes()
* calls BuildSystemAttributes to create the system-level databases.
*/
void
XpBuildAttributeStore(printerName, qualifierName)
char *printerName;
char *qualifierName;
XpBuildAttributeStore(
char *printerName,
char *qualifierName)
{
PrAttrPtr pAttr;
@ -510,13 +512,13 @@ XpBuildAttributeStore(printerName, qualifierName)
static Bool
StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
XrmDatabase *sourceDB;
XrmBindingList bindings;
XrmQuarkList quarks;
XrmRepresentation *type;
XrmValue *value;
XPointer client_data;
StoreEntry(
XrmDatabase *sourceDB,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer client_data)
{
XrmDatabase *outDb = (XrmDatabase *)client_data;
@ -530,8 +532,7 @@ StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
* the copy.
*/
static XrmDatabase
CopyDb(inDb)
XrmDatabase inDb;
CopyDb(XrmDatabase inDb)
{
XrmDatabase outDb = (XrmDatabase)NULL;
XrmQuark empty = NULLQUARK;
@ -547,8 +548,7 @@ CopyDb(inDb)
* attributes databases for the printer associated with the context.
*/
void
XpInitAttributes( pContext )
XpContextPtr pContext;
XpInitAttributes(XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
PrAttrPtr pPrAttr = attrList;
@ -569,8 +569,8 @@ XpInitAttributes( pContext )
}
void
XpDestroyAttributes( pContext )
XpContextPtr pContext;
XpDestroyAttributes(
XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
@ -596,14 +596,13 @@ XpDestroyAttributes( pContext )
* in which case the pContext parameter is ignored.
*/
char *
XpGetOneAttribute( pContext, class, attributeName )
XpContextPtr pContext;
XPAttributes class;
char *attributeName;
XpGetOneAttribute(
XpContextPtr pContext,
XPAttributes class,
char *attributeName)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
char *retVal;
XrmName xrm_name[3];
XrmRepresentation rep_type;
XrmValue value;
@ -666,12 +665,11 @@ XpGetOneAttribute( pContext, class, attributeName )
* function does not recognize XPServerAttr.
*/
void
XpPutOneAttribute( pContext, class, attributeName, value )
XpContextPtr pContext;
XPAttributes class;
const char* attributeName;
const char* value;
XpPutOneAttribute(
XpContextPtr pContext,
XPAttributes class,
const char* attributeName,
const char* value)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db;
@ -720,8 +718,8 @@ const char* value;
* struct to indicate the new amount of space available.
*/
static Bool
ExpandSpace(pStr)
StringDbStruct *pStr;
ExpandSpace(
StringDbStruct *pStr)
{
char *newSpace;
@ -740,9 +738,9 @@ ExpandSpace(pStr)
* are updated.
*/
static void
PutString(pStr, pString)
StringDbStruct *pStr;
char *pString;
PutString(
StringDbStruct *pStr,
char *pString)
{
int len = strlen(pString);
@ -760,9 +758,9 @@ PutString(pStr, pString)
* the byte, and the nextPos and space fields are updated.
*/
static void
PutByte(pStr, byte)
StringDbStruct *pStr;
char byte;
PutByte(
StringDbStruct *pStr,
char byte)
{
if(pStr->space <= 1)
if(!ExpandSpace(pStr))
@ -782,13 +780,13 @@ PutByte(pStr, byte)
* This code is based directly on that in "DumpEntry" in Xrm.c.
*/
static Bool
AppendEntry(db, bindings, quarks, type, value, data)
XrmDatabase *db;
XrmBindingList bindings;
XrmQuarkList quarks;
XrmRepresentation *type;
XrmValuePtr value;
XPointer data;
AppendEntry(
XrmDatabase *db,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValuePtr value,
XPointer data)
{
StringDbStruct *pEnumStr = (StringDbStruct *)data;
Bool firstNameSeen;
@ -796,7 +794,7 @@ AppendEntry(db, bindings, quarks, type, value, data)
char *s, c;
if (*type != XrmQString)
return;
return False;
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) {
@ -849,13 +847,12 @@ AppendEntry(db, bindings, quarks, type, value, data)
* unlike XpGetOneAttribute, where the caller must not free the string.
*/
char *
XpGetAttributes( pContext, class )
XpContextPtr pContext;
XPAttributes class;
XpGetAttributes(
XpContextPtr pContext,
XPAttributes class)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
char *retVal;
StringDbStruct enumStruct;
XrmQuark empty = NULLQUARK;
@ -904,10 +901,10 @@ XpGetAttributes( pContext, class )
}
int
XpAugmentAttributes( pContext, class, attributes )
XpContextPtr pContext;
XPAttributes class;
char *attributes;
XpAugmentAttributes(
XpContextPtr pContext,
XPAttributes class,
char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@ -940,10 +937,10 @@ XpAugmentAttributes( pContext, class, attributes )
* XpSetAttributes - sets the attribute stores for a specified context.
*/
int
XpSetAttributes( pContext, class, attributes )
XpContextPtr pContext;
XPAttributes class;
char *attributes;
XpSetAttributes(
XpContextPtr pContext,
XPAttributes class,
char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@ -981,12 +978,11 @@ XpSetAttributes( pContext, class, attributes )
}
void
XpAddPrinterAttribute(printerName, printerQualifier, attributeName,
attributeValue)
char *printerName;
char *printerQualifier;
char *attributeName;
char *attributeValue;
XpAddPrinterAttribute(
char *printerName,
char *printerQualifier,
char *attributeName,
char *attributeValue)
{
PrAttrPtr pAttr;
@ -1045,7 +1041,7 @@ static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
*multiple-documents-supported: False";
XrmDatabase
XpSpoolerGetServerAttributes()
XpSpoolerGetServerAttributes(void)
{
char *totalAttrs, *localeName;
XrmDatabase db;
@ -1064,34 +1060,6 @@ XpSpoolerGetServerAttributes()
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,
* the command to execute,
@ -1167,8 +1135,6 @@ SendFileToCommand(
}
else
{
int res;
(void) close(pipefd[0]);
outPipe = fdopen(pipefd[1], "w");
@ -1188,7 +1154,6 @@ SendFileToCommand(
* store for the supplied print context. The ReplaceAnyString utility
* routine is used to perform the actual replacements.
*/
extern char *ReplaceAnyString(char *, char *, char *);
static char *
ReplaceAllKeywords(
@ -1233,7 +1198,20 @@ ReplaceAllKeywords(
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)))
#endif
@ -1387,8 +1365,8 @@ VectorizeCommand(
char ***pVector,
XpContextPtr pContext)
{
char *cmdName, *curTok;
int i, numChars;
char *cmdName;
int numChars;
if(command == (char *)NULL)
return (char *)NULL;
@ -1410,11 +1388,11 @@ static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-co
#endif
int
XpSubmitJob(fileName, pContext)
char *fileName;
XpContextPtr pContext;
XpSubmitJob(
char *fileName,
XpContextPtr pContext)
{
char **vector, *cmdNam, *cmdOpt, *command, *userName;
char **vector, *cmdNam, *command, *userName;
int i;
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
@ -1452,6 +1430,7 @@ XpSubmitJob(fileName, pContext)
FreeVector(vector);
xfree(cmdNam);
return Success;
}
/*
@ -1524,7 +1503,6 @@ XpGetTrayMediumFromContext(XpContextPtr pCon,
{
char *defMedium, *defTray;
char *t, *m;
char *pS, *pE, *pLast;
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
"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
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
*/
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,
XPAttributes class,
char *attributeName);
@ -44,6 +63,7 @@ void XpPutOneAttribute(XpContextPtr pContext,
XPAttributes class,
const char* attributeName,
const char* value);
int XpRehashAttributes(void);
char *XpGetAttributes(XpContextPtr pContext,
XPAttributes class);
int XpAugmentAttributes(XpContextPtr pContext,
@ -57,6 +77,7 @@ const char *XpGetPrinterAttribute(const char *printerName,
void XpGetTrayMediumFromContext(XpContextPtr pCon,
char **medium,
char **tray);
int XpSubmitJob(char *fileName, XpContextPtr pContext);
/*
* mediaSizes.c
@ -76,3 +97,34 @@ void XpGetMediumDimensions(XpContextPtr pContext,
unsigned short *height);
void XpGetReproductionArea(XpContextPtr pContext,
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.14 2001/10/28 03:32:53 tsi Exp $ */
#include "X.h"
#include "Xproto.h"
#include "screenint.h"
#include "input.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "Xos.h"
#include "DiPrint.h"
static void Exit();
void _XpVoidNoop();
static void Exit(int);
/*-
*-----------------------------------------------------------------------
@ -72,13 +69,11 @@ void _XpVoidNoop();
*/
void
InitOutput(pScreenInfo, argc, argv)
ScreenInfo *pScreenInfo;
int argc;
char **argv;
InitOutput(
ScreenInfo *pScreenInfo,
int argc,
char **argv)
{
int i;
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@ -92,17 +87,17 @@ InitOutput(pScreenInfo, argc, argv)
}
static void
BellProc(volume, pDev)
int volume;
DeviceIntPtr pDev;
BellProc(
int volume,
DeviceIntPtr pDev)
{
return;
}
static void
KeyControlProc(pDev, ctrl)
DeviceIntPtr pDev;
KeybdCtrl *ctrl;
KeyControlProc(
DeviceIntPtr pDev,
KeybdCtrl *ctrl)
{
return;
}
@ -111,11 +106,11 @@ static KeySym printKeyMap[256];
static CARD8 printModMap[256];
static int
KeyboardProc(pKbd, what, argc, argv)
DevicePtr pKbd;
int what;
int argc;
char *argv[];
KeyboardProc(
DevicePtr pKbd,
int what,
int argc,
char *argv[])
{
KeySymsRec keySyms;
@ -143,11 +138,11 @@ KeyboardProc(pKbd, what, argc, argv)
#include "../mi/mipointer.h"
static int
PointerProc(pPtr, what, argc, argv)
DevicePtr pPtr;
int what;
int argc;
char *argv[];
PointerProc(
DevicePtr pPtr,
int what,
int argc,
char *argv[])
{
#define NUM_BUTTONS 1
CARD8 map[NUM_BUTTONS];
@ -174,11 +169,11 @@ PointerProc(pPtr, what, argc, argv)
}
void
InitInput(argc, argv)
int argc;
char **argv;
InitInput(
int argc,
char **argv)
{
DevicePtr ptr, kbd;
DeviceIntPtr ptr, kbd;
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
@ -189,28 +184,42 @@ InitInput(argc, argv)
Bool
LegalModifier(key, dev)
unsigned int key;
DevicePtr dev;
LegalModifier(
unsigned int key,
DevicePtr dev)
{
return TRUE;
}
void
ProcessInputEvents()
ProcessInputEvents(void)
{
}
#ifdef __DARWIN__
void
DarwinHandleGUI(int argc, char *argv[])
{
}
#endif
#ifdef DDXOSINIT
void
OsVendorInit()
OsVendorInit(void)
{
}
#endif
#ifdef DDXOSFATALERROR
void
OsVendorFatalError(void)
{
}
#endif
#ifdef DDXTIME
CARD32
GetTimeInMillis()
GetTimeInMillis(void)
{
struct timeval tp;
@ -226,7 +235,7 @@ GetTimeInMillis()
*
*****************************************/
void ddxUseMsg()
void ddxUseMsg(void)
{
/* Right now, let's just do nothing */
}
@ -237,20 +246,19 @@ static void Exit (code)
exit (code);
}
void AbortDDX ()
void AbortDDX (void)
{
}
void ddxGiveUp() /* Called by GiveUp() */
void ddxGiveUp(void) /* Called by GiveUp() */
{
}
int
ddxProcessArgument (argc, argv, i)
int argc;
char *argv[];
int i;
ddxProcessArgument (
int argc,
char *argv[],
int i)
{
#ifdef PRINT_ONLY_SERVER
return XprintOptions(argc, argv, i) - i;
@ -263,67 +271,76 @@ ddxProcessArgument (argc, argv, i)
#include "XI.h"
#include "XIproto.h"
#include "XIstubs.h"
extern int BadDevice;
ChangePointerDevice (old_dev, new_dev, x, y)
DeviceIntPtr old_dev;
DeviceIntPtr new_dev;
unsigned char x,y;
int
ChangePointerDevice (
DeviceIntPtr old_dev,
DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
{
return (BadDevice);
return (BadDevice);
}
int
ChangeDeviceControl (client, dev, control)
register ClientPtr client;
DeviceIntPtr dev;
xDeviceCtl *control;
ChangeDeviceControl (
register ClientPtr client,
DeviceIntPtr dev,
xDeviceCtl *control)
{
return BadMatch;
}
OpenInputDevice (dev, client, status)
DeviceIntPtr dev;
ClientPtr client;
int *status;
void
OpenInputDevice (
DeviceIntPtr dev,
ClientPtr client,
int *status)
{
return;
}
AddOtherInputDevices ()
void
AddOtherInputDevices (void)
{
return;
}
CloseInputDevice (dev, client)
DeviceIntPtr dev;
ClientPtr client;
void
CloseInputDevice (
DeviceIntPtr dev,
ClientPtr client)
{
return;
}
ChangeKeyboardDevice (old_dev, new_dev)
DeviceIntPtr old_dev;
DeviceIntPtr new_dev;
int
ChangeKeyboardDevice (
DeviceIntPtr old_dev,
DeviceIntPtr new_dev)
{
return (Success);
}
SetDeviceMode (client, dev, mode)
register ClientPtr client;
DeviceIntPtr dev;
int mode;
int
SetDeviceMode (
register ClientPtr client,
DeviceIntPtr dev,
int mode)
{
return BadMatch;
}
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
register ClientPtr client;
DeviceIntPtr dev;
int *valuators;
int first_valuator;
int num_valuators;
int
SetDeviceValuators (
register ClientPtr client,
DeviceIntPtr dev,
int *valuators,
int first_valuator,
int num_valuators)
{
return BadMatch;
}
@ -334,21 +351,19 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
#ifdef XTESTEXT1
void
XTestJumpPointer(x, y, dev)
int x, y, dev;
XTestJumpPointer(int x, int y, int dev)
{
return;
}
void
XTestGetPointerPos(x, y)
XTestGetPointerPos(int x, int y)
{
return;
}
void
XTestGenerateEvent(dev, keycode, keystate, x, y)
int dev, keycode, keystate, x, y;
XTestGenerateEvent(int dev, int keycode, int keystate, int x, int y)
{
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
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 "fontstruct.h"
#define _XP_PRINT_SERVER_
#include "Printstr.h"
#undef _XP_PRINT_SERVER_
#include "DiPrint.h"
#include "AttrValid.h"
extern XpContextPtr XpContextOfClient();
#include "attributes.h"
typedef struct {
XpOid page_size;
@ -149,8 +145,7 @@ static PageDimensionsRec PageDimensions[] =
* attributes pools have been validated.
*/
int
XpGetResolution(
XpContextPtr pContext)
XpGetResolution(XpContextPtr pContext)
{
unsigned long resolution;
@ -190,8 +185,7 @@ XpGetResolution(
* attributes pools have been validated.
*/
XpOid
XpGetContentOrientation(
XpContextPtr pContext)
XpGetContentOrientation(XpContextPtr pContext)
{
XpOid orientation;
@ -421,7 +415,7 @@ XpGetMediumMillimeters(
float *width, /* return */
float *height) /* return */
{
int i;
unsigned i;
*width = *height = 0;
for(i = 0; i < XpNumber(PageDimensions); i++)
@ -745,9 +739,7 @@ XpGetMaxWidthHeightRes(
}
FontResolutionPtr
XpGetClientResolutions(client, num)
ClientPtr client;
int *num;
XpGetClientResolutions(ClientPtr client, int *num)
{
static struct _FontResolution res;
int resolution = XpGetResolution(XpContextOfClient(client));
@ -763,15 +755,13 @@ XpGetClientResolutions(client, num)
}
void XpSetFontResFunc(client)
ClientPtr client;
void XpSetFontResFunc(ClientPtr client)
{
client->fontResFunc = XpGetClientResolutions;
}
void XpUnsetFontResFunc(client)
ClientPtr client;
void XpUnsetFontResFunc(ClientPtr client)
{
client->fontResFunc = NULL;
}

View File

@ -11,7 +11,7 @@
** * Created: 1/30/95
** *
** *********************************************************
**
**
********************************************************************/
/*
(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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.12 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCL_H_
#define _PCL_H_
@ -51,25 +52,12 @@ copyright holders.
#include <stdio.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 "Pclmap.h"
#include "PclSFonts.h"
#define _XP_PRINT_SERVER_
#include "Print.h"
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include <X11/extensions/Print.h>
#include <X11/extensions/Printstr.h>
#include "miscstruct.h"
#include "fontstruct.h"
@ -79,13 +67,16 @@ copyright holders.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
#ifndef HAVE_XPointer
typedef char *XPointer;
#endif
#define Status int
#define True 1
#define False 0
#include "misc.h"
#include <Xfuncproto.h>
#include "../Xresource.h"
#include <X11/Xfuncproto.h>
#include <X11/Xresource.h>
#include "attributes.h"
/******
* externally visible variables from PclInit.c
@ -95,6 +86,11 @@ extern int PclContextPrivateIndex;
extern int PclPixmapPrivateIndex;
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
* print contexts which use the colormap.
@ -159,8 +155,6 @@ typedef struct {
} PclWindowPrivRec, *PclWindowPrivPtr;
typedef struct {
unsigned freeCompClip;
RegionPtr pCompositeClip;
unsigned long stippleFg, stippleBg;
} PclGCPrivRec, *PclGCPrivPtr;
@ -191,7 +185,9 @@ typedef struct {
#endif /* XP_PCL_LJ3 */
#define MIN(a,b) (((a)<(b))?(a):(b))
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
/******
* Functions in PclArc.c
@ -247,18 +243,18 @@ RegionPtr PclCopyPlane(
/******
* Functions in PclAttr.c
******/
extern char *PclGetAttributes(
extern char *PclGetAttributes(
XpContextPtr pCon,
XPAttributes pool );
extern char *PclGetOneAttribute(
XpContextPtr pCon,
XPAttributes pool,
char *attr );
extern int PclAugmentAttributes(
extern int PclAugmentAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
extern int PclSetAttributes(
extern int PclSetAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
@ -284,6 +280,16 @@ extern int PclUpdateColormap(DrawablePtr pDrawable,
XpContextPtr pCon,
GCPtr gc,
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
@ -315,6 +321,27 @@ extern Bool PclSetCursorPosition(
int y,
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
******/
@ -326,7 +353,7 @@ extern int PclUpdateDrawableGC(
FILE **outFile);
extern void PclValidateGC(
GCPtr pGC,
Mask changes,
unsigned long changes,
DrawablePtr pDrawable);
extern void PclSetDrawablePrivateStuff(
DrawablePtr pDrawable,
@ -336,16 +363,34 @@ extern int PclGetDrawablePrivateStuff(
GC *gc,
unsigned long *valid,
FILE **file );
extern void PclSetDrawablePrivateGC(
DrawablePtr pDrawable,
GC gc);
extern void PclComputeCompositeClip(
GCPtr pGC,
DrawablePtr pDrawable);
/******
* 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,
ScreenPtr pScreen,
int argc,
char **argv);
static Bool PclDestroyContext( XpContextPtr pCon );
extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
/******
@ -380,6 +425,12 @@ extern int PclGetMediumDimensions(
extern int PclGetReproducibleArea(
XpContextPtr pCon,
xRectangle *pRect);
extern void PclSendData(
FILE *outFile,
PclContextPrivPtr pConPriv,
BoxPtr pbox,
int nbox,
double ratio);
/******
* Functions in PclPixel.c
@ -508,7 +559,6 @@ extern Bool PclPositionWindow(
int x,
int y);
extern Bool PclUnmapWindow(WindowPtr pWindow);
extern Bool PclUnmapWindow(WindowPtr pWindow);
extern void PclCopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
@ -569,12 +619,3 @@ extern int PclGetDocumentData(
#endif /* _PCL_H_ */

View File

@ -45,6 +45,8 @@ dealings in this Software without prior written authorization from said
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 <math.h>
#include <errno.h>
@ -52,14 +54,15 @@ copyright holders.
#include "Pcl.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "attributes.h"
static void
PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
DrawablePtr pDrawable;
GCPtr pGC;
int nArcs;
xArc *pArcs;
void (*DoIt)();
PclDoArc(
DrawablePtr pDrawable,
GCPtr pGC,
int nArcs,
xArc *pArcs,
void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
{
char t[80];
FILE *outFile;
@ -140,7 +143,7 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
r.y1 = -Arc.height / 2 - fudge;
r.x2 = Arc.width / 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" );
MACRO_END( outFile );
@ -148,14 +151,13 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Intersect the bounding box with the clip region.
*/
region = miRegionCreate( NULL, 0 );
transClip = miRegionCreate( NULL, 0 );
miRegionCopy( transClip,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2),
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
REGION_TRANSLATE( pGC->pScreen, transClip,
-(xoffset + Arc.x + Arc.width / 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
@ -177,9 +179,9 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Clean up the temporary regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
miRegionDestroy( transClip );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
REGION_DESTROY( pGC->pScreen, transClip );
}
}
@ -202,11 +204,11 @@ DrawArc(FILE *outFile,
}
void
PclPolyArc( pDrawable, pGC, nArcs, pArcs )
DrawablePtr pDrawable;
GCPtr pGC;
int nArcs;
xArc *pArcs;
PclPolyArc(
DrawablePtr pDrawable,
GCPtr pGC,
int nArcs,
xArc *pArcs)
{
PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
}
@ -246,11 +248,11 @@ DoChord(FILE *outFile,
void
PclPolyFillArc( pDrawable, pGC, nArcs, pArcs )
DrawablePtr pDrawable;
GCPtr pGC;
int nArcs;
xArc *pArcs;
PclPolyFillArc(
DrawablePtr pDrawable,
GCPtr pGC,
int nArcs,
xArc *pArcs)
{
switch( pGC->arcMode )
{

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
**
**
********************************************************************/
/*
(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
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 <sys/types.h>
@ -53,6 +54,9 @@ copyright holders.
#include "region.h"
#include "cfb.h"
#if 1
#include "cfb32.h"
#endif
void
PclPutImage(DrawablePtr pDrawable,
@ -72,10 +76,10 @@ PclPutImage(DrawablePtr pDrawable,
unsigned long oldPlanemask;
unsigned long i;
long bytesPer;
if( ( w == 0 ) || ( h == 0 ) )
return;
if( format != XYPixmap )
{
pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
@ -85,7 +89,7 @@ PclPutImage(DrawablePtr pDrawable,
depth ), (pointer)pImage );
if( !pPixmap )
return;
if( format == ZPixmap )
(void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
leftPad, 0, w, h, x, y );
@ -104,7 +108,7 @@ PclPutImage(DrawablePtr pDrawable,
if( !pPixmap )
return;
depth = pGC->depth;
oldPlanemask = pGC->planemask;
oldFg = pGC->fgPixel;
@ -113,12 +117,11 @@ PclPutImage(DrawablePtr pDrawable,
gcv[1] = 0;
DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
bytesPer = (long)h * BitmapBytePad( w + leftPad );
for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
{
if( i & oldPlanemask )
{
extern void cfbPutImage(), cfb32PutImage();
gcv[0] = i;
DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
ValidateGC( pDrawable, pGC );
@ -160,16 +163,16 @@ PclMonoPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
/*
* 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;
w = BitmapBytePad( x2 - x1 );
bits = (char *)xalloc( h * w );
mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
XYPixmap, ~0, bits );
/*
@ -179,7 +182,7 @@ PclMonoPixmapFragment(FILE *outFile,
*/
sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
SEND_PCL( outFile, t );
/*
* Now, wrap the raster in the appropriate PCL code. Right now,
* 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",
h, x2 - x1 );
SEND_PCL( outFile, t );
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i <= h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
SEND_PCL( outFile, "\033*rC" );
/*
@ -216,21 +219,20 @@ PclColorPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
extern void cfbGetImage(), cfb32GetImage();
/*
* 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;
w = PixmapBytePad( x2 - x1, pix->drawable.depth );
bits = (char *)xalloc( h * w );
if (pix->drawable.depth <= 8)
cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits );
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 );
/*
@ -249,16 +251,16 @@ PclColorPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
h, x2 - x1 );
SEND_PCL( outFile, t );
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i < h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
SEND_PCL( outFile, "\033*rC" );
/*
* Clean things up a bit
*/
@ -277,22 +279,20 @@ PclCopyArea(DrawablePtr pSrc,
int dsty)
{
PixmapPtr pixSrc = (PixmapPtr)pSrc;
char t[80];
FILE *srcFile, *dstFile;
GC srcGC, dstGC;
/*
FILE *srcFile;
GC srcGC;
*/
FILE *dstFile;
GC dstGC;
unsigned long valid;
struct stat statBuf;
XpContextPtr pCon;
xRectangle repro;
PclPixmapPrivPtr pPriv;
RegionPtr drawRegion, region, whole, ret;
BoxRec box;
BoxPtr prect;
int nrect;
void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
short, short );
extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea();
/*
* Since we don't store any information on a per-window basis, we
* can't copy from a window.
@ -321,7 +321,7 @@ PclCopyArea(DrawablePtr pSrc,
PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
*/
PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
/*
* 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
@ -331,14 +331,11 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = srcy;
box.x2 = srcx + width;
box.y2 = srcy + height;
drawRegion = miRegionCreate( &box, 0 );
miTranslateRegion( drawRegion, dstx, dsty );
region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion,
((PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr))
->pCompositeClip );
drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* Now select the operation to be performed on each box in the
@ -348,7 +345,7 @@ PclCopyArea(DrawablePtr pSrc,
doFragment = PclMonoPixmapFragment;
else
doFragment = PclColorPixmapFragment;
/*
* Actually draw each section of the bitmap.
*/
@ -360,18 +357,18 @@ PclCopyArea(DrawablePtr pSrc,
(*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
prect->y1 - dsty, prect->x2 - dstx,
prect->y2 - dsty, prect->x1, prect->y1 );
nrect--;
prect++;
}
/*
* Update the destination's GC to the source's GC.
*/
/*
PclSetDrawablePrivateGC( pDst, srcGC );
*/
/*
* Determine the region that needs to be returned. This is the
* region of the source that falls outside the boundary of the
@ -381,24 +378,24 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = 0;
box.x2 = pixSrc->drawable.width;
box.y2 = pixSrc->drawable.height;
whole = miRegionCreate( &box, 0 );
ret = miRegionCreate( NULL, 0 );
miTranslateRegion( drawRegion, -dstx, -dsty );
miSubtract( ret, drawRegion, whole );
whole = REGION_CREATE( pGC->pScreen, &box, 0 );
ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
/*
* Clean up the regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
miRegionDestroy( whole );
if( miRegionNotEmpty( ret ) )
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
REGION_DESTROY( pGC->pScreen, whole );
if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
return ret;
else
{
miRegionDestroy( ret );
REGION_DESTROY( pGC->pScreen, ret );
return NULL;
}
}
@ -418,20 +415,19 @@ PclCopyPlane(DrawablePtr pSrc,
RegionPtr reg;
GCPtr scratchGC;
PixmapPtr scratchPix;
extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane();
/*
* Since we don't store PCL on a per-window basis, there's no good
* way to copy from a window.
*/
if( pSrc->type == DRAWABLE_WINDOW )
return NULL;
/*
* Copying from a pixmap to a pixmap is already implemented by
* mfb/cfb.
*/
if( pSrc->type == DRAWABLE_PIXMAP &&
if( pSrc->type == DRAWABLE_PIXMAP &&
pDst->type == DRAWABLE_PIXMAP )
{
if( pDst->depth == 1 )
@ -452,7 +448,7 @@ PclCopyPlane(DrawablePtr pSrc,
*/
scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
height, pDst->depth );
scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
CopyGC( pGC, scratchGC, ~0L );
@ -474,14 +470,13 @@ PclCopyPlane(DrawablePtr pSrc,
cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
srcx, srcy, width, height, 0, 0, plane );
}
reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
height, dstx, dsty );
FreeScratchGC( scratchGC );
(*pDst->pScreen->DestroyPixmap)( scratchPix );
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
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 <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <math.h>
@ -58,18 +60,7 @@ copyright holders.
#include "resource.h"
#include "Pcl.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);
#include "cfb.h"
static void lookup(unsigned char *src,
unsigned char *dst,
@ -166,7 +157,7 @@ void
PclDestroyColormap(ColormapPtr pColor)
{
PclScreenPrivPtr sPriv;
PclCmapToContexts *pCmap, *tCmap;
PclCmapToContexts *pCmap, *tCmap = 0;
PclContextListPtr con, tCon;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pPal;
@ -263,7 +254,7 @@ PclStoreColors(ColormapPtr pColor,
PclContextListPtr con;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pMap;
char t[80], t2[30];
char t[80];
int i;
sPriv = (PclScreenPrivPtr)pColor->pScreen
@ -425,7 +416,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
* If the requested colormap is already active, nothing needs to
* be done.
*/
return;
return FALSE;
/*
* Now we activate the palette in the printer
@ -478,10 +469,10 @@ PclUpdateColormap(DrawablePtr pDrawable,
SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
/* 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 );
sprintf( t, "\033*v32767a32767b32767c%dI",
cmap->pScreen->whitePixel );
sprintf( t, "\033*v32767a32767b32767c%ldI",
(long) cmap->pScreen->whitePixel );
SEND_PCL( cPriv->pPageFile, t );
#endif /* XP_PCL_COLOR */
}
@ -637,6 +628,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
}
pMap->downloaded = 1;
}
return TRUE;
}
@ -725,7 +717,7 @@ unsigned char *PclReadMap(char *name, int *dim)
fseek(fp, 0, SEEK_SET);
if (fread(data, sizeof(char), size, fp) != size) {
if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
fclose(fp);
free(data);
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)
{
int i;
unsigned char *p1, *p2, *p3;
int shift, offset;
#define _INTERPOLATE
#ifndef _INTERPOLATE
unsigned char *p1, *p2, *p3;
for (i=0; i<num; i++) {
p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
*dst++ = *p1++;
@ -794,7 +786,7 @@ static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, in
d000, d001, d010, d011,
d100, d101, d110, d111,
dx00, dx01, dx10, dx11,
dxy0, dxy1, dxyz;
dxy0, dxy1;
float scale;
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclCursor.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include <stdio.h>
@ -52,59 +53,59 @@ copyright holders.
#include "windowstr.h"
void
PclConstrainCursor( pScreen, pBox )
ScreenPtr pScreen;
BoxPtr pBox;
PclConstrainCursor(
ScreenPtr pScreen,
BoxPtr pBox)
{
}
void
PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox )
ScreenPtr pScreen;
CursorPtr pCursor;
BoxPtr pHotBox;
BoxPtr pTopLeftBox;
PclCursorLimits(
ScreenPtr pScreen,
CursorPtr pCursor,
BoxPtr pHotBox,
BoxPtr pTopLeftBox)
{
}
Bool
PclDisplayCursor( pScreen, pCursor )
ScreenPtr pScreen;
CursorPtr pCursor;
PclDisplayCursor(
ScreenPtr pScreen,
CursorPtr pCursor)
{
return True;
}
Bool
PclRealizeCursor( pScreen, pCursor )
ScreenPtr pScreen;
CursorPtr pCursor;
PclRealizeCursor(
ScreenPtr pScreen,
CursorPtr pCursor)
{
return True;
}
Bool
PclUnrealizeCursor( pScreen, pCursor )
ScreenPtr pScreen;
CursorPtr pCursor;
PclUnrealizeCursor(
ScreenPtr pScreen,
CursorPtr pCursor)
{
return True;
}
void
PclRecolorCursor( pScreen, pCursor, displayed )
ScreenPtr pScreen;
CursorPtr pCursor;
Bool displayed;
PclRecolorCursor(
ScreenPtr pScreen,
CursorPtr pCursor,
Bool displayed)
{
}
Bool
PclSetCursorPosition( pScreen, x, y, generateEvent )
ScreenPtr pScreen;
int x;
int y;
Bool generateEvent;
PclSetCursorPosition(
ScreenPtr pScreen,
int x,
int y,
Bool generateEvent)
{
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.10 2001/10/28 03:32:54 tsi Exp $ */
#include "gcstruct.h"
@ -51,6 +52,8 @@ copyright holders.
#include "pixmapstr.h"
#include "colormapst.h"
#include "windowstr.h"
#include "cfb.h"
#include "cfb32.h"
#include "migc.h"
#include "scrnintstr.h"
#include "resource.h"
@ -97,11 +100,8 @@ static GCFuncs PclGCFuncs =
;
Bool
PclCreateGC( pGC )
GCPtr pGC;
PclCreateGC(GCPtr pGC)
{
PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
if( pGC->depth == 1 )
{
if( mfbCreateGC( pGC ) == FALSE )
@ -125,36 +125,25 @@ PclCreateGC( pGC )
pGC->ops = &PclGCOps;
pGC->funcs = &PclGCFuncs;
pPriv->pCompositeClip = NULL;
pPriv->freeCompClip = FALSE;
return TRUE;
}
void
PclDestroyGC(GCPtr pGC)
{
PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
extern int mfbGCPrivateIndex;
/* Handle the mfb and cfb, which share a GC private struct */
miRegisterGCPrivateIndex( mfbGCPrivateIndex );
miDestroyGC( pGC );
if( pPriv->freeCompClip == TRUE )
REGION_DESTROY( pGC->pScreen, pPriv->pCompositeClip );
}
int
PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
DrawablePtr pDrawable;
GC *gc;
unsigned long *valid;
FILE **file;
PclGetDrawablePrivateStuff(
DrawablePtr pDrawable,
GC *gc,
unsigned long *valid,
FILE **file)
{
XpContextPtr pCon;
PclPixmapPrivPtr pPriv;
PclContextPrivPtr cPriv;
switch( pDrawable->type )
@ -185,9 +174,9 @@ PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
}
void
PclSetDrawablePrivateGC( pDrawable, gc )
DrawablePtr pDrawable;
GC gc;
PclSetDrawablePrivateGC(
DrawablePtr pDrawable,
GC gc)
{
PixmapPtr pix;
XpContextPtr pCon;
@ -332,19 +321,17 @@ PclSendPattern(char *bits,
}
int
PclUpdateDrawableGC( pGC, pDrawable, outFile )
GCPtr pGC;
DrawablePtr pDrawable;
FILE **outFile;
PclUpdateDrawableGC(
GCPtr pGC,
DrawablePtr pDrawable,
FILE **outFile)
{
Mask drawableMask, changeMask = 0;
Mask changeMask = 0;
GC dGC;
unsigned long valid;
int i;
XpContextPtr pCon;
PclContextPrivPtr cPriv;
Colormap c;
ColormapPtr cmap;
PclGCPrivPtr gcPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr);
@ -403,12 +390,14 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
changeMask |= GCTileStipYOrigin;
if( dGC.numInDashList == pGC->numInDashList )
{
for( i = 0; i < dGC.numInDashList; i++ )
if( cPriv->dash[i] != pGC->dash[i] )
{
changeMask |= GCDashList;
break;
}
}
else
changeMask |= GCDashList;
}
@ -513,9 +502,11 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCForeground )
{
#ifdef XP_PCL_COLOR
ColormapPtr cmap;
Colormap c;
char t[40];
#ifdef XP_PCL_COLOR
c = wColormap( ((WindowPtr)pDrawable) );
cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
@ -538,7 +529,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
}
else /* PseudoColor or StaticGray */
{
sprintf( t, "SP%d;", pGC->fgPixel );
sprintf( t, "SP%ld;", (long) pGC->fgPixel );
SEND_PCL( *outFile, t );
}
#else
@ -654,9 +645,8 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCTile && !pGC->tileIsPixel )
{
char t[80], *bits, *row, *mod;
int h, w, w2, sz;
int i, j;
char *bits;
int h, w, sz;
h = pGC->tile.pixmap->drawable.height;
w = pGC->tile.pixmap->drawable.width;
@ -666,7 +656,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
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 );
xfree( bits );
}
@ -674,7 +664,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
sz = h * PixmapBytePad( w, 8 );
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 );
xfree( bits );
}
@ -684,7 +674,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * PixmapBytePad( w, 24 );
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 );
xfree( bits );
}
@ -723,7 +713,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
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 );
/*
@ -766,10 +756,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
mfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
mfbCopyPlane( pGC->stipple,
mfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0,
mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
bits );
}
else if( pGC->depth <= 32 )
@ -777,10 +767,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
#if PSZ == 8
cfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
cfbCopyPlane( pGC->stipple,
cfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0,
cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0,
bits );
#else
cfb32ValidateGC( scratchGC, ~0L,
@ -868,14 +858,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
void
PclComputeCompositeClip(pGC, pDrawable)
GCPtr pGC;
DrawablePtr pDrawable;
PclComputeCompositeClip(
GCPtr pGC,
DrawablePtr pDrawable)
{
ScreenPtr pScreen = pGC->pScreen;
PclGCPrivPtr devPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr);
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWin = (WindowPtr) pDrawable;
@ -892,7 +878,7 @@ PclComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
freeCompClip = devPriv->freeCompClip;
freeCompClip = pGC->freeCompClip;
/*
* 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 (freeCompClip)
REGION_DESTROY(pScreen, devPriv->pCompositeClip);
devPriv->pCompositeClip = pregWin;
devPriv->freeCompClip = freeTmpClip;
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
}
else
{
@ -919,30 +905,31 @@ PclComputeCompositeClip(pGC, pDrawable)
* 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->y + pGC->clipOrg.y);
if (freeCompClip)
{
REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip,
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
REGION_DESTROY(pScreen, pregWin);
REGION_DESTROY(pGC->pScreen, pregWin);
}
else if (freeTmpClip)
{
REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
devPriv->pCompositeClip = pregWin;
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
pGC->clientClip);
pGC->pCompositeClip = pregWin;
}
else
{
devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
devPriv->freeCompClip = TRUE;
REGION_TRANSLATE(pScreen, pGC->clientClip,
pGC->freeCompClip = TRUE;
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
@ -957,23 +944,23 @@ PclComputeCompositeClip(pGC, pDrawable)
pixbounds.x2 = pDrawable->width;
pixbounds.y2 = pDrawable->height;
if (devPriv->freeCompClip)
if (pGC->freeCompClip)
{
REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds);
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
}
else
{
devPriv->freeCompClip = TRUE;
devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
pGC->freeCompClip = TRUE;
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
devPriv->pCompositeClip, pGC->clientClip);
REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
} /* end of composite clip for pixmap */
@ -992,16 +979,11 @@ PclComputeCompositeClip(pGC, pDrawable)
/*ARGSUSED*/
void
PclValidateGC( pGC, changes, pDrawable )
GCPtr pGC;
Mask changes;
DrawablePtr pDrawable;
PclValidateGC(
GCPtr pGC,
unsigned long changes,
DrawablePtr pDrawable)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
extern int mfbGCPrivateIndex;
extern int cfbGCPrivateIndex;
/*
* Pixmaps should be handled by their respective validation
* functions.
@ -1010,16 +992,13 @@ PclValidateGC( pGC, changes, pDrawable )
{
if( pDrawable->depth == 1 )
{
miRegisterGCPrivateIndex( mfbGCPrivateIndex );
mfbValidateGC( pGC, ~0, pDrawable );
}
else if( pDrawable->depth <= 32 )
{
#if PSZ == 8
miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfbValidateGC( pGC, ~0, pDrawable );
#else
miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfb32ValidateGC( pGC, ~0, pDrawable );
#endif
}
@ -1061,4 +1040,3 @@ PclValidateGC( pGC, changes, pDrawable )
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
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 <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "Pcl.h"
#include "AttrValid.h"
#include "cfb.h"
#include "Xos.h" /* for unlink() */
#include "attributes.h"
#include "windowstr.h"
#include "DiPrint.h"
#define MODELDIRNAME "/models"
extern char *XpGetConfigDir();
static void AllocatePclPrivates(
ScreenPtr pScreen);
static void AllocatePclPrivates(ScreenPtr pScreen);
static int PclInitContext(XpContextPtr pCon);
extern Bool _XpBoolNoop();
extern void _XpVoidNoop();
extern unsigned char *PclReadMap(char *, int *);
static Bool PclDestroyContext(XpContextPtr pCon);
int PclScreenPrivateIndex;
int PclContextPrivateIndex;
@ -153,46 +149,24 @@ Bool
PclCloseScreen(int index,
ScreenPtr pScreen)
{
Bool status = Success;
PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
/*
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
pScreen->CloseScreen = pPriv->CloseScreen;
xfree( pPriv );
return status;
return (*pScreen->CloseScreen)(index, pScreen);
}
Bool
InitializePclDriver(ndx, pScreen, argc, argv)
int ndx;
ScreenPtr pScreen;
int argc;
char **argv;
InitializePclDriver(
int ndx,
ScreenPtr pScreen,
int argc,
char **argv)
{
int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes;
int i;
int maxRes, xRes, yRes, maxDim;
unsigned i;
PclScreenPrivPtr pPriv;
char **printerNames;
int numPrinters;
/*
* 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)
*/
for( i = 0; i < pScreen->numDepths; i++ )
for( i = 0; (int) i < pScreen->numDepths; i++ )
xfree( pScreen->allowedDepths[i].vids );
xfree( pScreen->allowedDepths );
xfree( pScreen->visuals );
@ -236,19 +210,19 @@ InitializePclDriver(ndx, pScreen, argc, argv)
maxRes );
#endif /* XP_PCL_COLOR */
miInitializeBackingStore ( pScreen );
pScreen->defColormap = FakeClientID(0);
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
/*
pPriv->CloseScreen = pScreen->CloseScreen;
*/
pScreen->CloseScreen = PclCloseScreen;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
pScreen->SaveScreen = _XpBoolNoop;
pScreen->GetImage = _XpVoidNoop;
pScreen->GetSpans = _XpVoidNoop;
pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PclCreateWindow;
pScreen->DestroyWindow = PclDestroyWindow;
/*
@ -316,30 +290,29 @@ InitializePclDriver(ndx, pScreen, argc, argv)
}
static void
AllocatePclPrivates(
ScreenPtr pScreen)
AllocatePclPrivates(ScreenPtr pScreen)
{
static int PclGeneration = -1;
static unsigned long PclGeneration = 0;
if(PclGeneration != serverGeneration)
if((unsigned long) PclGeneration != serverGeneration)
{
PclScreenPrivateIndex = AllocateScreenPrivateIndex();
PclWindowPrivateIndex = AllocateWindowPrivateIndex();
AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
sizeof( PclWindowPrivRec ) );
AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
sizeof( PclWindowPrivRec ) );
PclContextPrivateIndex = XpAllocateContextPrivateIndex();
XpAllocateContextPrivate( PclContextPrivateIndex,
sizeof( PclContextPrivRec ) );
XpAllocateContextPrivate( PclContextPrivateIndex,
sizeof( PclContextPrivRec ) );
PclGCPrivateIndex = AllocateGCPrivateIndex();
AllocateGCPrivate( pScreen, PclGCPrivateIndex,
sizeof( PclGCPrivRec ) );
AllocateGCPrivate( pScreen, PclGCPrivateIndex,
sizeof( PclGCPrivRec ) );
PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
sizeof( PclPixmapPrivRec ) );
AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
sizeof( PclPixmapPrivRec ) );
PclGeneration = serverGeneration;
}
@ -364,8 +337,7 @@ static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex";
static int
PclInitContext( pCon )
XpContextPtr pCon;
PclInitContext(XpContextPtr pCon)
{
XpDriverFuncsPtr pFuncs;
PclContextPrivPtr pConPriv;
@ -373,7 +345,6 @@ PclInitContext( pCon )
char *modelID;
char *configDir;
char *pathName;
extern XpValidatePoolsRec PclValidatePoolsRec;
int i, j;
float width, height;
XpOidMediumDiscreteSizeList* ds_list;
@ -392,16 +363,16 @@ PclInitContext( pCon )
pFuncs = &( pCon->funcs );
pFuncs->StartJob = PclStartJob;
pFuncs->EndJob = PclEndJob;
pFuncs->StartDoc = (int (*)())PclStartDoc;
pFuncs->StartDoc = PclStartDoc;
pFuncs->EndDoc = PclEndDoc;
pFuncs->StartPage = PclStartPage;
pFuncs->EndPage = PclEndPage;
pFuncs->PutDocumentData = PclDocumentData;
pFuncs->GetDocumentData = PclGetDocumentData;
pFuncs->GetAttributes = (char *(*)())PclGetAttributes;
pFuncs->SetAttributes = (int (*)())PclSetAttributes;
pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes;
pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute;
pFuncs->GetAttributes = PclGetAttributes;
pFuncs->SetAttributes = PclSetAttributes;
pFuncs->AugmentAttributes = PclAugmentAttributes;
pFuncs->GetOneAttribute = PclGetOneAttribute;
pFuncs->DestroyContext = PclDestroyContext;
pFuncs->GetMediumDimensions = PclGetMediumDimensions;
pFuncs->GetReproducibleArea = PclGetReproducibleArea;
@ -541,8 +512,7 @@ PclInitContext( pCon )
}
static Bool
PclDestroyContext( pCon )
XpContextPtr pCon;
PclDestroyContext(XpContextPtr pCon)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@ -639,8 +609,7 @@ PclDestroyContext( pCon )
}
XpContextPtr
PclGetContextFromWindow( win )
WindowPtr win;
PclGetContextFromWindow(WindowPtr win)
{
PclWindowPrivPtr pPriv;

View File

@ -11,7 +11,7 @@
** * Created: 10/11/95
** *
** *********************************************************
**
**
********************************************************************/
/*
(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
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 "gcstruct.h"
@ -80,16 +81,16 @@ copyright holders.
*/
void
PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
DrawablePtr pDrawable;
GCPtr pGC;
int mode;
int nPoints;
xPoint *pPoints;
PclPolyLine(
DrawablePtr pDrawable,
GCPtr pGC,
int mode,
int nPoints,
xPoint *pPoints)
{
char t[80], window[80];
char t[80];
FILE *outFile;
int xoffset, yoffset;
int xoffset = 0, yoffset = 0;
int nbox;
BoxPtr pbox;
xRectangle *drawRects, *r;
@ -98,7 +99,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
int i;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@ -110,7 +111,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Allocate the storage required to deal with the clipping
* regions.
*/
region = miRegionCreate( NULL, 0 );
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (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.
*/
fudge = 3 * pGC->lineWidth + 1;
/*
* Generate the PCL code to draw the polyline, by defining it as a
* 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,
pPoints[0].y + pDrawable->y );
SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
switch( mode )
{
case CoordModeOrigin:
xoffset = pDrawable->x;
yoffset = pDrawable->y;
SAVE_PCL( outFile, pConPriv, "PA" );
SAVE_PCL( outFile, pConPriv, "PA" );
break;
case CoordModePrevious:
xoffset = yoffset = 0;
SAVE_PCL( outFile, pConPriv, "PR" );
SAVE_PCL( outFile, pConPriv, "PR" );
break;
}
/*
* Build the "drawing region" as we build the PCL to draw the
* line.
@ -154,13 +155,13 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
sprintf( t, "%d,%d", pPoints[i].x + xoffset,
pPoints[i].y + yoffset );
SAVE_PCL( outFile, pConPriv, t );
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->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
* 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 )
miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire polyline to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
PclPolySegment( pDrawable, pGC, nSegments, pSegments )
DrawablePtr pDrawable;
GCPtr pGC;
int nSegments;
xSegment *pSegments;
PclPolySegment(
DrawablePtr pDrawable,
GCPtr pGC,
int nSegments,
xSegment *pSegments)
{
FILE *outFile, *dummy;
char t[80];
@ -214,8 +214,8 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
GC cacheGC;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@ -226,7 +226,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
/*
* Allocate the storage for the temporary regions.
*/
region = miRegionCreate( NULL, 0 );
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)
xalloc( nSegments * sizeof( xRectangle ) );
@ -234,12 +234,12 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Calculate the fudge factor, based on the line width
*/
fudge = pGC->lineWidth * 3 + 1;
/*
* Turn off line joining.
*/
SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
/*
* Generate the PCL code to draw the segments, by defining them as
* a macro which uses the HP-GL/2 line drawing function.
@ -254,7 +254,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nSegments; i++, r++ )
{
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
* intersect it with the clip region.
*/
drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
drawRects, CT_UNSORTED );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire set of segments to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
@ -303,12 +302,11 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
cacheGC.joinStyle = !cacheGC.joinStyle;
PclSetDrawablePrivateGC( pDrawable, cacheGC );
PclUpdateDrawableGC( pGC, pDrawable, &outFile );
/*
* Clean up
* Clean up
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
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
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 <stdio.h>
#include "Pcl.h"
#include "cursor.h"
@ -54,6 +58,7 @@ copyright holders.
#include "windowstr.h"
#include "propertyst.h"
#include "attributes.h"
/*ARGSUSED*/
@ -142,12 +147,14 @@ GetPropString(
}
#include <signal.h>
#include <errno.h>
/* ARGSUSED */
static void SigchldHndlr (
int dummy)
{
int status, w;
int olderrno = errno;
struct sigaction act;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
@ -159,6 +166,7 @@ static void SigchldHndlr (
* Is this really necessary?
*/
sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
errno = olderrno;
}
/*
@ -248,6 +256,7 @@ char *ptr;
* in the clipped area.
* For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
*/
void
PclSendData(
FILE *outFile,
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixel.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@ -60,7 +61,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
int nPoints;
xPoint *pPoints;
{
char t[80], *command;
char t[80];
FILE *outFile;
int xoffset, yoffset;
BoxRec box;
@ -84,7 +85,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
xloc = pPoints[0].x + pDrawable->x;
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 );
/*
@ -94,7 +95,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
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 );
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
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 "cfb.h"*/
/* #include "mfb.h" */
#include "cfb.h"
#include "cfb32.h"
#include "mfb.h"
#include "pixmapstr.h"
PixmapPtr
@ -56,25 +58,24 @@ PclCreatePixmap(ScreenPtr pScreen,
int height,
int depth)
{
extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap();
if( depth == 1 )
return mfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 8 )
return cfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 32 )
return cfb32CreatePixmap( pScreen, width, height, depth );
return 0;
}
Bool
PclDestroyPixmap(PixmapPtr pPixmap)
{
extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap();
if( pPixmap->drawable.depth == 1 )
return mfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 8 )
return cfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 32 )
return cfb32DestroyPixmap( pPixmap );
return 0;
}

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
**
**
********************************************************************/
/*
(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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@ -51,11 +52,11 @@ copyright holders.
#include "windowstr.h"
void
PclPolyRectangle( pDrawable, pGC, nRects, pRects )
DrawablePtr pDrawable;
GCPtr pGC;
int nRects;
xRectangle *pRects;
PclPolyRectangle(
DrawablePtr pDrawable,
GCPtr pGC,
int nRects,
xRectangle *pRects)
{
char t[80];
FILE *outFile;
@ -67,23 +68,23 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
int xoffset, yoffset;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
/*
* 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 ) );
fudge = 3 * pGC->lineWidth + 1;
/*
* Generate the PCL code to draw the rectangles, by defining them
* as a macro which uses the HP-GL/2 rectangle drawing function.
@ -93,13 +94,13 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
/* 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 );
SAVE_PCL( outFile, pConPriv, t );
@ -113,49 +114,47 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
/*
* Convert the collection of rectangles to a proper region, then
* 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
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
DrawablePtr pDrawable;
GCPtr pGC;
int shape;
int mode;
int nPoints;
DDXPointPtr pPoints;
PclFillPolygon(
DrawablePtr pDrawable,
GCPtr pGC,
int shape,
int mode,
int nPoints,
DDXPointPtr pPoints)
{
char t[80];
FILE *outFile;
int nbox, i;
BoxPtr pbox;
BoxRec box;
xRectangle *drawRects, *r;
RegionPtr drawRegion, region;
int xoffset, yoffset;
int xtop, xbottom, yleft, yright;
@ -163,14 +162,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
char *command;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
/*
* Generate the PCL code to draw the filled polygon, by defining
* 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;
command = "PR";
}
/* Begin the polygon */
sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ yoffset, command );
@ -198,13 +197,13 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
/* Seed the bounding box */
xtop = xbottom = pPoints[0].x + xoffset;
yleft = yright = pPoints[0].y + yoffset;
/* Add the rest of the points to the polygon */
for( i = 1; i < nPoints; i++ )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
yoffset );
SAVE_PCL( outFile, pConPriv, t );
@ -222,7 +221,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
fillRule = 0;
else
fillRule = 1;
sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
SAVE_PCL( outFile, pConPriv, t );
MACRO_END ( outFile );
@ -234,16 +233,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
box.y1 = yleft;
box.x2 = xbottom;
box.y2 = yright;
drawRegion = miRegionCreate( &box, 0 );
drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
if( mode == CoordModePrevious )
miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
region = miRegionCreate( NULL, 0 );
REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* 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 );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
}
void
PclPolyFillRect( pDrawable, pGC, nRects, pRects )
DrawablePtr pDrawable;
GCPtr pGC;
int nRects;
xRectangle *pRects;
PclPolyFillRect(
DrawablePtr pDrawable,
GCPtr pGC,
int nRects,
xRectangle *pRects)
{
char t[80];
FILE *outFile;
@ -278,24 +275,24 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
short fudge;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
/*
* Allocate the storage required to deal with the clipping
* regions.
*/
region = miRegionCreate( NULL, 0 );
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1;
/*
* Generate the PCL code to draw the filled rectangles, by
* 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 );
SAVE_PCL( outFile, pConPriv, "\033%0B" );
xoffset = pDrawable->x;
yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
/* Draw the rectangle */
sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
/* Build the bounding box */
r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
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 */
MACRO_END( outFile );
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
drawRects, CT_UNSORTED );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
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
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 <string.h>
@ -63,20 +64,14 @@ copyright holders.
#include "AttrValid.h"
#include "Oid.h"
extern PclSoftFontInfoPtr PclCreateSoftFontInfo();
extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr);
int
PclStartJob( pCon, sendClientData, client )
XpContextPtr pCon;
Bool sendClientData;
ClientPtr client;
PclStartJob(
XpContextPtr pCon,
Bool sendClientData,
ClientPtr client)
{
PclContextPrivPtr pConPriv =
(PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
char *jobHeader;
char s[40];
PclPaletteMap *pal;
/*
@ -128,9 +123,9 @@ PclStartJob( pCon, sendClientData, client )
}
int
PclEndJob( pCon, cancel )
XpContextPtr pCon;
Bool cancel;
PclEndJob(
XpContextPtr pCon,
Bool cancel)
{
PclContextPrivPtr priv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@ -143,7 +138,7 @@ PclEndJob( pCon, cancel )
char *fileName, *trailer;
struct stat statBuf;
int n;
PclPaletteMapPtr p, t;
PclPaletteMapPtr p;
trailer = "\033%-12345X@PJL RESET\n";
@ -152,7 +147,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
priv->getDocClient == NULL;
priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@ -183,7 +178,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
priv->getDocClient == NULL;
priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@ -249,11 +244,10 @@ PclEndJob( pCon, cancel )
* ClearArea the window and all descendant windows
*/
int
PclStartPage( pCon, pWin )
XpContextPtr pCon;
WindowPtr pWin;
PclStartPage(
XpContextPtr pCon,
WindowPtr pWin)
{
register WindowPtr pChild;
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv =
@ -261,9 +255,7 @@ PclStartPage( pCon, pWin )
xRectangle repro;
char t[80];
XpOid orient, plex, tray, medium;
unsigned short wid, ht;
int dir, plexNum, num;
xEvent event;
/*
* Put a pointer to the context in the window private structure
@ -490,14 +482,12 @@ SendDocData( PclContextPrivPtr pPriv )
* Write page file to job file
*/
int
PclEndPage( pCon, pWin )
XpContextPtr pCon;
WindowPtr pWin;
PclEndPage(
XpContextPtr pCon,
WindowPtr pWin)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv =
(PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
struct stat statBuf;
@ -566,9 +556,9 @@ PclStartDoc(XpContextPtr pCon,
}
int
PclEndDoc( pCon, cancel )
XpContextPtr pCon;
Bool cancel;
PclEndDoc(
XpContextPtr pCon,
Bool cancel)
{
/*
* XXX What should I do if I get cancel == TRUE?
@ -588,18 +578,18 @@ PclEndDoc( pCon, cancel )
#define DOC_HPGL 2
int
PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client)
XpContextPtr pCon;
DrawablePtr pDraw;
char *pData;
int len_data;
char *pFmt;
int len_fmt;
char *pOpt;
int len_opt;
ClientPtr client;
PclDocumentData(
XpContextPtr pCon,
DrawablePtr pDraw,
char *pData,
int len_data,
char *pFmt,
int len_fmt,
char *pOpt,
int len_opt,
ClientPtr client)
{
int type;
int type = 0;
PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
XpOidDocFmtList *formats;
@ -703,10 +693,10 @@ PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, cli
*/
int
PclGetDocumentData( pCon, client, maxBufferSize )
XpContextPtr pCon;
ClientPtr client;
int maxBufferSize;
PclGetDocumentData(
XpContextPtr pCon,
ClientPtr client,
int maxBufferSize)
{
PclContextPrivPtr pPriv = (PclContextPrivPtr)
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@ -75,8 +76,7 @@ PclDownloadSoftFont8(
PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead8Ptr pfh,
PclCharDataPtr pcd,
unsigned char *code,
int flag
unsigned char *code
)
{
/*
@ -103,8 +103,7 @@ PclDownloadSoftFont16(
PclFontHead16Ptr pfh,
PclCharDataPtr pcd,
unsigned char row,
unsigned char col,
int flag
unsigned char col
)
{
/*
@ -129,8 +128,7 @@ PclDownloadSoftFont16(
* of the downloaded soft font.
* **************************************************************************/
PclSoftFontInfoPtr
PclCreateSoftFontInfo(
)
PclCreateSoftFontInfo(void)
{
PclSoftFontInfoPtr pSoftFontInfo;
@ -154,7 +152,7 @@ PclFontHead8Ptr pfh8, pfh8_next;
PclFontHead16Ptr pfh16, pfh16_next;
PclInternalFontPtr pin, pin_next;
unsigned char nindex_row, nindex_col;
int i, j;
int i;
if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
return;

View File

@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
**
**
********************************************************************/
/*
(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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.6 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@ -51,33 +52,33 @@ copyright holders.
#include "windowstr.h"
void
PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
DrawablePtr pDrawable;
GCPtr pGC;
int nSpans;
DDXPointPtr pPoints;
int *pWidths;
int fSorted;
PclFillSpans(
DrawablePtr pDrawable,
GCPtr pGC,
int nSpans,
DDXPointPtr pPoints,
int *pWidths,
int fSorted)
{
char t[80];
FILE *outFile;
int xoffset, yoffset;
xRectangle *rects, *r;
RegionPtr fillRegion, region;
RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
/*
* Build a region out of the spans
*/
rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
xoffset = pDrawable->x;
yoffset = pDrawable->y;
for( i = 0, r = rects; i < nSpans; i++, r++ )
{
r->x = pPoints[i].x + xoffset;
@ -85,15 +86,15 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
r->width = pWidths[i];
r->height = 1;
}
fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ?
fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
CT_YSORTED : CT_UNSORTED );
/*
* Intersect this region with the clip region. Whatever's left,
* should be filled.
*/
miIntersect( region, fillRegion, pGC->clientClip );
REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
@ -102,35 +103,33 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
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 );
SEND_PCL( outFile, t );
nbox--;
pbox++;
}
/* Go back to PCL */
SEND_PCL( outFile, "\27%0A" );
/*
* Clean up the temporary regions
*/
miRegionDestroy( fillRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, fillRegion );
REGION_DESTROY( pGC->pScreen, region );
xfree( rects );
}
void
PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted )
DrawablePtr pDrawable;
GCPtr pGC;
char *pSrc;
DDXPointPtr pPoints;
int *pWidths;
int nSpans;
int fSorted;
PclSetSpans(
DrawablePtr pDrawable,
GCPtr pGC,
char *pSrc,
DDXPointPtr pPoints,
int *pWidths,
int nSpans,
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
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
#include "iconv.h"
@ -81,13 +82,13 @@ static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
#define INTERNAL_FONT 1
int
PclPolyText8( pDrawable, pGC, x, y, count, string )
DrawablePtr pDrawable;
GCPtr pGC;
int x;
int y;
int count;
char *string;
PclPolyText8(
DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
int count,
char *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@ -181,8 +182,6 @@ char font_type;
MACRO_END( outFile );
} else {
char *internalFont;
int pixel_size;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@ -231,9 +230,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* 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
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
int
PclPolyText16( pDrawable, pGC, x, y, count, string )
DrawablePtr pDrawable;
GCPtr pGC;
int x;
int y;
int count;
unsigned short *string;
PclPolyText16(
DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
int count,
unsigned short *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@ -271,7 +268,6 @@ CharInfoPtr charinfo[255], *chinfo;
FILE *outFile;
PclSoftFontInfoPtr pSoftFontInfo;
PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
PclCharDataRec cd;
FontInfoPtr pfi;
unsigned char row, col;
@ -321,8 +317,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
row = (def>>8)&0xff - pfi->firstRow;
col = def&0xff - pfi->firstCol;
row = ((def>>8)&0xff) - pfi->firstRow;
col = (def&0xff) - pfi->firstCol;
}
if ( !pfh16->index[row][col].fid ) {
fillCharDescData(&cd, *chinfo);
@ -356,8 +352,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
row = (def>>8)&0xff - pfi->firstRow;
col = def&0xff - pfi->firstCol;
row = ((def>>8)&0xff) - pfi->firstRow;
col = (def&0xff) - pfi->firstCol;
}
if ( last_fid != pfh16->index[row][col].fid ) {
sprintf(t, "%cFI%d;SS;LB",
@ -380,8 +376,7 @@ char font_type;
} else {
#ifdef DO_TWO_BYTE_PCL
char *internalFont;
int pixel_size;
PclInternalFontPtr pin;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@ -432,9 +427,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
miIntersect( region, drawRegion,
((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
->pCompositeClip );
miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* 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
*/
miRegionDestroy( drawRegion );
miRegionDestroy( region );
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
void
PclImageText8( pDrawable, pGC, x, y, count, string )
DrawablePtr pDrawable;
GCPtr pGC;
int x, y;
int count;
char *string;
PclImageText8(
DrawablePtr pDrawable,
GCPtr pGC,
int x, int y,
int count,
char *string)
{
}
void
PclImageText16( pDrawable, pGC, x, y, count, string )
DrawablePtr pDrawable;
GCPtr pGC;
int x;
int y;
int count;
unsigned short *string;
PclImageText16(
DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
int count,
unsigned short *string)
{
}
void
PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
DrawablePtr pDrawable;
GCPtr pGC;
int x, y;
unsigned int nGlyphs;
CharInfoPtr *pCharInfo;
pointer pGlyphBase;
PclImageGlyphBlt(
DrawablePtr pDrawable,
GCPtr pGC,
int x, int y,
unsigned int nGlyphs,
CharInfoPtr *pCharInfo,
pointer pGlyphBase)
{
}
void
PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
DrawablePtr pDrawable;
GCPtr pGC;
int x, y;
unsigned int nGlyphs;
CharInfoPtr *pCharInfo;
pointer pGlyphBase;
PclPolyGlyphBlt(
DrawablePtr pDrawable,
GCPtr pGC,
int x, int y,
unsigned int nGlyphs,
CharInfoPtr *pCharInfo,
pointer pGlyphBase)
{
}
@ -509,7 +502,7 @@ PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
FontInfoPtr pfi;
char *fontname;
unsigned char nindex;
int i, j;
int i;
unsigned long n;
CharInfoPtr charinfo[1];
unsigned int space_width;
@ -680,7 +673,7 @@ FontPropPtr props;
FontInfoPtr pfi;
char *fontname;
Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
int res, width;
int res, width = 1;
int mask;
int i;
@ -723,19 +716,19 @@ int i;
mask = 0;
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);
mask |= 0x1;
} else if ( props->name == XA_POINT_SIZE ) {
pin->height = (float) props->value / 10.0;
mask |= 0x2;
} else if ( props->name == xa_res ) {
} else if ( (Atom) props->name == xa_res ) {
res = (int) props->value;
mask |= 0x4;
} else if ( props->name == xa_ave_width ) {
} else if ( (Atom) props->name == xa_ave_width ) {
width = (int) props->value / 10;
mask |= 0x8;
} else if ( props->name == xa_spacing ) {
} else if ( (Atom) props->name == xa_spacing ) {
pin->spacing = NameForAtom(props->value);
mask |= 0x10;
}
@ -746,8 +739,11 @@ int i;
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->next = (PclInternalFontPtr)NULL;
if ( prev == (PclInternalFontPtr) NULL)
@ -791,7 +787,7 @@ unsigned int byte_width;
unsigned char *p;
register int nbyGlyphWidth;
unsigned char *pglyph, *pg;
int i, j;
unsigned int i, j;
pcd->h_offset = pci->metrics.leftSideBearing;
pcd->v_offset = pci->metrics.ascent;
@ -868,7 +864,7 @@ Atom dest;
pfi = (FontInfoRec *)&pfont->info;
props = pfi->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 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
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 <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@ -57,8 +59,7 @@ copyright holders.
#include "Pcl.h"
extern WindowPtr *WindowTable;
#if 0
/*
* The following list of strings defines the properties which will be
* 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,
(char *)NULL
};
#endif
/*
* PclCreateWindow - watch for the creation of the root window.
@ -207,7 +208,6 @@ PclPaintWindow(
RegionPtr pRegion,
int what)
{
int status;
WindowPtr pRoot;
#define FUNCTION 0
@ -367,13 +367,13 @@ PclPaintWindow(
}
break;
case GCClipMask:
if ((pointer) pGC->clientClipType != (pointer)CT_NONE) {
if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
gcmask |= index;
gcval[i++] = (pointer)CT_NONE;
}
break;
case GCSubwindowMode:
if ((pointer) pGC->subWindowMode != newValues[SUBWINDOW]) {
if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
gcmask |= index;
gcval[i++] = newValues[SUBWINDOW];
}
@ -387,7 +387,7 @@ PclPaintWindow(
}
break;
case GCFillStyle:
if ((pointer) pGC->fillStyle != newValues[FILLSTYLE]) {
if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
gcmask |= index;
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
copyright holders.
*/
/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCLMAP_H_
#define _PCLMAP_H_
#ifdef XP_PCL_COLOR
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
#define NAME(subname) PclCr##subname
#ifdef CATNAME
#undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclCr##subname
#define CATNAME(prefix,subname) prefix##Color##subname
#else
#define NAME(subname) PclCr/**/subname
#define PCLNAME(subname) PclCr/**/subname
#define CATNAME(prefix,subname) prefix/**/Color/**/subname
#endif
#endif /* XP_PCL_COLOR */
#ifdef XP_PCL_MONO
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
#define NAME(subname) PclMn##subname
#ifdef CATNAME
#undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclMn##subname
#define CATNAME(prefix,subname) prefix##Mono##subname
#else
#define NAME(subname) PclMn/**/subname
#define PCLNAME(subname) PclMn/**/subname
#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
#endif
#endif /* XP_PCL_MONO */
#ifdef XP_PCL_LJ3
#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
#define NAME(subname) PclLj3##subname
#ifdef CATNAME
#undef CATNAME
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define PCLNAME(subname) PclLj3##subname
#define CATNAME(prefix,subname) prefix##Lj3##subname
#else
#define NAME(subname) PclLj3/**/subname
#define PCLNAME(subname) PclLj3/**/subname
#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
#endif
#endif /* XP_PCL_LJ3 */
#ifdef PCLNAME
/* PclInit.c */
#define InitializePclDriver CATNAME(Initialize, PclDriver)
#define PclCloseScreen NAME(CloseScreen)
#define PclGetContextFromWindow NAME(GetContextFromWindow)
#define PclScreenPrivateIndex NAME(ScreenPrivateIndex)
#define PclWindowPrivateIndex NAME(WindowPrivateIndex)
#define PclContextPrivateIndex NAME(ContextPrivateIndex)
#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex)
#define PclGCPrivateIndex NAME(GCPrivateIndex)
#define PclCloseScreen PCLNAME(CloseScreen)
#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex)
#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex)
#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex)
#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex)
#define PclGCPrivateIndex PCLNAME(GCPrivateIndex)
/* PclPrint.c */
#define PclStartJob NAME(StartJob)
#define PclEndJob NAME(EndJob)
#define PclStartPage NAME(StartPage)
#define PclEndPage NAME(EndPage)
#define PclStartDoc NAME(StartDoc)
#define PclEndDoc NAME(EndDoc)
#define PclDocumentData NAME(DocumentData)
#define PclGetDocumentData NAME(GetDocumentData)
#define PclStartJob PCLNAME(StartJob)
#define PclEndJob PCLNAME(EndJob)
#define PclStartPage PCLNAME(StartPage)
#define PclEndPage PCLNAME(EndPage)
#define PclStartDoc PCLNAME(StartDoc)
#define PclEndDoc PCLNAME(EndDoc)
#define PclDocumentData PCLNAME(DocumentData)
#define PclGetDocumentData PCLNAME(GetDocumentData)
/* PclWindow.c */
#define PclCreateWindow NAME(CreateWindow)
#define PclMapWindow NAME(MapWindow)
#define PclPositionWindow NAME(PositionWindow)
#define PclUnmapWindow NAME(UnmapWindow)
#define PclCopyWindow NAME(CopyWindow)
#define PclChangeWindowAttributes NAME(ChangeWindowAttributes)
#define PclPaintWindow NAME(PaintWindow)
#define PclDestroyWindow NAME(DestroyWindow)
#define PclCreateWindow PCLNAME(CreateWindow)
#define PclMapWindow PCLNAME(MapWindow)
#define PclPositionWindow PCLNAME(PositionWindow)
#define PclUnmapWindow PCLNAME(UnmapWindow)
#define PclCopyWindow PCLNAME(CopyWindow)
#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
#define PclPaintWindow PCLNAME(PaintWindow)
#define PclDestroyWindow PCLNAME(DestroyWindow)
/* PclGC.c */
#define PclCreateGC NAME(CreateGC)
#define PclDestroyGC NAME(DestroyGC)
#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff)
#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC)
#define PclSendPattern NAME(SendPattern)
#define PclUpdateDrawableGC NAME(UpdateDrawableGC)
#define PclComputeCompositeClip NAME(ComputeCompositeClip)
#define PclValidateGC NAME(ValidateGC)
#define PclCreateGC PCLNAME(CreateGC)
#define PclDestroyGC PCLNAME(DestroyGC)
#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
#define PclSendPattern PCLNAME(SendPattern)
#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
#define PclValidateGC PCLNAME(ValidateGC)
/* PclAttr.c */
#define PclGetAttributes NAME(GetAttributes)
#define PclGetOneAttribute NAME(GetOneAttribute)
#define PclAugmentAttributes NAME(AugmentAttributes)
#define PclSetAttributes NAME(SetAttributes)
#define PclGetAttributes PCLNAME(GetAttributes)
#define PclGetOneAttribute PCLNAME(GetOneAttribute)
#define PclAugmentAttributes PCLNAME(AugmentAttributes)
#define PclSetAttributes PCLNAME(SetAttributes)
/* PclColor.c */
#define PclLookUp NAME(LookUp)
#define PclCreateDefColormap NAME(CreateDefColormap)
#define PclCreateColormap NAME(CreateColormap)
#define PclDestroyColormap NAME(DestroyColormap)
#define PclInstallColormap NAME(InstallColormap)
#define PclUninstallColormap NAME(UninstallColormap)
#define PclListInstalledColormaps NAME(ListInstalledColormaps)
#define PclStoreColors NAME(StoreColors)
#define PclResolveColor NAME(ResolveColor)
#define PclFindPaletteMap NAME(FindPaletteMap)
#define PclUpdateColormap NAME(UpdateColormap)
#define PclReadMap NAME(ReadMap)
#define PclLookUp PCLNAME(LookUp)
#define PclCreateDefColormap PCLNAME(CreateDefColormap)
#define PclCreateColormap PCLNAME(CreateColormap)
#define PclDestroyColormap PCLNAME(DestroyColormap)
#define PclInstallColormap PCLNAME(InstallColormap)
#define PclUninstallColormap PCLNAME(UninstallColormap)
#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
#define PclStoreColors PCLNAME(StoreColors)
#define PclResolveColor PCLNAME(ResolveColor)
#define PclFindPaletteMap PCLNAME(FindPaletteMap)
#define PclUpdateColormap PCLNAME(UpdateColormap)
#define PclReadMap PCLNAME(ReadMap)
/* PclPixmap.c */
#define PclCreatePixmap NAME(CreatePixmap)
#define PclDestroyPixmap NAME(DestroyPixmap)
#define PclCreatePixmap PCLNAME(CreatePixmap)
#define PclDestroyPixmap PCLNAME(DestroyPixmap)
/* PclArc.c */
#define PclDoArc NAME(DoArc)
#define PclPolyArc NAME(PolyArc)
#define PclPolyFillArc NAME(PolyFillArc)
#define PclDoArc PCLNAME(DoArc)
#define PclPolyArc PCLNAME(PolyArc)
#define PclPolyFillArc PCLNAME(PolyFillArc)
/* PclArea.c */
#define PclPutImage NAME(PutImage)
#define PclCopyArea NAME(CopyArea)
#define PclCopyPlane NAME(CopyPlane)
#define PclPutImage PCLNAME(PutImage)
#define PclCopyArea PCLNAME(CopyArea)
#define PclCopyPlane PCLNAME(CopyPlane)
/* PclLine */
#define PclPolyLine NAME(PolyLine)
#define PclPolySegment NAME(PolySegment)
#define PclPolyLine PCLNAME(PolyLine)
#define PclPolySegment PCLNAME(PolySegment)
/* PclPixel.c */
#define PclPolyPoint NAME(PolyPoint)
#define PclPushPixels NAME(PushPixels)
#define PclPolyPoint PCLNAME(PolyPoint)
#define PclPushPixels PCLNAME(PushPixels)
/* PclPolygon.c */
#define PclPolyRectangle NAME(PolyRectangle)
#define PclFillPolygon NAME(FillPolygon)
#define PclPolyFillRect NAME(PolyFillRect)
#define PclPolyRectangle PCLNAME(PolyRectangle)
#define PclFillPolygon PCLNAME(FillPolygon)
#define PclPolyFillRect PCLNAME(PolyFillRect)
/* PclSpans.c */
#define PclFillSpans NAME(FillSpans)
#define PclSetSpans NAME(SetSpans)
#define PclFillSpans PCLNAME(FillSpans)
#define PclSetSpans PCLNAME(SetSpans)
/* PclText.c */
#define PclPolyText8 NAME(PolyText8)
#define PclPolyText16 NAME(PolyText16)
#define PclImageText8 NAME(ImageText8)
#define PclImageText16 NAME(ImageText16)
#define PclImageGlyphBlt NAME(ImageGlyphBlt)
#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
#define PclPolyText8 PCLNAME(PolyText8)
#define PclPolyText16 PCLNAME(PolyText16)
#define PclImageText8 PCLNAME(ImageText8)
#define PclImageText16 PCLNAME(ImageText16)
#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
/* PclFonts.c */
#define PclRealizeFont NAME(RealizeFont)
#define PclUnrealizeFont NAME(UnrealizeFont)
#define PclRealizeFont PCLNAME(RealizeFont)
#define PclUnrealizeFont PCLNAME(UnrealizeFont)
/* PclSFonts.c */
#define PclDownloadSoftFont8 NAME(DownloadSoftFont8)
#define PclDownloadSoftFont16 NAME(DownloadSoftFont16)
#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo)
#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo)
#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
/* PclMisc.c */
#define PclQueryBestSize NAME(QueryBestSize)
#define GetPropString NAME(GetPropString)
#define SystemCmd NAME(SystemCmd)
#define PclGetMediumDimensions NAME(GetMediumDimensions)
#define PclGetReproducibleArea NAME(GetReproducibleArea)
#define PclSpoolFigs NAME(SpoolFigs)
#define PclSendData NAME(SendData)
#define PclQueryBestSize PCLNAME(QueryBestSize)
#define GetPropString PCLNAME(GetPropString)
#define SystemCmd PCLNAME(SystemCmd)
#define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
#define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
#define PclSpoolFigs PCLNAME(SpoolFigs)
#define PclSendData PCLNAME(SendData)
/* PclCursor.c */
#define PclConstrainCursor NAME(ConstrainCursor)
#define PclCursorLimits NAME(CursorLimits)
#define PclDisplayCursor NAME(DisplayCursor)
#define PclRealizeCursor NAME(RealizeCursor)
#define PclUnrealizeCursor NAME(UnrealizeCursor)
#define PclRecolorCursor NAME(RecolorCursor)
#define PclSetCursorPosition NAME(SetCursorPosition)
#define PclConstrainCursor PCLNAME(ConstrainCursor)
#define PclCursorLimits PCLNAME(CursorLimits)
#define PclDisplayCursor PCLNAME(DisplayCursor)
#define PclRealizeCursor PCLNAME(RealizeCursor)
#define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
#define PclRecolorCursor PCLNAME(RecolorCursor)
#define PclSetCursorPosition PCLNAME(SetCursorPosition)
#endif
#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
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@ -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_
#define _PS_H_
@ -87,24 +87,11 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.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 "psout.h"
#define _XP_PRINT_SERVER_
#include "Print.h"
#include "extensions/Printstr.h"
#undef _XP_PRINT_SERVER_
#include <X11/extensions/Print.h>
#include <X11/extensions/Printstr.h>
#include "miscstruct.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
*/
#ifndef HAVE_XPointer
typedef char *XPointer;
#define Status int
#define True 1
#define False 0
#endif
#include "misc.h"
#include <Xfuncproto.h>
#include "../Xresource.h"
#include <X11/Xfuncproto.h>
#include <X11/Xresource.h>
#include "attributes.h"
/*
* Public index variables from PsInit.c
@ -130,7 +121,7 @@ extern int PsScreenPrivateIndex;
extern int PsWindowPrivateIndex;
extern int PsContextPrivateIndex;
extern int PsPixmapPrivateIndex;
extern int PsGCPrivateIndex;
extern XpValidatePoolsRec PsValidatePoolsRec;
/*
* Display list structures
@ -255,7 +246,7 @@ typedef struct
{
XrmDatabase resDB;
ColormapPtr CMap;
Bool (*DestroyWindow)();
Bool (*DestroyWindow)(WindowPtr);
} PsScreenPrivRec, *PsScreenPrivPtr;
typedef struct
@ -276,12 +267,6 @@ typedef struct
XpContextPtr context;
} PsWindowPrivRec, *PsWindowPrivPtr;
typedef struct
{
unsigned freeCompClip;
RegionPtr pCompositeClip;
} PsGCPrivRec, *PsGCPrivPtr;
typedef struct
{
XpContextPtr context;
@ -296,7 +281,9 @@ typedef struct
#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
#define MIN(a,b) (((a)<(b))?(a):(b))
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
/*
* Functions in PsInit.c
@ -304,7 +291,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv);
static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/*
@ -328,9 +314,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/
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,
PsOutPtr *psOut, ColormapPtr *cMap);
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,
int x, int y, int w, int h, int leftPad, int format,
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,
int srcx, int srcy, int width, int height,
int dstx, int dsty);
@ -517,4 +503,14 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
extern PsElmPtr PsCloneFillElementList(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_ */

View File

@ -228,7 +228,7 @@ error:
return;
}
void
static void
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
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;
int pageRes, sw, sh;
#ifdef BM_CACHE
long cache_id = 0;
long cache_id = 0;
#endif
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
if (!imageRes) {
sw = w;
@ -296,100 +296,100 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id);
#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);
if( format==XYPixmap )
int rowsiz = PixmapBytePad(w, depth);
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 *planes[3];
planes[0] = pImage;
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++ ) pt[i] = &planes[i][rowsiz*r];
for( c=0 ; c<w ; c++ )
{
char *pt[3];
for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
for( c=0 ; c<w ; c++ )
{
for( i=0 ; i<3 ; i++ )
{ PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
}
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);
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++ )
for( c=0 ; c<w ; c++,pt+=4 )
{
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];
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, &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);
}
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
PsOut_EndImageCache(psOut);
PsOut_EndImageCache(psOut);
}
PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
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
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 "AttrValid.h"
@ -142,6 +143,13 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
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[] = {
{ "Postscript", "2", NULL }
@ -149,6 +157,7 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
static XpOidDocFmtList ValidRawFormatsSupported = {
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
};
#endif
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@ -196,7 +205,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
&ValidPrinterResolutions, &DefaultPrinterResolutions,
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
&ValidListfontsModes, &DefaultListfontsModes,
&ValidRawFormatsSupported, &DefaultRawFormatsSupported,
NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
&ValidSetupProviso,
&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
* 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 "attributes.h"
char *
PsGetAttributes(

View File

@ -79,21 +79,21 @@ in this Software without prior written authorization from The Open Group.
#include "fntfil.h"
#include "fntfilst.h"
#define GET 0
#define RESET 1
#define GET 0
#define RESET 1
struct bm_cache_list {
struct bm_cache_list *next;
struct bm_cache_list *prev;
struct bm_cache_list *next;
struct bm_cache_list *prev;
int height;
long id;
long id;
char *pBuffer;
};
struct bm_cache_head {
struct bm_cache_list *head;
int width;
struct bm_cache_head *next;
struct bm_cache_list *head;
int width;
struct bm_cache_head *next;
struct bm_cache_head *prev;
};
@ -106,14 +106,14 @@ PsBmUniqueId(int func)
if(func == RESET)
{
unique_id = 0;
return 0;
unique_id = 0;
return 0;
}
else
return ++unique_id;
return ++unique_id;
}
int
int
PsBmIsImageCached(
int gWidth,
int gHeight,
@ -126,28 +126,28 @@ PsBmIsImageCached(
{
if(pList->width == gWidth)
{
struct bm_cache_list *pItem = pList->head;
struct bm_cache_list *pItem = pList->head;
while(pItem != NULL)
{
if(pItem->height == gHeight)
{
int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
while(pItem != NULL)
{
if(pItem->height == gHeight)
{
int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
{
return_val = pItem->id;
break;
}
}
else if(pItem->height > gHeight)
break;
if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
{
return_val = pItem->id;
break;
}
}
else if(pItem->height > gHeight)
break;
pItem = pItem->next;
}
pItem = pItem->next;
}
}
else if(pList->width > gWidth)
break;
else if(pList->width > gWidth)
break;
pList = pList->next;
}
@ -180,39 +180,39 @@ PsBmPutImageInCache(
while(pList != NULL)
{
if(pList->width == gWidth)
{
struct bm_cache_list *pItem = pList->head;
{
struct bm_cache_list *pItem = pList->head;
while(pItem != NULL)
{
if(pItem->height >= gHeight)
{
pNew->next = pItem;
pNew->prev = pItem->prev;
if(pItem->prev != NULL)
pItem->prev->next = pNew;
while(pItem != NULL)
{
if(pItem->height >= gHeight)
{
pNew->next = pItem;
pNew->prev = pItem->prev;
if(pItem->prev != NULL)
pItem->prev->next = pNew;
else
pList->head = pNew;
pList->head = pNew;
pItem->prev = pNew;
return_val = pNew->id;
return_val = pNew->id;
break;
}
else if(pItem->next == NULL)
{
pNew->prev = pItem;
pItem->next = pNew;
break;
}
else if(pItem->next == NULL)
{
pNew->prev = pItem;
pItem->next = pNew;
return_val = pNew->id;
return_val = pNew->id;
break;
}
break;
}
pItem = pItem->next;
}
pItem = pItem->next;
}
break;
break;
}
pList = pList->next;
@ -223,50 +223,50 @@ PsBmPutImageInCache(
struct bm_cache_head *pNewList;
pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
pNewList->next = NULL;
pNewList->prev = NULL;
pNewList->width = gWidth;
pNewList->head = pNew;
if(bm_cache == NULL)
{
bm_cache = pNewList;
return_val = pNew->id;
bm_cache = pNewList;
return_val = pNew->id;
}
else
{
pList = bm_cache;
pList = bm_cache;
while(pList != NULL)
{
if(pList->width > gWidth)
{
pNewList->next = pList;
pNewList->prev = pList->prev;
while(pList != NULL)
{
if(pList->width > gWidth)
{
pNewList->next = pList;
pNewList->prev = pList->prev;
if(pList->prev != NULL)
pList->prev->next = pNewList;
if(pList->prev != NULL)
pList->prev->next = pNewList;
else
bm_cache = pNewList;
pList->prev = pNewList;
bm_cache = pNewList;
pList->prev = pNewList;
return_val = pNew->id;
return_val = pNew->id;
break;
}
else if(pList->next == NULL)
break;
}
else if(pList->next == NULL)
{
pNewList->prev = pList;
pList->next = pNewList;
pNewList->prev = pList;
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->pBuffer != NULL)
free(pItem->pBuffer);
if(pItem->pBuffer != NULL)
free(pItem->pBuffer);
pItem->pBuffer = NULL;
if(pItem->next)
PsBmClearImageCacheItem(pItem->next);
if(pItem->next)
PsBmClearImageCacheItem(pItem->next);
pItem->next = NULL;
free(pItem);
pItem = NULL;
free(pItem);
pItem = NULL;
}
}
static void
static void
PsBmClearImageCacheList(
struct bm_cache_head *pList)
{
if(pList != NULL)
{
if(pList->head)
PsBmClearImageCacheItem(pList->head);
if(pList->head)
PsBmClearImageCacheItem(pList->head);
pList->head = NULL;
if(pList->next)
PsBmClearImageCacheList(pList->next);
if(pList->next)
PsBmClearImageCacheList(pList->next);
pList->next = NULL;
free(pList);
pList = NULL;
free(pList);
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 "gcstruct.h"
@ -85,7 +86,6 @@ PsCreateColormap(ColormapPtr pColor)
int i;
unsigned short rgb;
VisualPtr pVisual = pColor->pVisual;
Pixel pix;
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
* 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++ )
{
if( props[i].name==name )
if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@ -149,7 +150,7 @@ PsGetPSFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
if( props[i].name==name )
if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@ -170,8 +171,8 @@ PsIsISOLatin1Encoding(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
if( props[i].name==reg ) rv = props[i].value;
if( props[i].name==enc ) ev = props[i].value;
if( (Atom)props[i].name == reg ) rv = props[i].value;
if( (Atom)props[i].name == enc ) ev = props[i].value;
}
if( rv ) rp = NameForAtom(rv);
if( ev ) ep = NameForAtom(ev);

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