From b16b9e4656e7199c2aec74a4c8ebc7a875d3ba73 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Feb 2015 15:02:49 +0100 Subject: massive reduction of unneeded files --- nx-X11/lib/Xp/Imakefile | 107 ------ nx-X11/lib/Xp/Xp-def.cpp | 42 --- nx-X11/lib/Xp/XpAttr.c | 208 ---------- nx-X11/lib/Xp/XpContext.c | 250 ------------ nx-X11/lib/Xp/XpDoc.c | 159 -------- nx-X11/lib/Xp/XpExtUtil.c | 355 ----------------- nx-X11/lib/Xp/XpExtUtil.h | 41 -- nx-X11/lib/Xp/XpExtVer.c | 125 ------ nx-X11/lib/Xp/XpGetData.c | 215 ----------- nx-X11/lib/Xp/XpImageRes.c | 118 ------ nx-X11/lib/Xp/XpInput.c | 107 ------ nx-X11/lib/Xp/XpJob.c | 206 ---------- nx-X11/lib/Xp/XpLocale.c | 269 ------------- nx-X11/lib/Xp/XpNotifyPdm.c | 900 -------------------------------------------- nx-X11/lib/Xp/XpPage.c | 160 -------- nx-X11/lib/Xp/XpPageDim.c | 89 ----- nx-X11/lib/Xp/XpPrinter.c | 248 ------------ nx-X11/lib/Xp/XpPutData.c | 100 ----- nx-X11/lib/Xp/XpScreens.c | 128 ------- 19 files changed, 3827 deletions(-) delete mode 100644 nx-X11/lib/Xp/Imakefile delete mode 100644 nx-X11/lib/Xp/Xp-def.cpp delete mode 100644 nx-X11/lib/Xp/XpAttr.c delete mode 100644 nx-X11/lib/Xp/XpContext.c delete mode 100644 nx-X11/lib/Xp/XpDoc.c delete mode 100644 nx-X11/lib/Xp/XpExtUtil.c delete mode 100644 nx-X11/lib/Xp/XpExtUtil.h delete mode 100644 nx-X11/lib/Xp/XpExtVer.c delete mode 100644 nx-X11/lib/Xp/XpGetData.c delete mode 100644 nx-X11/lib/Xp/XpImageRes.c delete mode 100644 nx-X11/lib/Xp/XpInput.c delete mode 100644 nx-X11/lib/Xp/XpJob.c delete mode 100644 nx-X11/lib/Xp/XpLocale.c delete mode 100644 nx-X11/lib/Xp/XpNotifyPdm.c delete mode 100644 nx-X11/lib/Xp/XpPage.c delete mode 100644 nx-X11/lib/Xp/XpPageDim.c delete mode 100644 nx-X11/lib/Xp/XpPrinter.c delete mode 100644 nx-X11/lib/Xp/XpPutData.c delete mode 100644 nx-X11/lib/Xp/XpScreens.c (limited to 'nx-X11/lib/Xp') diff --git a/nx-X11/lib/Xp/Imakefile b/nx-X11/lib/Xp/Imakefile deleted file mode 100644 index 2b64417a2..000000000 --- a/nx-X11/lib/Xp/Imakefile +++ /dev/null @@ -1,107 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:05 cpqbld Exp $ -/****************************************************************************** - ****************************************************************************** - ** - ** Description: Imakefile for the DtPrint extension library. - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -XCOMM $XFree86: xc/lib/Xp/Imakefile,v 1.3 2001/01/17 19:43:01 dawes Exp $ - - -#define DoNormalLib NormalLibXp -#define DoSharedLib SharedLibXp -#define DoExtraLib SharedLibXp -#define DoDebugLib DebugLibXp -#define DoProfileLib ProfileLibXp -#define LibName Xp -#define SoRev SOXPREV -#define LibHeaders NO - -#include - -#ifdef SharedXpReqs -REQUIREDLIBS = SharedXpReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -DEFINES = $(ALLOC_DEFINES) - -/* - * NOTE: libDtPrint.a has a dependency on extutil.o found in - * libXext.a - */ -SRCS = \ - XpAttr.c \ - XpContext.c \ - XpDoc.c \ - XpExtUtil.c \ - XpExtVer.c \ - XpGetData.c \ - XpInput.c \ - XpJob.c \ - XpLocale.c \ - XpPage.c \ - XpNotifyPdm.c \ - XpPrinter.c \ - XpPutData.c \ - XpScreens.c \ - XpPageDim.c \ - XpImageRes.c - -OBJS = \ - XpAttr.o \ - XpContext.o \ - XpDoc.o \ - XpExtUtil.o \ - XpExtVer.o \ - XpGetData.o \ - XpInput.o \ - XpJob.o \ - XpLocale.o \ - XpPage.o \ - XpNotifyPdm.o \ - XpPrinter.o \ - XpPutData.o \ - XpScreens.o \ - XpPageDim.o \ - XpImageRes.o - -LINTLIBS = $(LINTXLIB) $(LINTXEXT) - -#include - -DependTarget() diff --git a/nx-X11/lib/Xp/Xp-def.cpp b/nx-X11/lib/Xp/Xp-def.cpp deleted file mode 100644 index 253c649ca..000000000 --- a/nx-X11/lib/Xp/Xp-def.cpp +++ /dev/null @@ -1,42 +0,0 @@ -LIBRARY Xp -VERSION LIBRARY_VERSION -EXPORTS - XpCancelDoc - XpCancelJob - XpCancelPage - XpCreateContext - XpDestroyContext - XpEndDoc - XpEndJob - XpEndPage - XpFreePrinterList - XpGetAttributes - XpGetAuthParams - XpGetContext - XpGetDocumentData - XpGetLocaleHinter - XpGetLocaleNetString - XpGetOneAttribute - XpGetPageDimensions - XpGetPdmStartParams - XpGetPrinterList - XpGetScreenOfContext - XpInputSelected - XpNotifyPdm - XpPutDocumentData - XpQueryExtension - XpQueryScreens - XpQueryVersion - XpRehashPrinterList - XpSelectInput - XpSendAuth - XpSendOneTicket - XpSetAttributes - XpSetContext - XpSetImageResolution - XpSetLocaleHinter - XpStartDoc - XpStartJob - XpStartPage -/* $Xorg: Xp-def.cpp,v 1.3 2000/08/17 19:46:05 cpqbld Exp $ */ -/* $XFree86: xc/lib/Xp/Xp-def.cpp,v 1.2 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/nx-X11/lib/Xp/XpAttr.c b/nx-X11/lib/Xp/XpAttr.c deleted file mode 100644 index 9e1fbfd64..000000000 --- a/nx-X11/lib/Xp/XpAttr.c +++ /dev/null @@ -1,208 +0,0 @@ -/* $Xorg: XpAttr.c,v 1.4 2000/08/17 19:46:05 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpAttr.c,v 1.6 2001/01/17 19:43:01 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - - -#include -#include - -char * -XpGetAttributes ( - Display *dpy, - XPContext print_context, - XPAttributes type -) -{ - char *buf; - - xPrintGetAttributesReq *req; - xPrintGetAttributesReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return( (char *) NULL ); /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintGetAttributes,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetAttributes; - req->printContext = print_context; - req->type = type; - - if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return( (char *) NULL ); /* No such extension */ - } - - /* - * Read pool and return to caller. - */ - buf = Xmalloc( (unsigned) rep.stringLen + 1 ); - - if (!buf) { - UnlockDisplay(dpy); - SyncHandle(); - return( (char *) NULL ); /* malloc error */ - } - - _XReadPad (dpy, (char *) buf, (long) rep.stringLen ); - - buf[rep.stringLen] = 0; - - UnlockDisplay(dpy); - SyncHandle(); - - return( buf ); -} - - -char * -XpGetOneAttribute ( - Display *dpy, - XPContext print_context, - XPAttributes type, - char *attribute_name -) -{ - char *buf; - - xPrintGetOneAttributeReq *req; - xPrintGetOneAttributeReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return( (char *) NULL ); /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintGetOneAttribute,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetOneAttribute; - req->type = type; - req->printContext = print_context; - req->nameLen = strlen( attribute_name ); - - /* - * Attach variable data and adjust request length. - */ - req->length += _XpPadOut(req->nameLen) >> 2 ; - Data( dpy, (char *) attribute_name, req->nameLen ); /* n bytes + pad */ - - if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return( (char *) NULL ); /* No such extension */ - } - - /* - * Read variable answer. - */ - buf = Xmalloc( (unsigned) rep.valueLen + 1 ); - - if (!buf) { - UnlockDisplay(dpy); - SyncHandle(); - return( (char *) NULL ); /* malloc error */ - } - - buf[rep.valueLen] = 0; - - _XReadPad (dpy, (char *) buf, (long) rep.valueLen ); - buf[rep.valueLen] = 0; - - UnlockDisplay(dpy); - SyncHandle(); - - return( buf ); -} - - -void -XpSetAttributes ( - Display *dpy, - XPContext print_context, - XPAttributes type, - char *pool, - XPAttrReplacement replacement_rule -) -{ - xPrintSetAttributesReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return; /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintSetAttributes,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintSetAttributes; - - req->printContext = print_context; - req->type = type; - req->rule = replacement_rule; - - /* - * Attach variable data and adjust request length. - */ - req->stringLen = (CARD32) strlen( (char *) pool ); - req->length += _XpPadOut(req->stringLen) >> 2 ; - - Data( dpy, (char *) pool, req->stringLen ); /* n bytes + pad */ - - UnlockDisplay(dpy); - SyncHandle(); - - return; -} - diff --git a/nx-X11/lib/Xp/XpContext.c b/nx-X11/lib/Xp/XpContext.c deleted file mode 100644 index fc3da9c2b..000000000 --- a/nx-X11/lib/Xp/XpContext.c +++ /dev/null @@ -1,250 +0,0 @@ -/* $Xorg: XpContext.c,v 1.4 2000/08/17 19:46:05 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpContext.c,v 1.6 2001/10/28 03:32:39 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - -XPContext -XpCreateContext ( - Display *dpy, - char *printer_name -) -{ - xPrintCreateContextReq *req; - char *locale; - int locale_len; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return ( (XPContext) None ); /* No such extension */ - - /* - * Fetch locale information. Note: XpGetLocaleNetString has - * a thread-safe mutex on _Xglobal_lock. - */ - locale = XpGetLocaleNetString(); - - LockDisplay (dpy); - - GetReq(PrintCreateContext,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintCreateContext; - - req->contextID = XAllocID(dpy); - req->printerNameLen = strlen(printer_name); - - if ( locale == (char *) NULL ) - req->localeLen = 0; - else if ( *locale == (char) NULL ) - req->localeLen = 0; - else { - locale_len = strlen( locale ); - req->length += _XpPadOut(locale_len) >> 2; - req->localeLen = (unsigned long) locale_len; - } - - /* - * Attach variable data - */ - req->length += _XpPadOut(req->printerNameLen) >> 2; - Data( dpy, (char *) printer_name, (long) req->printerNameLen ); - - if (req->localeLen) - Data( dpy, (char *) locale, (long) req->localeLen ); - - UnlockDisplay(dpy); - SyncHandle(); - - XFree(locale); - - return ( (XPContext) req->contextID ); -} - - -void -XpSetContext ( - Display *dpy, - XPContext print_context -) -{ - xPrintSetContextReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return; /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintSetContext,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintSetContext; - - req->printContext = print_context; - - UnlockDisplay(dpy); - SyncHandle(); - - return; -} - - -XPContext -XpGetContext ( - Display *dpy -) -{ - xPrintGetContextReq *req; - xPrintGetContextReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return ( (XPContext) None ); /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintGetContext,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetContext; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (XPContext) None ); /* No such extension */ - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ( (XPContext) rep.printContext ); -} - - -void -XpDestroyContext ( - Display *dpy, - XPContext print_context -) -{ - xPrintDestroyContextReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return; /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintDestroyContext,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintDestroyContext; - req->printContext = print_context; - - UnlockDisplay(dpy); - SyncHandle(); - - return; -} - - - -Screen * -XpGetScreenOfContext ( - Display *dpy, - XPContext print_context -) -{ - xPrintGetContextScreenReq *req; - xPrintGetContextScreenReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - int i; - Screen *checkScr = NULL; - int ok; - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return ( (Screen *) NULL ); /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintGetContextScreen,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetContextScreen; - - req->printContext = print_context; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (Screen *) NULL ); /* No such extension */ - } - - /* - * Pull rootWindow ID and convert to the corresponding - * Screen rec. - */ - ok = False; - - for ( i = 0; i < XScreenCount(dpy); i++ ) { - checkScr = XScreenOfDisplay(dpy, i); - if ( XRootWindowOfScreen( checkScr ) == (Window) rep.rootWindow ) { - ok = True; - break; - } - } - - if (!ok) - checkScr = (Screen *) NULL; - - UnlockDisplay(dpy); - SyncHandle(); - - return ( (Screen *) checkScr ); -} - diff --git a/nx-X11/lib/Xp/XpDoc.c b/nx-X11/lib/Xp/XpDoc.c deleted file mode 100644 index 3fb4ad5d5..000000000 --- a/nx-X11/lib/Xp/XpDoc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Xorg: XpDoc.c,v 1.3 2000/08/17 19:46:06 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpDoc.c,v 1.3 2001/01/17 19:43:01 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -typedef struct { - int event_base_return; - XPContext context; -} _XpDiscardDocRec; - -static Bool _XpDiscardDoc(Display *dpy, XEvent *event, XPointer arg) -{ - _XpDiscardDocRec *disrec = (_XpDiscardDocRec *) arg; - - if (event->type != disrec->event_base_return + XPPrintNotify) - return False; - - if (disrec->context != ((XPPrintEvent *) event)->context) - return False; - - if ((((XPPrintEvent *) event)->detail == XPEndDocNotify) || - (((XPPrintEvent *) event)->detail == XPEndPageNotify)) { - return False; - } - - return True; -} - - -void -XpStartDoc ( - Display *dpy, - XPDocumentType type -) -{ - xPrintStartDocReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension NULL */ - - LockDisplay (dpy); - - GetReq(PrintStartDoc,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintStartDoc; - req->type = (unsigned char ) type; - - UnlockDisplay (dpy); - SyncHandle (); -} - -void -XpEndDoc ( - Display *dpy -) -{ - xPrintEndDocReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension NULL */ - - LockDisplay (dpy); - - GetReq(PrintEndDoc,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndDoc; - req->cancel = False; - - UnlockDisplay (dpy); - SyncHandle (); -} - - -void -XpCancelDoc ( - Display *dpy, - Bool discard -) -{ - xPrintEndDocReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - _XpDiscardDocRec disrec; - XEvent event; - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension NULL */ - - LockDisplay (dpy); - - GetReq(PrintEndDoc,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndDoc; - req->cancel = True; - - UnlockDisplay (dpy); - SyncHandle (); - - if (discard) { - /* - * get context and effectively do a sync of events. - */ - disrec.event_base_return = info->codes->first_event; - disrec.context = XpGetContext(dpy); - - /* - * discard doc, and also page XPPrintNotify events. - */ - while (XCheckIfEvent(dpy, &event, _XpDiscardDoc, (XPointer) &disrec)) - { - /*EMPTY*/ - } - } -} - diff --git a/nx-X11/lib/Xp/XpExtUtil.c b/nx-X11/lib/Xp/XpExtUtil.c deleted file mode 100644 index dac80286f..000000000 --- a/nx-X11/lib/Xp/XpExtUtil.c +++ /dev/null @@ -1,355 +0,0 @@ -/* $Xorg: XpExtUtil.c,v 1.3 2000/08/17 19:46:06 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpExtUtil.c,v 1.7 2002/10/16 00:37:31 dawes Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "XpExtUtil.h" -#include - -#define ENQUEUE_EVENT True -#define DONT_ENQUEUE False - -static XExtensionInfo xp_info_data; -static XExtensionInfo *xp_info = &xp_info_data; -static /* const */ char *xp_extension_name = XP_PRINTNAME; - -static int XpClose(); -static char *XpError(); -static Bool XpWireToEvent(); -static Status XpEventToWire(); - -#define XpCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, xp_extension_name, val) - -static /* const */ XExtensionHooks xpprint_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - XpClose, /* close_display */ - XpWireToEvent, /* wire_to_event */ - XpEventToWire, /* event_to_wire */ - NULL, /* error */ - XpError, /* error_string */ -}; - -typedef struct { - int present; - short major_version; - short minor_version; -} XPrintLocalExtensionVersion; - -typedef struct _xpPrintData { - XEvent data; - XPrintLocalExtensionVersion *vers; -} xpPrintData; - -static char *XpErrorList[ /* XP_ERRORS */ ] = { - "XPBadContext", - "XPBadSequence", - "XPBadResourceID" -}; - -XEXT_GENERATE_FIND_DISPLAY (xp_find_display, xp_info, - xp_extension_name, &xpprint_extension_hooks, XP_EVENTS, NULL) - -static XEXT_GENERATE_ERROR_STRING (XpError, xp_extension_name, - XP_ERRORS, XpErrorList) - -/******************************************************************* - * - * XP Print extension versions. - */ - -static XPrintLocalExtensionVersion xpprintversions[] = {{XP_ABSENT,0,0}, - {XP_PRESENT, XP_PROTO_MAJOR, XP_PROTO_MINOR}}; - - -/*********************************************************************** - * - * Check to see if the Xp Print extension is installed in the server. - * Also check to see if the version is >= the requested version. - * - * xpprintversions[] shows all revisions of this library, past to present. - * xpprintversions[version_index] shows which version *this* library is. - */ - -int XpCheckExtInitUnlocked(dpy, version_index) - register Display *dpy; - register int version_index; -{ - XExtDisplayInfo *info = xp_find_display (dpy); - - XpCheckExtension (dpy, info, -1); - - - /* - * Check for broken condition - a partial info world. - */ - if (info->data) { - if (!(((xpPrintData *) info->data)->vers)) { - return (-1); - } - } - - if (info->data == NULL) { - /* - * Hang a Xp private data struct. Use it for version - * information. - */ - info->data = (XPointer) Xmalloc (sizeof (xpPrintData)); - if (!info->data) { - return (-1); - } - - ((xpPrintData *) info->data)->vers = - (XPrintLocalExtensionVersion *) Xmalloc(sizeof(XPrintLocalExtensionVersion)); - if (!(((xpPrintData *) info->data)->vers)) { - return (-1); - } - - /* - * Set present to false so that XpQueryVersion will fill - * it in vs using its own cache which now contains garbage. - */ - ((xpPrintData *) info->data)->vers->present = False; - - ((xpPrintData *) info->data)->vers->present = XpQueryVersion(dpy, - &(((xpPrintData *) info->data)->vers->major_version), - &(((xpPrintData *) info->data)->vers->minor_version) ); - } - if (xpprintversions[version_index].major_version > XP_DONT_CHECK) { - if ( ( ((xpPrintData *) info->data)->vers->major_version - < xpprintversions[version_index].major_version) || - ( (((xpPrintData *) info->data)->vers->major_version - == xpprintversions[version_index].major_version) && - (((xpPrintData *) info->data)->vers->minor_version - < xpprintversions[version_index].minor_version))) { - return (-1); - } - } - - return (0); -} - -int XpCheckExtInit(dpy, version_index) - register Display *dpy; - register int version_index; -{ - int retval; - - _XLockMutex(_Xglobal_lock); - - retval = XpCheckExtInitUnlocked(dpy, version_index); - - _XUnlockMutex(_Xglobal_lock); - - return retval; -} - -/*********************************************************************** - * - * Close display routine. - * - */ - -static int -XpClose (dpy, codes) - Display *dpy; - XExtCodes *codes; - { - XExtDisplayInfo *info = xp_find_display (dpy); - - _XLockMutex(_Xglobal_lock); - if ( ((xpPrintData *) info->data)) { - if (((xpPrintData *) info->data)->vers) { - XFree((char *)((xpPrintData *) info->data)->vers); - } - XFree((char *)info->data); - info->data = (char *) NULL; /* NULL since tests are run on */ - } - _XUnlockMutex(_Xglobal_lock); - - return XextRemoveDisplay (xp_info, dpy); - } - - -/****************************************************************************** - * - * Handle extension events. - */ - -/******************************************************************** - * - * Reformat a wire event into an XEvent structure of the right type. - */ -static Bool -XpWireToEvent (dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; -{ - XExtDisplayInfo *info = xp_find_display (dpy); - - - /* - * type, serial, send_event, display are common to all events. - */ - re->type = event->u.u.type & 0x7f; - ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)event); - ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); - ((XAnyEvent *)re)->display = dpy; - - - switch (re->type - info->codes->first_event) - { - - case XPPrintNotify: - { - register XPPrintEvent *ev = (XPPrintEvent *) re; - xPrintPrintEvent *ev2 = (xPrintPrintEvent *) event; - - /* type, serial, send_event, *display */ - - ev->context = (XPContext) ev2->printContext; - ev->cancel = (Bool) ev2->cancel; - ev->detail = (int) ev2->detail; - - return (ENQUEUE_EVENT); - break; - } - - case XPAttributeNotify: - { - register XPAttributeEvent *ev = (XPAttributeEvent *) re; - xPrintAttributeEvent *ev2 = (xPrintAttributeEvent *) event; - - /* type, serial, send_event, *display */ - - ev->context = (XPContext) ev2->printContext; - ev->detail = (int) ev2->detail; - - return (ENQUEUE_EVENT); - break; - } - - default: - printf ("XpWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",re->type); - break; - } - - return (DONT_ENQUEUE); -} - -/******************************************************************** - * - * Reformat an XEvent into a wire event. - */ -static Status -XpEventToWire(dpy, re, event, count) - register Display *dpy; /* pointer to display structure */ - register XEvent *re; /* pointer to client event */ - register xEvent **event; /* wire protocol event */ - register int *count; -{ - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - switch ((re->type & 0x7f) - info->codes->first_event) - { -#ifdef PRINT_SomeEventExample2 - case PRINT_SomeEventExample: - { - register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) re; - register deviceKeyButtonPointer *kev; - register deviceValuator *vev; - int i; - - *count = 2; - kev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent)); - if (!kev) - return(_XUnknownNativeEvent(dpy, re, event)); - *event = (xEvent *) kev; - - kev->type = ev->type; - kev->root = ev->root; - kev->event = ev->window; - kev->child = ev->subwindow; - kev->time = ev->time; - kev->event_x = ev->x ; - kev->event_y = ev->y ; - kev->root_x = ev->x_root; - kev->root_y = ev->y_root; - kev->state = ev->state; - kev->same_screen = ev->same_screen; - kev->detail = ev->keycode; - kev->deviceid = ev->deviceid | MORE_EVENTS; - - vev = (deviceValuator *) ++kev; - vev->type = info->codes->first_event + XI_DeviceValuator; - vev->deviceid = ev->deviceid; - vev->device_state = ev->device_state; - vev->first_valuator = ev->first_axis; - vev->num_valuators = ev->axes_count; - i = vev->num_valuators; - if (i > 6) i = 6; - switch (i) - { - case 6: vev->valuator5 = ev->axis_data[5]; - case 5: vev->valuator4 = ev->axis_data[4]; - case 4: vev->valuator3 = ev->axis_data[3]; - case 3: vev->valuator2 = ev->axis_data[2]; - case 2: vev->valuator1 = ev->axis_data[1]; - case 1: vev->valuator0 = ev->axis_data[0]; - } - break; - } -#endif /* PRINT_SomeEventExample2 */ - - default: - return(_XUnknownNativeEvent(dpy, re, *event)); - } -} diff --git a/nx-X11/lib/Xp/XpExtUtil.h b/nx-X11/lib/Xp/XpExtUtil.h deleted file mode 100644 index 81b5ce3c4..000000000 --- a/nx-X11/lib/Xp/XpExtUtil.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $XFree86: xc/lib/Xp/XpExtUtil.h,v 1.3 2002/10/16 00:37:31 dawes Exp $ */ -/* - * Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifndef _XPEXTUTIL_H -#define _XPEXTUTIL_H 1 - -#include -#include - -extern XEXT_FIND_DISPLAY_PROTO(xp_find_display); - -extern int XpCheckExtInit( - Display * /* dpy */, - int /* version_index */ -); - -#endif /* _XPEXTUTIL_H */ diff --git a/nx-X11/lib/Xp/XpExtVer.c b/nx-X11/lib/Xp/XpExtVer.c deleted file mode 100644 index 32227e89f..000000000 --- a/nx-X11/lib/Xp/XpExtVer.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $Xorg: XpExtVer.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpExtVer.c,v 1.5 2002/10/16 00:37:31 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Bool -XpQueryExtension ( - Display *dpy, - int *event_base_return, /* return value */ - int *error_base_return /* return value */ -) -{ - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XextHasExtension (info)) { - *event_base_return = info->codes->first_event; - *error_base_return = info->codes->first_error; - return True; - } else { - return False; - } -} - -/* Prototype for |XpCheckExtInitUnlocked()| - * See XpExtUtil.c - same as |XpCheckExtInit()| but does not obtain the Xlib global lock */ -extern int XpCheckExtInitUnlocked( - register Display *dpy, - register int version_index -); - -Status -XpQueryVersion ( - Display *dpy, - short *major_version, - short *minor_version -) -{ - xPrintQueryVersionReq *req; - xPrintQueryVersionReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - /* - * Note: many extensions treat major and minor as "ints", but - * protocol wise and internal wise, they're shorts. - */ - *major_version = 0; - *minor_version = 0; - -#ifdef Would_Need_xpPrintData_Struct_Def - /* - * We may already have the answer cached from a previous query. - */ - if (( info->data ) && ( ((xpPrintData *) info->data)->vers->present )) { - *major_version = ((xpPrintData *) info->data)->vers->major_version ; - *minor_version = ((xpPrintData *) info->data)->vers->minor_version ; - return (/* non-zero indicates extension present */ True); - } -#endif /* Would_Need_xpPrintData_Struct_Def */ - - if (XpCheckExtInitUnlocked(dpy, XP_DONT_CHECK) == -1) - return (/* No such extension */ False); - - LockDisplay (dpy); - - GetReq(PrintQueryVersion,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintQueryVersion; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return(/* No such extension */ False); - } - - *major_version = rep.majorVersion; - *minor_version = rep.minorVersion; - - UnlockDisplay(dpy); - SyncHandle(); - return (/* non-zero indicates extension present */ True); -} - diff --git a/nx-X11/lib/Xp/XpGetData.c b/nx-X11/lib/Xp/XpGetData.c deleted file mode 100644 index b49502155..000000000 --- a/nx-X11/lib/Xp/XpGetData.c +++ /dev/null @@ -1,215 +0,0 @@ -/* $Xorg: XpGetData.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpGetData.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define MAX_XP_BUFFER_SIZE 32768 - -/* - * At the tail of every async struct of ours is attached the - * following "dev private" information needed by our async handler. - */ -typedef struct { - XPContext context; - XPSaveProc save_proc; - XPFinishProc finish_proc; - XPointer client_data; - _XAsyncHandler *async; - unsigned long seq; /* sequence # that will trigger handler */ -} _XpState; - - -/* - * The following is the handler for async replies from - * XpGetDocumentData(). - */ -static Bool -_XpGetDocDataHandler(dpy, rep, buf, len, adata) - register Display *dpy; - register xReply *rep; - char *buf; - int len; - XPointer adata; -{ - register _XpState *state; - xPrintGetDocumentDataReply replbuf; - xPrintGetDocumentDataReply *repl; - int dataLen; - char *data; - - state = (_XpState *)adata; - - /* - * Bypass this handler if the reply is NOT the one we're looking for. - */ - if (dpy->last_request_read != state->seq) { - return False; - } - - /* - * When an error occurs, call the finish_proc and then de-queue - * this event handler. Once an error occurs, all bets are off. - * The error XPGetDocError is *not* the most descriptive, so the - * caller will be encouraged to dig around for the corresponding - * generated error. - * - * Note - Do not confuse the "generated" errors here with - * XPGetDocSecondConsumer which is returned in a protocol reply. - */ - if (rep->generic.type == X_Error) { - (*state->finish_proc)( (Display *) dpy, - (XPContext) state->context, - XPGetDocError, - (XPointer) state->client_data ); - DeqAsyncHandler(dpy, state->async); - Xfree(state->async); - return False; - } - - repl = (xPrintGetDocumentDataReply *) - _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, 0, False); - - if (repl->dataLen) { - /* - * Call save_proc in cases where there was document data - */ - - dataLen = repl->length << 2; /*with pad len*/ - - data = (char *) _XAllocTemp( dpy, dataLen ); - - _XGetAsyncData( dpy, (char *) data, buf, len, - SIZEOF(xPrintGetDocumentDataReply), dataLen, 0); - - (*state->save_proc)( (Display *) dpy, - (XPContext) state->context, - (unsigned char *) data, - (unsigned int) repl->dataLen, /* actual len */ - (XPointer) state->client_data ); - - _XFreeTemp( dpy, (char *) data, dataLen ); - } - - if (repl->finishedFlag) { - /* - * Call finish_proc - */ - (*state->finish_proc)( (Display *) dpy, - (XPContext) state->context, - (XPGetDocStatus) repl->statusCode, - (XPointer) state->client_data ); - /* - * De-queue this async handler - we're done. - */ - DeqAsyncHandler( dpy, state->async ); - Xfree(state->async); - } - - return True; /* the reply WAS consumed by this handler */ -} - -/****************************************************************************** - * - * XpGetDocumentData() - * - * ...registers callbacks to be triggered when async protocol replies - * come back in response to the origial request. - * - * Returned Status indicate whether the callbacks will be used - * (finish_proc and possibly save_proc), or whether they will - * never be used. - * - */ -Status -XpGetDocumentData ( - Display *dpy, - XPContext context, - XPSaveProc save_proc, - XPFinishProc finish_proc, - XPointer client_data -) -{ - xPrintGetDocumentDataReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - _XAsyncHandler *async; - _XpState *async_state; - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return(0); /* No such extension */ - - async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) + - sizeof(_XpState)); - if (!async) - return(0); /* malloc error */ - async_state = (_XpState *)(async + 1); - - LockDisplay (dpy); - - GetReq(PrintGetDocumentData,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetDocumentData; - req->printContext = context; - req->maxBufferSize = MAX_XP_BUFFER_SIZE; /* use as a hint to X server */ - - async_state->context = context; - async_state->save_proc = save_proc; - async_state->finish_proc = finish_proc; - async_state->client_data = client_data; - async_state->seq = dpy->request; - async_state->async = async; - - async->next = dpy->async_handlers; - async->handler = _XpGetDocDataHandler; - async->data = (XPointer)async_state; - - dpy->async_handlers = async; - - UnlockDisplay(dpy); - SyncHandle(); - - return(1); /* success at registering a handler */ -} - diff --git a/nx-X11/lib/Xp/XpImageRes.c b/nx-X11/lib/Xp/XpImageRes.c deleted file mode 100644 index 5b7a5c476..000000000 --- a/nx-X11/lib/Xp/XpImageRes.c +++ /dev/null @@ -1,118 +0,0 @@ -/* $Xorg: XpImageRes.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpImageRes.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Bool -XpSetImageResolution ( - Display *dpy, - XPContext print_context, - int image_res, - int *prev_res -) -{ - xPrintSetImageResolutionReq *req; - xPrintSetImageResolutionReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (image_res < 0 || image_res > 65535) - return (False); - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return (False); - - LockDisplay (dpy); - - GetReq(PrintSetImageResolution,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintSetImageResolution; - req->printContext = print_context; - req->imageRes = image_res; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return(False); - } - - UnlockDisplay(dpy); - SyncHandle(); - if (rep.status && prev_res) - *prev_res = rep.prevRes; - return ( rep.status ); -} - -int -XpGetImageResolution ( - Display *dpy, - XPContext print_context -) -{ - xPrintGetImageResolutionReq *req; - xPrintGetImageResolutionReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return (-1); - - LockDisplay (dpy); - - GetReq(PrintGetImageResolution,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetImageResolution; - req->printContext = print_context; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return(-1); - } - - UnlockDisplay(dpy); - SyncHandle(); - return ( rep.imageRes ); -} diff --git a/nx-X11/lib/Xp/XpInput.c b/nx-X11/lib/Xp/XpInput.c deleted file mode 100644 index 099189517..000000000 --- a/nx-X11/lib/Xp/XpInput.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $Xorg: XpInput.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpInput.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -void -XpSelectInput ( - Display *dpy, - XPContext print_context, - unsigned long event_mask -) -{ - xPrintSelectInputReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension NULL */ - - LockDisplay (dpy); - - GetReq(PrintSelectInput,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintSelectInput; - req->printContext = print_context; - req->eventMask = event_mask; - - UnlockDisplay (dpy); - SyncHandle (); -} - -unsigned long -XpInputSelected ( - Display *dpy, - XPContext print_context, - unsigned long *all_events_mask -) -{ - xPrintInputSelectedReq *req; - xPrintInputSelectedReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return (/* No such extension */ 0L ); - - LockDisplay (dpy); - - GetReq(PrintInputSelected,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintInputSelected; - req->printContext = print_context; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return(/* No such extension */ 0L); - } - - *all_events_mask = rep.allEventsMask; - - UnlockDisplay(dpy); - SyncHandle(); - return ( rep.eventMask ); -} - diff --git a/nx-X11/lib/Xp/XpJob.c b/nx-X11/lib/Xp/XpJob.c deleted file mode 100644 index 1ad7e306a..000000000 --- a/nx-X11/lib/Xp/XpJob.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $Xorg: XpJob.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpJob.c,v 1.5 2002/04/10 16:20:07 tsi Exp $ */ - -#if defined(sun) && defined(i386) && defined(SVR4) && !defined(__EXTENSIONS__) -#define __EXTENSIONS__ -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "XpExtUtil.h" -#include -#ifndef WIN32 -#define X_INCLUDE_PWD_H -#define XOS_USE_XLIB_LOCKING -#include -#endif -#include - - -typedef struct { - int event_base_return; - XPContext context; -} _XpDiscardJobRec; - -static Bool _XpDiscardJob(Display *dpy, XEvent *event, XPointer arg) -{ - _XpDiscardJobRec *disrec = (_XpDiscardJobRec *) arg; - - if (event->type != disrec->event_base_return + XPPrintNotify) - return False; - - if (disrec->context != ((XPPrintEvent *) event)->context) - return False; - - if ((((XPPrintEvent *) event)->detail == XPEndJobNotify) || - (((XPPrintEvent *) event)->detail == XPEndDocNotify) || - (((XPPrintEvent *) event)->detail == XPEndPageNotify)) { - return False; - } - - return True; -} - - -void -XpStartJob ( - Display *dpy, - XPSaveData save_data -) -{ - xPrintStartJobReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - XPContext context; - - - /**************************************************************** - * - * PRIOR TO XPSTARTJOB, set the job attribute "job-owner" - * which will be used by the X-Server when it spools the - * output. When XpStartJob completes, the job attribute - * pool is frozen, disallowing "job-owner" to be modified. - */ - { - char *joa; /* job owner attribute */ - char *PwName; -#ifndef WIN32 -#ifdef X_NEEDS_PWPARAMS - _Xgetpwparams pwparams; -#endif - struct passwd *pw; - pw = _XGetpwuid(getuid(),pwparams); - - if (pw && (PwName = pw->pw_name)) { -#else - if ((PwName = getenv("USERNAME"))) { -#endif - joa = (char *) Xmalloc( strlen( PwName ) + 20 ); - sprintf( joa, "*job-owner: %s", PwName ); - context = XpGetContext( dpy ); - XpSetAttributes( dpy, context, XPJobAttr, joa, XPAttrMerge ); - - Xfree( joa ); - } - } - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintStartJob,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintStartJob; - req->saveData = (CARD8) save_data; - - UnlockDisplay (dpy); - SyncHandle (); -} - - -void -XpEndJob ( - Display *dpy -) -{ - xPrintEndJobReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintEndJob,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndJob; - req->cancel = False; - - UnlockDisplay (dpy); - SyncHandle (); -} - - -void -XpCancelJob ( - Display *dpy, - Bool discard -) -{ - xPrintEndJobReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - _XpDiscardJobRec disrec; - XEvent event; - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintEndJob,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndJob; - req->cancel = True; - - UnlockDisplay (dpy); - SyncHandle (); - - if (discard) { - /* - * get context and effectively do a sync of events. - */ - disrec.event_base_return = info->codes->first_event; - disrec.context = XpGetContext(dpy); - - /* - * discard job, and also doc and page XPPrintNotify events. - */ - while (XCheckIfEvent(dpy, &event, _XpDiscardJob, (XPointer) &disrec)) - { - /*EMPTY*/ - } - } -} - diff --git a/nx-X11/lib/Xp/XpLocale.c b/nx-X11/lib/Xp/XpLocale.c deleted file mode 100644 index ef7c5fb01..000000000 --- a/nx-X11/lib/Xp/XpLocale.c +++ /dev/null @@ -1,269 +0,0 @@ -/* $Xorg: XpLocale.c,v 1.3 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpLocale.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#include - - -/* - * Global hangers for locale hint machinery. - */ -XPHinterProc _xp_hinter_proc = NULL; -char *_xp_hinter_desc = NULL; -int _xp_hinter_init = 1; /* need to init */ - - -extern char *_xpstrdup(); - - -/****************************************************************************** - * - * THE DEFAULT LOCALE HINTER - * - * Make changes here only. - */ -static char *_XpLocaleHinter() -{ -#ifdef hpux - char lbuf[ LC_BUFSIZ ]; - - if ( setlocale_r( LC_CTYPE, (char *) NULL, lbuf, LC_BUFSIZ ) ) { -#else - char *lbuf; - - if ((lbuf = setlocale(LC_CTYPE, (char *) NULL)) == NULL) { -#endif - return( _xpstrdup( "" ) ); - } - else { - return( _xpstrdup( lbuf ) ); - } -} - -#define _XPLOCALEHINTERDESC NULL - - -/****************************************************************************** - * - * XpSetLocaleHinter - */ -void -XpSetLocaleHinter ( - XPHinterProc hinter_proc, - char *hinter_desc -) -{ - - _XLockMutex(_Xglobal_lock); - - /* - * Free up existing hinter description. - */ - if (_xp_hinter_desc) - XFree( _xp_hinter_desc ); - - /* - * Either install the default hinter, or install the - * one provided by the caller. - */ - if (!hinter_proc) { - _xp_hinter_proc = _XpLocaleHinter; - _xp_hinter_desc = _xpstrdup( _XPLOCALEHINTERDESC ); - _xp_hinter_init = 0; - } - else { - _xp_hinter_proc = hinter_proc; - _xp_hinter_desc = _xpstrdup( hinter_desc ); - _xp_hinter_init = 0; - } - - _XUnlockMutex(_Xglobal_lock); -} - - -/****************************************************************************** - * - * XpGetLocaleHinter - */ -char * -XpGetLocaleHinter ( - XPHinterProc *hinter_proc -) -{ - char *tmpstr; - - _XLockMutex(_Xglobal_lock); - - if (_xp_hinter_init) { - _xp_hinter_proc = _XpLocaleHinter; - _xp_hinter_desc = _xpstrdup( _XPLOCALEHINTERDESC ); - _xp_hinter_init = 0; - } - - *hinter_proc = _xp_hinter_proc; - tmpstr = _xpstrdup( _xp_hinter_desc ); - - _XUnlockMutex(_Xglobal_lock); - - return( tmpstr ); -} - - -/****************************************************************************** - * - * XpGetLocaleNetString - * - * this is the routine that uses the locale hint machinery - * to construct the actual "locale_hint" that is passed in - * the various protocols and ICCCM-selection requests. - * - * A "Locale Net String" is made up of two components, a "locale hint" - * that is the locale, and a "locale description" that is a description - * of how the locale was derived. - * - * If a locale hint and description are available, then the net string - * will be the description, and if the description contains the - * keyword "%locale%", that keyword will be replaced with the locale - * hint. For example: - * - * locale_desc = XOPEN;%locale%;01_00;XFN-001001 - * locale_hint = de_DE - * - * result is = XOPEN;de_DE;01_00;XFN-001001 - * - * If only a locale description is available, then it becomes the - * entire net string. - * - * If only a locale hint is available, then it becomes the - * entire net string. - * - * If neither a hint or description exists, a NULL is returned. - */ -char *XpGetLocaleNetString() -{ - XPHinterProc locale_hinter; - - char *locale_desc; - char *locale_hint; - char *tptr1; - char *locale_net_string; - - - /* - * Fetch the current locale hinter machinery. - */ - locale_desc = XpGetLocaleHinter( &locale_hinter ); - - /* - * Run it. - */ - locale_hint = (locale_hinter)(); - - /* - * Use locale_desc and locale_hint to build a full - * locale net string. - */ - if (locale_desc && locale_hint) { - /* - * Combine the two portions to form locale_net_string. - * - * For example: - */ - - tptr1 = strstr( locale_desc, "%locale%" ); - - if (tptr1) { - /* - * Insert locale_hint into locale_desc. - * - * Note: strlen("%locale%") = 8 - */ - locale_net_string = Xmalloc( strlen(locale_desc) - 8 + - strlen(locale_hint) + 1 ); - - /* - * Copy first portion of locale_desc. - */ - *tptr1 = '\0'; - strcpy( locale_net_string, locale_desc ); - - /* - * Copy middle portion consisting of locale_hint. - */ - strcat( locale_net_string, locale_hint ); - - /* - * Copy first portion of locale_desc. - */ - tptr1 = tptr1 + 8; /* skip by %Locale% keyword */ - - strcat( locale_net_string, tptr1 ); - - /* - * Free up and return. - */ - XFree( locale_hint ); - XFree( locale_desc ); - return( locale_net_string ); - } - else { - /* - * Since a locale_desc was given WITHOUT a place to insert - * the locale_hint, the locale_desc wins out. - */ - XFree( locale_hint ); - return( locale_desc ); - } - } - else if (locale_desc) { - return( locale_desc ); - } - else if (locale_hint) { - return( locale_hint ); - } - else { - return( (char *) NULL ); - } -} - diff --git a/nx-X11/lib/Xp/XpNotifyPdm.c b/nx-X11/lib/Xp/XpNotifyPdm.c deleted file mode 100644 index feb62f0eb..000000000 --- a/nx-X11/lib/Xp/XpNotifyPdm.c +++ /dev/null @@ -1,900 +0,0 @@ -/* $Xorg: XpNotifyPdm.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** Description: XpNotifyPdm is used to engage a Page Dialog Manager - ** (PDM). Though the PDM is not a formal part of the - ** Print Extension, the concept and likely usage of - ** PDM's is strong enough that this routine is being - ** provided as a sample standard mechanism for engaging - ** PDM's from the Print Extension. - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpNotifyPdm.c,v 1.7tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -/* - * Alternate selection environment variables. - */ -#define ALT_PDM_SELECTION_ENV_VAR "XPDMSELECTION" -#define ALT_PMD_DISPLAY_ENV_VAR "XPDMDISPLAY" - -/* - * X-Authority file for authorization tickets. - */ -#define PDM_XAUTHORITY_ENV_VAR "XPDMXAUTHORITY" - -/* - * str_dup using Xmalloc - */ -char *_xpstrdup(char * str) -{ - int len; - char *newstr; - - if (!str) - return( (char *) NULL ); - - len = strlen(str) + 1; - newstr = (char *) Xmalloc( len ); - memcpy( newstr, str, len ); - return( newstr ); -} - -/****************************************************************************** - * - * _XpGetSelectionServer - * - * Routine that considers print_display, video_display, and alt - * environment variables, and figures out the selection_display - * and selection_atom. - * - * selection_display can be one of print_display, video_display, - * or a brand new display connection that the caller will later - * have to close. - */ -static Display * -_XpGetSelectionServer ( - Display *print_display, - Display *video_display, - Atom *sel_atom /* return value */ -) -{ - char *tstr1, *tstr2, *tstr3, *tstrptr; - char *sel_displaystr; - Display *sel_display; - char *selectionstr; - - - /* - * Possibly tickle a selection on an alternate display. - */ - if ( (sel_displaystr = getenv( ALT_PMD_DISPLAY_ENV_VAR )) != NULL ) { - if ( !strcmp(sel_displaystr, "print") ) { - /* - * Explicitly use the Print display. - */ - sel_display = print_display; - } - else if ( !strcmp(sel_displaystr, "video") ) { - /* - * Explicitly use the Video display. - */ - sel_display = video_display; - } - else { - /* - * Do more work to determine the selection server connection. - * The following is not clever enough to handle host aliases. - */ - tstr1 = _xpstrdup( sel_displaystr ); - tstr2 = _xpstrdup( XDisplayString(print_display) ); - tstr3 = _xpstrdup( XDisplayString(video_display) ); - - /* - * remove ".scr" portion from "host:disp.scr" strings. - * Use strrchr to find : separating host from display - * to allow IPv6 numeric addresses with embedded colons. - */ - if (( tstrptr = strrchr( tstr1, ':' ) )) - if (( tstrptr = strchr( tstrptr, '.' ) )) - *tstrptr = '\0'; - - if (( tstrptr = strrchr( tstr2, ':' ) )) - if (( tstrptr = strchr( tstrptr, '.' ) )) - *tstrptr = '\0'; - - if (( tstrptr = strrchr( tstr3, ':' ) )) - if (( tstrptr = strchr( tstrptr, '.' ) )) - *tstrptr = '\0'; - - if ( !strcmp( tstr1, tstr2 ) ) { - /* - * Explicitly use the Print display. - */ - sel_display = print_display; - } - else if ( !strcmp( tstr1, tstr3 ) ) { - /* - * Explicitly use the Print display. - */ - sel_display = video_display; - } - else { - /* - * Create a new display connection to a server - * never previously contacted. The caller will - * have to realize this is a new display handle - * (ie, its not equal to print_display or - * video_display) when done. - */ - sel_display = XOpenDisplay(sel_displaystr); - } - - XFree( tstr3 ); - XFree( tstr2 ); - XFree( tstr1 ); - } - } - else { - /* - * If no alt selection server, use the print server. - */ - sel_display = print_display; - } - - if (sel_display) { - /* - * Tickle (possibly alternate) PDM_MANAGER selection - */ - if ( (selectionstr = getenv( ALT_PDM_SELECTION_ENV_VAR )) == NULL ) - selectionstr = "PDM_MANAGER"; - - *sel_atom = XInternAtom( sel_display, selectionstr, False ); - } - - return( sel_display ); -} - - - -/****************************************************************************** - * - * XpGetPdmStartParams - */ -Status -XpGetPdmStartParams ( - Display *print_display, - Window print_window, - XPContext print_context, - Display *video_display, - Window video_window, - Display **selection_display, /* return value */ - Atom *selection, /* return value */ - Atom *type, /* return value */ - int *format, /* return value */ - unsigned char **data, /* return value */ - int *nelements /* return value */ -) -{ - XTextProperty text_prop; - int status; - char str1[128], str2[128], str3[128]; - char *list[6]; - - - *selection_display = _XpGetSelectionServer( print_display, video_display, - selection ); - - if (*selection_display == NULL) { - /* - * Error - cannot determine or establish a selection_display. - */ - return( (Status) NULL ); - } - - /* - * Create a property that can be included in the PDM_MANAGER - * selection to communicate information. - * - * video_display host:display[.anyScreen] - * video_window - * print_display host:display[.anyScreen] - * print_window - * print_context use to derive host:display.properScreen and other - * locale_hint - */ - list[0] = XDisplayString( video_display ); - sprintf( str1, "0x%lx", (long)video_window ); - list[1] = str1; - - list[2] = XDisplayString( print_display ); - sprintf( str2, "0x%lx", (long)print_window ); - list[3] = str2; - - sprintf( str3, "0x%lx", (long)print_context ); - list[4] = str3; - - list[5] = XpGetLocaleNetString(); - - status = XSupportsLocale(); - if ( ! status ) { - /* - * Error. - */ - if ( (*selection_display != print_display) && - (*selection_display != video_display) ) { - XCloseDisplay( *selection_display ); - *selection_display = (Display *) NULL; - } - return( (Status) NULL ); - } - - status = XmbTextListToTextProperty( *selection_display, list, 6, - XStdICCTextStyle, &text_prop ); - - if ( status < 0 ) { - /* - * Error. - */ - if ( (*selection_display != print_display) && - (*selection_display != video_display) ) { - XCloseDisplay( *selection_display ); - *selection_display = (Display *) NULL; - } - return( (Status) NULL ); - } - - *type = text_prop.encoding; - *format = text_prop.format; - *data = text_prop.value; - *nelements = text_prop.nitems; - - XFree(list[5]); - - return( (Status) 1 ); -} - -/****************************************************************************** - * - * XpSendOneTicket - * - * The ticket transfer protocol is as follows: - * unsigned short ticket_state; - * - 0 means NULL ticket, terminating ticket - * - 1 means non-NULL ticket, terminating ticket - * - 2 means non-NULL ticket, and more tickets to send - * unsigned short address_length; - * unsigned short number_length; - * unsigned short name_length; - * unsigned short data_length; - * unsigned short family; - * - * char *address; - * char *number; - * char *name; - * char *data; - * - */ - -Status XpSendOneTicket( - Display *display, - Window window, - Xauth *ticket, - Bool more ) -{ - XClientMessageEvent ev; - int bigstrlen, left, gofor; - char *bigstr, *tptr; - Status status; - - /* - * Fixed portion of event. - */ - ev.type = ClientMessage; - ev.display = display; - ev.window = window; - ev.message_type = XInternAtom( display, "PDM_MAIL", False ); - - /* - * Special build the first ClientMessage to carry the - * ticket transfer header. - */ - ev.format = 16; - - if (!ticket) { - ev.data.s[0] = 0; - } - else { - if (more) - ev.data.s[0] = 2; - else - ev.data.s[0] = 1; - ev.data.s[1] = (short) ticket->address_length; - ev.data.s[2] = (short) ticket->number_length; - ev.data.s[3] = (short) ticket->name_length; - ev.data.s[4] = (short) ticket->data_length; - ev.data.s[5] = (short) ticket->family; - } - - status = XSendEvent( display, window, False, 0L, (XEvent *) &ev ); - if (!status) - return( (Status) 0 ); - - if (!ticket) - return( (Status) 1 );; - - /* - * Break down the remaining ticket data and build the - * second thru N ClientMessages. - */ - ev.format = 8; - bigstrlen = (int) ticket->address_length + - (int) ticket->number_length + - (int) ticket->name_length + - (int) ticket->data_length; - - bigstr = Xmalloc( bigstrlen ); - - tptr = bigstr; - memcpy( tptr, ticket->address, ticket->address_length ); - tptr += ticket->address_length; - memcpy( tptr, ticket->number, ticket->number_length ); - tptr += ticket->number_length; - memcpy( tptr, ticket->name, ticket->name_length ); - tptr += ticket->name_length; - memcpy( tptr, ticket->data, ticket->data_length ); - - left = bigstrlen; - tptr = bigstr; - - while ( left ) { - if (left > 20) - gofor = 20; - else - gofor = left; - - memcpy( ev.data.b, tptr, gofor ); - - tptr += gofor; - left -= gofor; - - status = XSendEvent( display, window, False, 0L, (XEvent *) &ev ); - if (!status) { - Xfree( bigstr ); - return( (Status) 0 ); - } - } - - Xfree( bigstr ); - - return( (Status) 1 ); -} - -Status XpSendAuth( Display *display, Window window ) -{ - - FILE *auth_file; - char *auth_name; - Xauth *entry; - - if ( !(auth_name = getenv( PDM_XAUTHORITY_ENV_VAR )) ) { - return( (Status) 0 ); - /* auth_name = XauFileName (); */ - } - - if (access (auth_name, R_OK) != 0) /* checks REAL id */ - return( (Status) 0 ); - - auth_file = fopen (auth_name, "r"); - if (!auth_file) - return( (Status) 0 ); - - for (;;) { - entry = XauReadAuth (auth_file); - if (!entry) - break; - - /* - * NOTE: in and around this area, an optimization can - * be made. Rather than sending all the tickets in - * .Xauthority, just pull out the *one* that is needed - * by the PDM. - */ - XpSendOneTicket( display, window, entry, True ); - - XauDisposeAuth (entry); - } - - XpSendOneTicket( display, window, (Xauth *) NULL, False ); - - (void) fclose (auth_file); - - return( (Status) 1 ); -} - -/****************************************************************************** - * - * - */ -Status -XpGetAuthParams ( - Display *print_display, - Display *video_display, - Display **sel_display, /* return value */ - Atom *sel_atom, /* return value */ - Atom *sel_target_atom /* return value */ -) -{ - *sel_display = _XpGetSelectionServer( print_display, video_display, - sel_atom ); - - if (*sel_display == NULL) { - /* - * Error - cannot determine or establish a selection_display. - */ - return (Status)0; - } - - /* - * Create property and transfer data to. - */ - *sel_target_atom = XInternAtom( *sel_display, "PDM_MBOX", False ); - return (Status)1; -} - - -/****************************************************************************** - ****************************************************************************** - ** - ** UNSUPPORTED ROUTINES used for testing and debugging. - ** - **/ - - -/****************************************************************************** - * - * Predicate routines to dig out events from the users event queue. - */ - -/* - * client_data structures to use with XIfEvent() - */ -typedef struct { - Window requestor; - Atom selection; - Atom target; -} Dosnrec; - -typedef struct { - Window window; - Atom atom; -} Dopnrec, Docmrec; - - -/* - * Dig out a selection notify from the users event - * queue. - */ -static Bool digOutSelectionNotify( - Display *display, - XEvent *event, - char *arg -) - -{ - Dosnrec *t; - - if (event->type == SelectionNotify) { - t = (Dosnrec *) arg; - - /* - * Selection complete because of good reply. - */ - if ( ( t->requestor == event->xselection.requestor ) && - ( t->selection == event->xselection.selection ) && - ( t->target == event->xselection.target ) ) { - return( True ); - } - - /* - * Selection complete because of problem, and X-Server - * had to generate the event. - */ - if ( ( t->requestor == event->xselection.requestor ) && - ( t->selection == event->xselection.selection ) && - ( None == event->xselection.property ) ) { - return( True ); - } - } - return( False ); -} - -/* - * Dig out a property notify event for the XpNotifyPdm - * selection mechanism from the users event queue. - */ -static Bool digOutPropertyNotify( - Display *display, - XEvent *event, - char *arg -) -{ - Dopnrec *t; - - if (event->type == PropertyNotify) { - t = (Dopnrec *) arg; - if ( ( t->window == event->xproperty.window ) && - ( t->atom == event->xproperty.atom ) ) { - return( True ); - } - } - return( False ); -} - -#ifdef UNUSED -/* - * Dig out a ClientMessage of type PDM_REPLY. - */ -static Bool digOutClientMessage( - Display *display, - XEvent *event, - char *arg -) -{ - Docmrec *t; - - if (event->type == ClientMessage) { - t = (Docmrec *) arg; - if ( ( t->window == event->xclient.window ) && - ( t->atom == event->xclient.message_type ) ) { - return( True ); - } - } - return( False ); -} -#endif - - -/****************************************************************************** - * - * XpCookieToPdm - */ -static char * -XpCookieToPdm ( - Display *print_display, - Display *video_display, - Window sel_window -) -{ - Display *sel_display; - Atom prop_atom, sel_atom, pdm_mbox_atom, ttype; - Dosnrec dosnrec; - Dopnrec dopnrec; - XEvent tevent; - int tformat; - unsigned long nitems, bytes_after; - unsigned char *return_data; - char *sel_str; - char cdata[2048]; - Window tmpw; - - - if ( !getenv(PDM_XAUTHORITY_ENV_VAR) ) { - /* - * short cut for lack of cookie file. - */ - return( (char *) NULL ); - } - - if (! XpGetAuthParams( print_display, video_display, - &sel_display, &sel_atom, &pdm_mbox_atom ) ) { - sprintf(cdata, - "XpCookieToPdm: XpGetAuthParams failed"); - return( _xpstrdup( cdata ) ); - } - - prop_atom = XInternAtom( sel_display, "PDM_MBOX_PROP", False ); - - XConvertSelection( sel_display, sel_atom, pdm_mbox_atom, - prop_atom, sel_window, CurrentTime ); - - /* - * Hang out waiting for a SelectionNotify. Dig out from - * event queue when it arrives. - */ - dosnrec.requestor = sel_window; - dosnrec.selection = sel_atom; - dosnrec.target = pdm_mbox_atom; - - XIfEvent( sel_display, &tevent, digOutSelectionNotify, (char *) &dosnrec ); - - /* - * See if selection was successful. - */ - if ( tevent.xselection.property == None ) { - /* - * The selection failed. - */ - sel_str = XGetAtomName( sel_display, sel_atom ); - sprintf(cdata, - "XpCookieToPdm: Unable to make selection on %s", sel_str); - XFree(sel_str); - - XDeleteProperty( sel_display, sel_window, prop_atom ); - if ((sel_display != print_display) && (sel_display != video_display)) - XCloseDisplay( sel_display ); - return( _xpstrdup( cdata ) ); - } - - /* - * Read property content for status. - */ - XGetWindowProperty( sel_display, sel_window, - prop_atom, 0, 100000, True, AnyPropertyType, - &ttype, &tformat, &nitems, &bytes_after, - &return_data ); - - /* - * So that the client won't see how XpCookieToPdm is implemented, - * run through the event queue, dig out, and destroy all - * PropertyNotify events related to this call. - */ - dopnrec.window = sel_window; - dopnrec.atom = prop_atom; - while ( XCheckIfEvent( sel_display, &tevent, digOutPropertyNotify, - (char *) &dopnrec ) ); - - if ((sel_display != print_display) && (sel_display != video_display)) - XCloseDisplay( sel_display ); - - if ((ttype != XA_WINDOW) && (tformat != 32) && (nitems != 1)) { - /* - * Unable to read SelectionNotify property. - */ - sprintf(cdata, - "XpCookieToPdm: Unable to read SelectionNotify property" ); - return( _xpstrdup( cdata ) ); - } - - tmpw = *((Window *) return_data); - Xfree( return_data ); - - /* - * Now send cookie information. - */ - XpSendAuth( sel_display, tmpw ); - - return( (char *) NULL ); -} - - -/****************************************************************************** - * - * XpNotifyPdm - */ -char * -XpNotifyPdm ( - Display *print_display, - Window print_window, - XPContext print_context, - Display *video_display, - Window video_window, - Bool auth_flag -) -{ - enum { XA_PDM_CLIENT_PROP, XA_PDM_START, XA_PDM_START_OK, - XA_PDM_START_VXAUTH, XA_PDM_START_PXAUTH, XA_PDM_START_ERROR, - NUM_ATOMS }; - static char *atom_names[] = { - "PDM_CLIENT_PROP", "PDM_START", "PDM_START_OK", - "PDM_START_VXAUTH", "PDM_START_PXAUTH", "PDM_START_ERROR" }; - - char cdata[2048]; - char *tptr; - Dosnrec dosnrec; - Dopnrec dopnrec; - XEvent tevent; - - Display *sel_display; - int sel_screen; - Atom sel_atom; - char *sel_str; - - Window sel_window; - Atom prop_type; - int prop_format; - unsigned char *prop_data; - int prop_nelements; - - Atom ttype; - int tformat; - unsigned long nitems, bytes_after; - unsigned char *return_data; - - int tmpi; - Atom atoms[NUM_ATOMS]; - - - - if ( ! XpGetPdmStartParams( print_display, print_window, print_context, - video_display, video_window, - &sel_display, - &sel_atom, - &prop_type, - &prop_format, - &prop_data, - &prop_nelements ) ) { - - sprintf(cdata, "XpNotifyPdm: XpGetPdmStartParams failed" ); - return( _xpstrdup( cdata ) ); - } - - - sel_screen = DefaultScreen( sel_display ); - sel_window = XCreateSimpleWindow( sel_display, - DefaultRootWindow( sel_display ), - 0, 0, 1, 1, 1, - BlackPixel(sel_display, sel_screen), - WhitePixel(sel_display, sel_screen) ); - - /* - * Possibly send over authorization cookies first. - */ - if (auth_flag) { - tptr = XpCookieToPdm ( print_display, video_display, sel_window ); - if (tptr) - return( tptr ); - } - - /* - * Create property and transfer data to. - */ - XInternAtoms( sel_display, atom_names, NUM_ATOMS, False, atoms ); - - XChangeProperty( sel_display, - sel_window, atoms[XA_PDM_CLIENT_PROP], - prop_type, - prop_format, - PropModeReplace, - prop_data, - prop_nelements ); - - XFree( prop_data ); - - /* - * Tickle PDM_MANAGER selection with PDM_START target - */ - XConvertSelection( sel_display, sel_atom, atoms[XA_PDM_START], - atoms[XA_PDM_CLIENT_PROP], sel_window, CurrentTime ); - - /* - * Hang out waiting for a SelectionNotify. Dig out from - * event queue when it arrives. - */ - dosnrec.requestor = sel_window; - dosnrec.selection = sel_atom; - dosnrec.target = atoms[XA_PDM_START]; - - XIfEvent( sel_display, &tevent, digOutSelectionNotify, (char *) &dosnrec ); - - /* - * See if selection was successful. - */ - if ( tevent.xselection.property == None ) { - /* - * The selection failed. - */ - sel_str = XGetAtomName( sel_display, sel_atom ); - sprintf(cdata, - "XpNotifyPdm: Unable to make selection on %s", sel_str); - XFree(sel_str); - - XDeleteProperty( sel_display, sel_window, atoms[XA_PDM_CLIENT_PROP] ); - XDestroyWindow( sel_display, sel_window ); - if ((sel_display != print_display) && (sel_display != video_display)) - XCloseDisplay( sel_display ); - return( _xpstrdup( cdata ) ); - } - - /* - * Read property content for status. - */ - XGetWindowProperty( sel_display, sel_window, - atoms[XA_PDM_CLIENT_PROP], - 0, 100000, True, AnyPropertyType, - &ttype, &tformat, &nitems, &bytes_after, - &return_data ); - - /* - * So that the client won't see how XpNotifyPdm is implemented, - * run through the event queue, dig out, and destroy all - * PropertyNotify events related to this call. - */ - dopnrec.window = sel_window; - dopnrec.atom = atoms[XA_PDM_CLIENT_PROP]; - while ( XCheckIfEvent( sel_display, &tevent, digOutPropertyNotify, - (char *) &dopnrec ) ); - - XDestroyWindow( sel_display, sel_window ); - if ((sel_display != print_display) && (sel_display != video_display)) - XCloseDisplay( sel_display ); - - if ((ttype != XA_ATOM) && (tformat != 32) && (nitems != 1)) { - /* - * Unable to read SelectionNotify property. - */ - sprintf(cdata, - "XpNotifyPdm: Unable to read SelectionNotify property" ); - return( _xpstrdup( cdata ) ); - } - - tmpi = *((Atom *) return_data); - Xfree( return_data ); - - if ( tmpi == atoms[XA_PDM_START_OK] ) { - return( (char *) NULL ); - } - else if ( tmpi == atoms[XA_PDM_START_VXAUTH] ) { - sprintf(cdata, - "XpNotifyPdm: PDM not authorized to connect to video display." ); - return( _xpstrdup( cdata ) ); - } - else if ( tmpi == atoms[XA_PDM_START_PXAUTH] ) { - sprintf(cdata, - "XpNotifyPdm: PDM not authorized to connect to print display." ); - return( _xpstrdup( cdata ) ); - } - else if ( tmpi == atoms[XA_PDM_START_ERROR] ) { - sprintf(cdata, - "XpNotifyPdm: PDM encountered an error. See PDM log file." ); - return( _xpstrdup( cdata ) ); - } - else { - sprintf(cdata, - "XpNotifyPdm: unknown PDM error." ); - return( _xpstrdup( cdata ) ); - } -} - diff --git a/nx-X11/lib/Xp/XpPage.c b/nx-X11/lib/Xp/XpPage.c deleted file mode 100644 index 886bc578a..000000000 --- a/nx-X11/lib/Xp/XpPage.c +++ /dev/null @@ -1,160 +0,0 @@ -/* $Xorg: XpPage.c,v 1.4 2001/03/06 13:59:02 pookie Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpPage.c,v 1.4 2001/12/19 21:28:44 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -typedef struct { - int event_base_return; - XPContext context; -} _XpDiscardPageRec; - -static Bool _XpDiscardPage(Display *dpy, XEvent *event, XPointer arg) -{ - _XpDiscardPageRec *disrec = (_XpDiscardPageRec *) arg; - - if (event->type != disrec->event_base_return + XPPrintNotify) - return False; - - if (disrec->context != ((XPPrintEvent *) event)->context) - return False; - - if (((XPPrintEvent *) event)->detail == XPEndPageNotify) { - return False; - } - - return True; -} - - -void -XpStartPage ( - Display *dpy, - Window window -) -{ - xPrintStartPageReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - XMapWindow(dpy, window); - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintStartPage,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintStartPage; - req->window = window; - - UnlockDisplay (dpy); - SyncHandle (); -} - - -void -XpEndPage ( - Display *dpy -) -{ - xPrintEndPageReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintEndPage,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndPage; - req->cancel = False; - - UnlockDisplay (dpy); - SyncHandle (); -} - - -void -XpCancelPage ( - Display *dpy, - Bool discard -) -{ - xPrintEndPageReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - _XpDiscardPageRec disrec; - XEvent event; - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintEndPage,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintEndPage; - req->cancel = True; - - UnlockDisplay (dpy); - SyncHandle (); - - if (discard) { - /* - * get context and effectively do a sync of events. - */ - disrec.event_base_return = info->codes->first_event; - disrec.context = XpGetContext(dpy); - - /* - * discard page XPPrintNotify events. - */ - while (XCheckIfEvent(dpy, &event, _XpDiscardPage, (XPointer) &disrec)) - { - /*EMPTY*/ - } - } -} - diff --git a/nx-X11/lib/Xp/XpPageDim.c b/nx-X11/lib/Xp/XpPageDim.c deleted file mode 100644 index 61ef28a41..000000000 --- a/nx-X11/lib/Xp/XpPageDim.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $Xorg: XpPageDim.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpPageDim.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Status -XpGetPageDimensions ( - Display *dpy, - XPContext print_context, - unsigned short *width, - unsigned short *height, - XRectangle *reproducible_area -) -{ - xPrintGetPageDimensionsReq *req; - xPrintGetPageDimensionsReply rep; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return (/* No such extension */ 0L ); - - LockDisplay (dpy); - - GetReq(PrintGetPageDimensions,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetPageDimensions; - req->printContext = print_context; - - if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return(/* No such extension */ 0L); - } - - *width = rep.width; - *height = rep.height; - reproducible_area-> x = rep.rx; - reproducible_area-> y = rep.ry; - reproducible_area-> width = rep.rwidth; - reproducible_area-> height = rep.rheight; - - UnlockDisplay(dpy); - SyncHandle(); - return ( 1L ); -} - diff --git a/nx-X11/lib/Xp/XpPrinter.c b/nx-X11/lib/Xp/XpPrinter.c deleted file mode 100644 index 7ed33b706..000000000 --- a/nx-X11/lib/Xp/XpPrinter.c +++ /dev/null @@ -1,248 +0,0 @@ -/* $Xorg: XpPrinter.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpPrinter.c,v 1.8 2001/04/01 14:00:02 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - -XPPrinterList -XpGetPrinterList ( - Display *dpy, - char *printer_name, - int *list_count /* return value */ -) -{ - xPrintGetPrinterListReq *req; - xPrintGetPrinterListReply rep; - - int printer_name_len, locale_len; - char *locale; - - /* For decoding the variable portion of Reply */ - long dataLenVR; - CARD8 *dataVR; /* aka STRING8 */ - - XPPrinterList ptr_list; - - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - /* For converting root winID to corresponding ScreenPtr */ - int i; - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return ( (XPPrinterList) NULL ); /* No such extension */ - - /* - * Fetch locale information. Note: XpGetLocaleNetString has - * a thread-safe mutex on _Xglobal_lock. - */ - locale = XpGetLocaleNetString(); - - LockDisplay (dpy); - - GetReq(PrintGetPrinterList,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintGetPrinterList; - - /* - * Compute lengths of variable portions. - */ - if ( printer_name == (char *) NULL ) - req->printerNameLen = 0; - else if ( *printer_name == (char) NULL ) - req->printerNameLen = 0; - else { - printer_name_len = strlen( printer_name ); - req->length += _XpPadOut(printer_name_len) >> 2; - req->printerNameLen = (unsigned long) printer_name_len; - } - - if ( locale == (char *) NULL ) - req->localeLen = 0; - else if ( *locale == (char) NULL ) - req->localeLen = 0; - else { - locale_len = strlen( locale ); - req->length += _XpPadOut(locale_len) >> 2; - req->localeLen = (unsigned long) locale_len; - } - - /* - * Attach variable data. - */ - if (req->printerNameLen) - Data( dpy, (char *) printer_name, (long) req->printerNameLen ); - - if (req->localeLen) - Data( dpy, (char *) locale, (long) req->localeLen ); - - if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (XPPrinterList) NULL ); /* error */ - } - - XFree(locale); - - *list_count = rep.listCount; - - if (*list_count) { - ptr_list = (XPPrinterList) - Xmalloc( (unsigned) (sizeof(XPPrinterRec) * (*list_count + 1))); - - if (!ptr_list) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (XPPrinterList) NULL ); /* malloc error */ - } - - /* - * NULL last entry so XpFreePrinterList can work without a list_count - */ - ptr_list[*list_count].name = (char *) NULL; - ptr_list[*list_count].desc = (char *) NULL; - - for ( i = 0; i < *list_count; i++ ) { - /* - * Pull printer length and then name. - */ - _XRead32 (dpy, &dataLenVR, (long) sizeof(CARD32) ); - - if (dataLenVR) { - dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 ); - - if (!dataVR) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (XPPrinterList) NULL ); /* malloc error */ - } - - _XReadPad (dpy, (char *) dataVR, (long) dataLenVR); - dataVR[dataLenVR] = 0; - ptr_list[i].name = (char *) dataVR; - } - else { - ptr_list[i].name = (char *) NULL; - } - - /* - * Pull localized description length and then description. - */ - _XRead32 (dpy, &dataLenVR, (long) sizeof(CARD32) ); - - if (dataLenVR) { - dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 ); - - if (!dataVR) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (XPPrinterList) NULL ); /* malloc error */ - } - - _XReadPad (dpy, (char *) dataVR, (long) dataLenVR); - dataVR[dataLenVR] = 0; - ptr_list[i].desc = (char *) dataVR; - } - else { - ptr_list[i].desc = (char *) NULL; - } - } - } - else { - ptr_list = (XPPrinterList) NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ( ptr_list ); -} - - -void -XpFreePrinterList ( - XPPrinterList printer_list -) -{ - int i; - - - if ( printer_list == NULL ) - return; - - i = 0; - while (printer_list[i].name != NULL) { - Xfree( (char *) printer_list[i].name ); - Xfree( (char *) printer_list[i].desc ); - i++; - } - - Xfree( (char *) printer_list ); -} - - -void -XpRehashPrinterList ( - Display *dpy -) -{ - xPrintRehashPrinterListReq *req; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - LockDisplay (dpy); - - GetReq(PrintRehashPrinterList,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintRehashPrinterList; - - UnlockDisplay (dpy); - SyncHandle (); -} - diff --git a/nx-X11/lib/Xp/XpPutData.c b/nx-X11/lib/Xp/XpPutData.c deleted file mode 100644 index 76ff635d3..000000000 --- a/nx-X11/lib/Xp/XpPutData.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: XpPutData.c,v 1.3 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpPutData.c,v 1.3 2001/01/17 19:43:02 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - -void -XpPutDocumentData ( - Display *dpy, - Drawable drawable, - unsigned char *data, - int data_len, - char *doc_fmt, - char *options -) -{ - xPrintPutDocumentDataReq *req; - long maxcando, varlen; - int doc_fmt_len, options_len; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1) - return; /* NoSuchExtension */ - - doc_fmt_len = strlen( doc_fmt ); - options_len = strlen( options ); - - maxcando = XExtendedMaxRequestSize(dpy); - if (!maxcando) - maxcando = XMaxRequestSize(dpy); - varlen = (_XpPadOut(data_len) + - _XpPadOut(doc_fmt_len) + _XpPadOut(options_len)) >> 2; - if (maxcando < ((sz_xPrintPutDocumentDataReq >> 2) + varlen)) - return; - - LockDisplay (dpy); - - GetReq(PrintPutDocumentData,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintPutDocumentData; - req->drawable = drawable; - req->len_data = data_len; - req->len_fmt = doc_fmt_len; - req->len_options = options_len; - SetReqLen(req, varlen, varlen); - - /* - * Send strings, each with padding provided by Data() - */ - Data( dpy, (char *) data, data_len ); - Data( dpy, doc_fmt, doc_fmt_len ); - Data( dpy, options, options_len ); - - UnlockDisplay (dpy); - SyncHandle (); - return; /* Success */ -} - diff --git a/nx-X11/lib/Xp/XpScreens.c b/nx-X11/lib/Xp/XpScreens.c deleted file mode 100644 index dd30ed329..000000000 --- a/nx-X11/lib/Xp/XpScreens.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $Xorg: XpScreens.c,v 1.5 2000/08/17 19:46:08 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 1996 Hewlett-Packard Company - ** (c) Copyright 1996 International Business Machines Corp. - ** (c) Copyright 1996 Sun Microsystems, Inc. - ** (c) Copyright 1996 Novell, Inc. - ** (c) Copyright 1996 Digital Equipment Corp. - ** (c) Copyright 1996 Fujitsu Limited - ** (c) Copyright 1996 Hitachi, Ltd. - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpScreens.c,v 1.5 2001/04/01 14:00:02 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Screen ** -XpQueryScreens ( - Display *dpy, - int *list_count /* return value */ -) -{ - xPrintQueryScreensReq *req; - xPrintQueryScreensReply rep; - - /* For decoding the variable portion of Reply */ - long rootWindow; - - /* For converting root winID to corresponding ScreenPtr */ - Screen **scr_list; - Screen *checkScr; - int i,j; - - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) - return ( (Screen **) NULL ); /* No such extension */ - - LockDisplay (dpy); - - GetReq(PrintQueryScreens,req); - req->reqType = info->codes->major_opcode; - req->printReqType = X_PrintQueryScreens; - - if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (Screen **) NULL ); /* error */ - } - - *list_count = rep.listCount; - - if (*list_count) { - scr_list = (Screen **) - Xmalloc( (unsigned) (sizeof(Screen *) * *list_count) ); - - if (!scr_list) { - UnlockDisplay(dpy); - SyncHandle(); - return ( (Screen **) NULL ); /* malloc error */ - } - i = 0; - while(i < *list_count){ - /* - * Pull printer length and then name. - */ - _XRead32 (dpy, &rootWindow, (long) sizeof(CARD32) ); - scr_list[i] = NULL; - for ( j = 0; j < XScreenCount(dpy); j++ ) { - checkScr = XScreenOfDisplay(dpy, j); - if ( XRootWindowOfScreen(checkScr) == (Window) rootWindow ) { - scr_list[i] = checkScr; - break; - } - } - if(scr_list[i] == NULL) - (*list_count)--; - else - i++; - } - if(!(*list_count)) { - Xfree(scr_list); - scr_list = (Screen **) NULL; - } - } - else { - scr_list = (Screen **) NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ( scr_list ); -} - -- cgit v1.2.3