aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xext
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2017-12-15 12:55:17 +0100
committerMihai Moldovan <ionic@ionic.de>2017-12-15 12:55:17 +0100
commit1dad092caf01d733990648e6df64cbf964df5143 (patch)
tree39de0e643e76754a3e23ca9dd0350b8ba4f76250 /nx-X11/programs/Xserver/Xext
parent6d70b9e3c47f27a166f4aacb522c5c1e49092dd9 (diff)
parent2b9025f797ee322e21077e100c2ee27c2e7fa0e0 (diff)
downloadnx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.gz
nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.bz2
nx-libs-1dad092caf01d733990648e6df64cbf964df5143.zip
Merge branch '3.6.x'
Diffstat (limited to 'nx-X11/programs/Xserver/Xext')
-rw-r--r--nx-X11/programs/Xserver/Xext/EVI.c215
-rw-r--r--nx-X11/programs/Xserver/Xext/EVIstruct.h60
-rw-r--r--nx-X11/programs/Xserver/Xext/Imakefile169
-rw-r--r--nx-X11/programs/Xserver/Xext/Imakefile.NX.original226
-rw-r--r--nx-X11/programs/Xserver/Xext/Imakefile.X.original200
-rw-r--r--nx-X11/programs/Xserver/Xext/appgroup.c829
-rw-r--r--nx-X11/programs/Xserver/Xext/appgroup.h10
-rw-r--r--nx-X11/programs/Xserver/Xext/bigreq.c22
-rw-r--r--nx-X11/programs/Xserver/Xext/cup.c367
-rw-r--r--nx-X11/programs/Xserver/Xext/dgaproc.h144
-rw-r--r--nx-X11/programs/Xserver/Xext/dmx.c1133
-rw-r--r--nx-X11/programs/Xserver/Xext/dpms.c81
-rw-r--r--nx-X11/programs/Xserver/Xext/dpmsproc.h1
-rw-r--r--nx-X11/programs/Xserver/Xext/dpmsstubs.c2
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/Imakefile127
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/modinit.c264
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/modinit.h149
-rw-r--r--nx-X11/programs/Xserver/Xext/fontcache.c333
-rw-r--r--nx-X11/programs/Xserver/Xext/mbuf.c1787
-rw-r--r--nx-X11/programs/Xserver/Xext/mbufbf.c1030
-rw-r--r--nx-X11/programs/Xserver/Xext/mbufpx.c651
-rw-r--r--nx-X11/programs/Xserver/Xext/mitmisc.c176
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiX.c191
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiX.h10
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiXSwap.c24
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiXh.h1
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiXprocs.c280
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiXsrv.h3
-rw-r--r--nx-X11/programs/Xserver/Xext/sampleEVI.c125
-rw-r--r--nx-X11/programs/Xserver/Xext/saver.c148
-rw-r--r--nx-X11/programs/Xserver/Xext/security.c264
-rw-r--r--nx-X11/programs/Xserver/Xext/security.c.NX.original2245
-rw-r--r--nx-X11/programs/Xserver/Xext/security.c.X.original2008
-rw-r--r--nx-X11/programs/Xserver/Xext/shape.c251
-rw-r--r--nx-X11/programs/Xserver/Xext/shm.c211
-rw-r--r--nx-X11/programs/Xserver/Xext/shmint.h44
-rw-r--r--nx-X11/programs/Xserver/Xext/sleepuntil.c49
-rw-r--r--nx-X11/programs/Xserver/Xext/sleepuntil.h5
-rw-r--r--nx-X11/programs/Xserver/Xext/sync.c324
-rw-r--r--nx-X11/programs/Xserver/Xext/vidmodeproc.h78
-rw-r--r--nx-X11/programs/Xserver/Xext/xcmisc.c60
-rw-r--r--nx-X11/programs/Xserver/Xext/xevie.c719
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86bigfont.c142
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86dga.c307
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86dga2.c775
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86dgaext.h12
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86misc.c854
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86miscproc.h70
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86vmode.c2206
-rw-r--r--nx-X11/programs/Xserver/Xext/xprint.c2760
-rw-r--r--nx-X11/programs/Xserver/Xext/xres.c107
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest.c62
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1.frags90
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1dd.c17
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1dd.h1
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1di.c97
-rw-r--r--nx-X11/programs/Xserver/Xext/xvdisp.c545
-rw-r--r--nx-X11/programs/Xserver/Xext/xvdisp.h2
-rw-r--r--nx-X11/programs/Xserver/Xext/xvdix.h5
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmain.c65
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmc.c90
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmcext.h11
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmod.c24
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmodproc.h14
64 files changed, 1444 insertions, 21828 deletions
diff --git a/nx-X11/programs/Xserver/Xext/EVI.c b/nx-X11/programs/Xserver/Xext/EVI.c
deleted file mode 100644
index 93ed19fa6..000000000
--- a/nx-X11/programs/Xserver/Xext/EVI.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* $Xorg: EVI.c,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
-/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.10tsi Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#include "EVIstruct.h"
-#include "modinit.h"
-#include "scrnintstr.h"
-
-#if 0
-static unsigned char XEVIReqCode = 0;
-#endif
-static EviPrivPtr eviPriv;
-
-static int
-ProcEVIQueryVersion(ClientPtr client)
-{
- /* REQUEST(xEVIQueryVersionReq); */
- xEVIQueryVersionReply rep;
- register int n;
- REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XEVI_MAJOR_VERSION;
- rep.minorVersion = XEVI_MAJOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-#define swapEviInfo(eviInfo, l) \
-{ \
- int l1 = l; \
- xExtendedVisualInfo *eviInfo1 = eviInfo; \
- while (l1-- > 0) { \
- swapl(&eviInfo1->core_visual_id, n); \
- swapl(&eviInfo1->transparency_value, n); \
- swaps(&eviInfo1->num_colormap_conflicts, n); \
- eviInfo1++; \
- } \
-}
-#define swapVisual(visual, l) \
-{ \
- int l1 = l; \
- VisualID32 *visual1 = visual; \
- while (l1-- > 0) { \
- swapl(visual1, n); \
- visual1++; \
- } \
-}
-
-static int
-ProcEVIGetVisualInfo(ClientPtr client)
-{
- REQUEST(xEVIGetVisualInfoReq);
- xEVIGetVisualInfoReply rep;
- int i, n, n_conflict, n_info, sz_info, sz_conflict;
- VisualID32 *conflict;
- unsigned int total_visuals = 0;
- xExtendedVisualInfo *eviInfo;
- int status;
-
- /*
- * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
- * here that you don't have more than 2^32 visuals over all your screens;
- * this seems like a safe assumption.
- */
- for (i = 0; i < screenInfo.numScreens; i++)
- total_visuals += screenInfo.screens[i]->numVisuals;
- if (stuff->n_visual > total_visuals)
- return BadValue;
-
- REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
- status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
- &eviInfo, &n_info, &conflict, &n_conflict);
- if (status != Success)
- return status;
- sz_info = n_info * sz_xExtendedVisualInfo;
- sz_conflict = n_conflict * sz_VisualID32;
- rep.type = X_Reply;
- rep.n_info = n_info;
- rep.n_conflicts = n_conflict;
- rep.sequenceNumber = client->sequence;
- rep.length = (sz_info + sz_conflict) >> 2;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.n_info, n);
- swapl(&rep.n_conflicts, n);
- swapEviInfo(eviInfo, n_info);
- swapVisual(conflict, n_conflict);
- }
- WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
- WriteToClient(client, sz_info, (char *)eviInfo);
- WriteToClient(client, sz_conflict, (char *)conflict);
- eviPriv->freeVisualInfo(eviInfo, conflict);
- return (client->noClientException);
-}
-
-static int
-ProcEVIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_EVIQueryVersion:
- return ProcEVIQueryVersion (client);
- case X_EVIGetVisualInfo:
- return ProcEVIGetVisualInfo (client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcEVIQueryVersion(ClientPtr client)
-{
- REQUEST(xEVIQueryVersionReq);
- int n;
- swaps(&stuff->length, n);
- return ProcEVIQueryVersion(client);
-}
-
-static int
-SProcEVIGetVisualInfo(ClientPtr client)
-{
- register int n;
- REQUEST(xEVIGetVisualInfoReq);
- swaps(&stuff->length, n);
- return ProcEVIGetVisualInfo(client);
-}
-
-static int
-SProcEVIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_EVIQueryVersion:
- return SProcEVIQueryVersion (client);
- case X_EVIGetVisualInfo:
- return SProcEVIGetVisualInfo (client);
- default:
- return BadRequest;
- }
-}
-
-/*ARGSUSED*/
-static void
-EVIResetProc(ExtensionEntry *extEntry)
-{
- eviDDXReset();
-}
-
-/****************
- * XEVIExtensionInit
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- ****************/
-void
-EVIExtensionInit(INITARGS)
-{
-#if 0
- ExtensionEntry *extEntry;
-
- if ((extEntry = AddExtension(EVINAME, 0, 0,
- ProcEVIDispatch,
- SProcEVIDispatch,
- EVIResetProc, StandardMinorOpcode))) {
- XEVIReqCode = (unsigned char)extEntry->base;
-#else
- if (AddExtension(EVINAME, 0, 0,
- ProcEVIDispatch, SProcEVIDispatch,
- EVIResetProc, StandardMinorOpcode)) {
-#endif
- eviPriv = eviDDXInit();
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/EVIstruct.h b/nx-X11/programs/Xserver/Xext/EVIstruct.h
deleted file mode 100644
index 857e7565a..000000000
--- a/nx-X11/programs/Xserver/Xext/EVIstruct.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $Xorg: EVIstruct.h,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
-/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/EVIstruct.h,v 3.5 2003/07/16 01:38:28 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef EVI_STRUCT_H
-#define EVI_STRUCT_H
-
-/*
- ******************************************************************************
- ** Per-ddx data
- ******************************************************************************
- */
-
-typedef int (*GetVisualInfoProc)(
- VisualID32*,
- int,
- xExtendedVisualInfo**,
- int*,
- VisualID32**,
- int*
-);
-
-typedef void (*FreeVisualInfoProc)(
- xExtendedVisualInfo*,
- VisualID32*
-);
-typedef struct _EviPrivRec {
- GetVisualInfoProc getVisualInfo;
- FreeVisualInfoProc freeVisualInfo;
-} EviPrivRec, *EviPrivPtr;
-
-extern EviPrivPtr eviDDXInit(void);
-extern void eviDDXReset(void);
-
-#endif /* EVI_STRUCT_H */
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile
index b75f8913b..becc7b66e 100644
--- a/nx-X11/programs/Xserver/Xext/Imakefile
+++ b/nx-X11/programs/Xserver/Xext/Imakefile
@@ -1,73 +1,40 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/Imakefile,v 1.9 2005/04/24 01:10:12 gisburn Exp $ */
-XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:55 cpqbld Exp $
-
-
-
-
-XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.43 2003/04/21 18:56:48 sven Exp $
-
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
-/* NX-X11, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* nx-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE which comes in the source */
+/* distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#include <Server.tmpl>
-#if DoLoadableServer
-#define IHaveSubdirs
-SUBDIRS = extmod
-#endif
-
-#if BuildEVI
-#ifdef SGIArchitectureNotTog
- EVISRCS = EVI.c sgiEVI.c
- EVIOBJS = EVI.o sgiEVI.o
-#else
- EVISRCS = EVI.c sampleEVI.c
- EVIOBJS = EVI.o sampleEVI.o
-#endif
-#endif
-#if HasShm
+#if HasShm && (!(defined(NXAgentServer) && NXAgentServer))
SHMSRCS = shm.c
SHMOBJS = shm.o
#endif
-#if BuildMultibuffer
- MULTIBUFSRC = mbuf.c
- MULTIBUFOBJ = mbuf.o
-#endif
-
#if BuildScreenSaverExt
SCRNSAVSRC = saver.c
SCRNSAVOBJ = saver.o
#endif
-#if BuildXF86VidModeExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
- VIDMODESRCS = xf86vmode.c
- VIDMODEOBJS = xf86vmode.o
-#endif
-
-#if BuildXF86MiscExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
-XF86MISCSRCS = xf86misc.c
-XF86MISCOBJS = xf86misc.o
-#endif
-
#if BuildXF86BigfontExt
XF86BIGFSRCS = xf86bigfont.c
XF86BIGFOBJS = xf86bigfont.o
@@ -76,15 +43,10 @@ XF86BIGFOBJS = xf86bigfont.o
#endif
#endif
-#if BuildXF86DGA
- XF86DGASRCS = xf86dga.c xf86dga2.c
- XF86DGAOBJS = xf86dga.o xf86dga2.o
-#if HasShm
- XVMCSHM_DEFINES = -DHAS_XVMCSHM
-#endif
-#endif
-
-#if BuildXvExt
+#if BuildXvExt && ( (defined(NXAgentServer) && NXAgentServer) && !defined(SunArchitecture) && !defined(cygwinArchitecture) )
+ XVSRCS = xvmain.c xvmc.c
+ XVOBJS = xvmain.o xvmc.o
+#elif BuildXvExt
XVSRCS = xvmain.c xvdisp.c xvmc.c
XVOBJS = xvmain.o xvdisp.o xvmc.o
#endif
@@ -94,72 +56,38 @@ XF86BIGFOBJS = xf86bigfont.o
XRESOBJS = xres.o
#endif
-#if BuildAppgroup
- APPGROUPSRCS = appgroup.c
- APPGROUPOBJS = appgroup.o
-#endif
#if BuildXCSecurity
SECURITYSRCS = security.c
SECURITYOBJS = security.o
SERVERCONFIGDIR = ServerConfigDir
POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\"
#endif
-#if BuildCup
- CUPSRCS = cup.c
- CUPOBJS = cup.o
-#endif
#if BuildXinerama
PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
- PNRXINCLUDES = -I$(FONTINCSRC) -I../mi -I../render
-#endif
-#if XdmxServer
- DMXSRCS = dmx.c
- DMXOBJS = dmx.o
- DMXINCLUDES = -I../hw/dmx
+ PNRXINCLUDES = -I../mi -I../render
#endif
#if BuildDPMS
DPMSSRCS = dpms.c
DPMSOBJS = dpms.o
#endif
-#if BuildFontCache
- FONTCACHESRCS = fontcache.c
- FONTCACHEOBJS = fontcache.o
-#if 0
- FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
-#endif
-#endif
+ SRCS = shape.c $(SHMSRCS) xcmisc.c\
+ xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
+ bigreq.c sync.c $(SCRNSAVSRC) \
+ $(XF86BIGFSRCS) $(SECURITYSRCS) \
+ $(PNRXSRCS) $(DPMSSRCS) \
+ $(XVSRCS) $(XRESSRCS) $(DMXSRCS)
-#if BuildXevie
- XEVIESRCS = xevie.c
- XEVIEOBJS = xevie.o
-#endif
+ OBJS = shape.o $(SHMOBJS) xcmisc.o \
+ xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
+ bigreq.o sync.o $(SCRNSAVOBJ) \
+ $(XF86BIGFOBJS) $(SECURITYOBJS) \
+ $(PNRXOBJS) $(DPMSOBJS) \
+ $(XVOBJS) $(XRESOBJS) $(DMXOBJS)
-#if BuildXprint
- XPRINTSRCS = xprint.c
- XPRINTOBJS = xprint.o
-#endif
-
- SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
- mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
- $(APPGROUPSRCS) $(XPRINTSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
- $(XEVIESRCS) \
- $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS)
-
- OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \
- mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
- $(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
- $(APPGROUPOBJS) $(XPRINTOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
- $(XEVIEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
-
- SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) $(XPRINTOBJS) \
+ SOBJS = $(SHMOBJS) $(SECURITYOBJS) \
shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
- $(XEVIEOBJS) \
$(XF86BIGFOBJS)
#if defined(NXAgentServer) && NXAgentServer
@@ -167,13 +95,15 @@ NX_DEFINES = -DNXAGENT_SERVER
#endif
-#if (defined(XFree86Version) || defined(XorgVersion))
+#if defined(XorgVersion)
/* XXX Check if this can be eliminated */
XF86INCLUDES = -I$(XF86COMSRC)
#endif
INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC) \
- $(FONTCACHEINCLUDES) $(DMXINCLUDES)
+ $(PNRXINCLUDES) \
+ $(XF86INCLUDES) \
+ $(DMXINCLUDES) \
+ `pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
#if defined(NXAgentServer) && NXAgentServer
@@ -184,21 +114,10 @@ XF86INCLUDES = -I$(XF86COMSRC)
NormalLibraryObjectRule()
-/*
- * A hack to work around an optimization problem with gcc 2.95.2
- */
-#if BuildXF86VidModeExt && defined(GccOptBug295)
-SpecialCObjectRule(xf86vmode,NullParameter,-O0)
-#endif
-
NormalLibraryTarget(ext,$(OBJS))
LintLibraryTarget(ext,$(SRCS))
NormalLintTarget($(SRCS))
-#if DoLoadableServer
-NormalLibraryTarget(exts,$(SOBJS))
-#endif
-
#if BuildXF86BigfontExt
SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES))
#endif
@@ -208,19 +127,11 @@ SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
LinkConfDirectory(xserver,.,xserver,.)
-LinkSourceFile(modinit.h,extmod)
-
#if BuildXCSecurity && InstallSecurityConfig
InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR))
#endif
DependTarget()
-#if DoLoadableServer
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-#endif
-
-InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile.NX.original b/nx-X11/programs/Xserver/Xext/Imakefile.NX.original
deleted file mode 100644
index b75f8913b..000000000
--- a/nx-X11/programs/Xserver/Xext/Imakefile.NX.original
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/Imakefile,v 1.9 2005/04/24 01:10:12 gisburn Exp $ */
-XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:55 cpqbld Exp $
-
-
-
-
-XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.43 2003/04/21 18:56:48 sven Exp $
-
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NX-X11, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include <Server.tmpl>
-
-#if DoLoadableServer
-#define IHaveSubdirs
-SUBDIRS = extmod
-#endif
-
-#if BuildEVI
-#ifdef SGIArchitectureNotTog
- EVISRCS = EVI.c sgiEVI.c
- EVIOBJS = EVI.o sgiEVI.o
-#else
- EVISRCS = EVI.c sampleEVI.c
- EVIOBJS = EVI.o sampleEVI.o
-#endif
-#endif
-#if HasShm
- SHMSRCS = shm.c
- SHMOBJS = shm.o
-#endif
-
-#if BuildMultibuffer
- MULTIBUFSRC = mbuf.c
- MULTIBUFOBJ = mbuf.o
-#endif
-
-#if BuildScreenSaverExt
- SCRNSAVSRC = saver.c
- SCRNSAVOBJ = saver.o
-#endif
-
-#if BuildXF86VidModeExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
- VIDMODESRCS = xf86vmode.c
- VIDMODEOBJS = xf86vmode.o
-#endif
-
-#if BuildXF86MiscExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
-XF86MISCSRCS = xf86misc.c
-XF86MISCOBJS = xf86misc.o
-#endif
-
-#if BuildXF86BigfontExt
-XF86BIGFSRCS = xf86bigfont.c
-XF86BIGFOBJS = xf86bigfont.o
-#if HasShm
- SHM_DEFINES = -DHAS_SHM
-#endif
-#endif
-
-#if BuildXF86DGA
- XF86DGASRCS = xf86dga.c xf86dga2.c
- XF86DGAOBJS = xf86dga.o xf86dga2.o
-#if HasShm
- XVMCSHM_DEFINES = -DHAS_XVMCSHM
-#endif
-#endif
-
-#if BuildXvExt
- XVSRCS = xvmain.c xvdisp.c xvmc.c
- XVOBJS = xvmain.o xvdisp.o xvmc.o
-#endif
-
-#if BuildXResExt
- XRESSRCS = xres.c
- XRESOBJS = xres.o
-#endif
-
-#if BuildAppgroup
- APPGROUPSRCS = appgroup.c
- APPGROUPOBJS = appgroup.o
-#endif
-#if BuildXCSecurity
- SECURITYSRCS = security.c
- SECURITYOBJS = security.o
- SERVERCONFIGDIR = ServerConfigDir
- POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\"
-#endif
-#if BuildCup
- CUPSRCS = cup.c
- CUPOBJS = cup.o
-#endif
-#if BuildXinerama
- PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
- PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
- PNRXINCLUDES = -I$(FONTINCSRC) -I../mi -I../render
-#endif
-#if XdmxServer
- DMXSRCS = dmx.c
- DMXOBJS = dmx.o
- DMXINCLUDES = -I../hw/dmx
-#endif
-#if BuildDPMS
- DPMSSRCS = dpms.c
- DPMSOBJS = dpms.o
-#endif
-
-#if BuildFontCache
- FONTCACHESRCS = fontcache.c
- FONTCACHEOBJS = fontcache.o
-#if 0
- FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
-#endif
-#endif
-
-#if BuildXevie
- XEVIESRCS = xevie.c
- XEVIEOBJS = xevie.o
-#endif
-
-#if BuildXprint
- XPRINTSRCS = xprint.c
- XPRINTOBJS = xprint.o
-#endif
-
- SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
- mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
- $(APPGROUPSRCS) $(XPRINTSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
- $(XEVIESRCS) \
- $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS)
-
- OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \
- mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
- $(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
- $(APPGROUPOBJS) $(XPRINTOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
- $(XEVIEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
-
- SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) $(XPRINTOBJS) \
- shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
- $(XEVIEOBJS) \
- $(XF86BIGFOBJS)
-
-#if defined(NXAgentServer) && NXAgentServer
-NX_DEFINES = -DNXAGENT_SERVER
-#endif
-
-
-#if (defined(XFree86Version) || defined(XorgVersion))
-/* XXX Check if this can be eliminated */
-XF86INCLUDES = -I$(XF86COMSRC)
-#endif
- INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC) \
- $(FONTCACHEINCLUDES) $(DMXINCLUDES)
- LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
-
-#if defined(NXAgentServer) && NXAgentServer
- DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES) $(NX_DEFINES)
-#else
- DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES)
-#endif
-
-NormalLibraryObjectRule()
-
-/*
- * A hack to work around an optimization problem with gcc 2.95.2
- */
-#if BuildXF86VidModeExt && defined(GccOptBug295)
-SpecialCObjectRule(xf86vmode,NullParameter,-O0)
-#endif
-
-NormalLibraryTarget(ext,$(OBJS))
-LintLibraryTarget(ext,$(SRCS))
-NormalLintTarget($(SRCS))
-
-#if DoLoadableServer
-NormalLibraryTarget(exts,$(SOBJS))
-#endif
-
-#if BuildXF86BigfontExt
-SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES))
-#endif
-#if BuildXCSecurity
-SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
-#endif
-
-LinkConfDirectory(xserver,.,xserver,.)
-
-LinkSourceFile(modinit.h,extmod)
-
-#if BuildXCSecurity && InstallSecurityConfig
-InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR))
-#endif
-
-DependTarget()
-
-#if DoLoadableServer
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-#endif
-
-InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR))
-InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
-InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile.X.original b/nx-X11/programs/Xserver/Xext/Imakefile.X.original
deleted file mode 100644
index f2753b3f4..000000000
--- a/nx-X11/programs/Xserver/Xext/Imakefile.X.original
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/Imakefile,v 1.9 2005/04/24 01:10:12 gisburn Exp $ */
-XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:55 cpqbld Exp $
-
-
-
-
-XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.43 2003/04/21 18:56:48 sven Exp $
-
-#include <Server.tmpl>
-
-#if DoLoadableServer
-#define IHaveSubdirs
-SUBDIRS = extmod
-#endif
-
-#if BuildEVI
-#ifdef SGIArchitectureNotTog
- EVISRCS = EVI.c sgiEVI.c
- EVIOBJS = EVI.o sgiEVI.o
-#else
- EVISRCS = EVI.c sampleEVI.c
- EVIOBJS = EVI.o sampleEVI.o
-#endif
-#endif
-#if HasShm
- SHMSRCS = shm.c
- SHMOBJS = shm.o
-#endif
-
-#if BuildMultibuffer
- MULTIBUFSRC = mbuf.c
- MULTIBUFOBJ = mbuf.o
-#endif
-
-#if BuildScreenSaverExt
- SCRNSAVSRC = saver.c
- SCRNSAVOBJ = saver.o
-#endif
-
-#if BuildXF86VidModeExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
- VIDMODESRCS = xf86vmode.c
- VIDMODEOBJS = xf86vmode.o
-#endif
-
-#if BuildXF86MiscExt && \
- ((defined(XF86Server) && XF86Server) || \
- (defined(XorgServer) && XorgServer))
-XF86MISCSRCS = xf86misc.c
-XF86MISCOBJS = xf86misc.o
-#endif
-
-#if BuildXF86BigfontExt
-XF86BIGFSRCS = xf86bigfont.c
-XF86BIGFOBJS = xf86bigfont.o
-#if HasShm
- SHM_DEFINES = -DHAS_SHM
-#endif
-#endif
-
-#if BuildXF86DGA
- XF86DGASRCS = xf86dga.c xf86dga2.c
- XF86DGAOBJS = xf86dga.o xf86dga2.o
-#if HasShm
- XVMCSHM_DEFINES = -DHAS_XVMCSHM
-#endif
-#endif
-
-#if BuildXvExt
- XVSRCS = xvmain.c xvdisp.c xvmc.c
- XVOBJS = xvmain.o xvdisp.o xvmc.o
-#endif
-
-#if BuildXResExt
- XRESSRCS = xres.c
- XRESOBJS = xres.o
-#endif
-
-#if BuildAppgroup
- APPGROUPSRCS = appgroup.c
- APPGROUPOBJS = appgroup.o
-#endif
-#if BuildXCSecurity
- SECURITYSRCS = security.c
- SECURITYOBJS = security.o
- SERVERCONFIGDIR = ServerConfigDir
- POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\"
-#endif
-#if BuildCup
- CUPSRCS = cup.c
- CUPOBJS = cup.o
-#endif
-#if BuildXinerama
- PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
- PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
- PNRXINCLUDES = -I$(FONTINCSRC) -I../mi -I../render
-#endif
-#if XdmxServer
- DMXSRCS = dmx.c
- DMXOBJS = dmx.o
- DMXINCLUDES = -I../hw/dmx
-#endif
-#if BuildDPMS
- DPMSSRCS = dpms.c
- DPMSOBJS = dpms.o
-#endif
-
-#if BuildFontCache
- FONTCACHESRCS = fontcache.c
- FONTCACHEOBJS = fontcache.o
-#if 0
- FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
-#endif
-#endif
-
-#if BuildXevie
- XEVIESRCS = xevie.c
- XEVIEOBJS = xevie.o
-#endif
-
-#if BuildXprint
- XPRINTSRCS = xprint.c
- XPRINTOBJS = xprint.o
-#endif
-
- SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
- mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
- $(APPGROUPSRCS) $(XPRINTSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
- $(XEVIESRCS) \
- $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS)
-
- OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \
- mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
- $(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
- $(APPGROUPOBJS) $(XPRINTOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
- $(XEVIEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
-
- SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) $(XPRINTOBJS) \
- shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
- $(XEVIEOBJS) \
- $(XF86BIGFOBJS)
-
-#if (defined(XFree86Version) || defined(XorgVersion))
-/* XXX Check if this can be eliminated */
-XF86INCLUDES = -I$(XF86COMSRC)
-#endif
- INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC) \
- $(FONTCACHEINCLUDES) $(DMXINCLUDES)
- LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
-
- DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES)
-
-NormalLibraryObjectRule()
-
-/*
- * A hack to work around an optimization problem with gcc 2.95.2
- */
-#if BuildXF86VidModeExt && defined(GccOptBug295)
-SpecialCObjectRule(xf86vmode,NullParameter,-O0)
-#endif
-
-NormalLibraryTarget(ext,$(OBJS))
-LintLibraryTarget(ext,$(SRCS))
-NormalLintTarget($(SRCS))
-
-#if DoLoadableServer
-NormalLibraryTarget(exts,$(SOBJS))
-#endif
-
-#if BuildXF86BigfontExt
-SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES))
-#endif
-#if BuildXCSecurity
-SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
-#endif
-
-LinkConfDirectory(xserver,.,xserver,.)
-
-LinkSourceFile(modinit.h,extmod)
-
-#if BuildXCSecurity && InstallSecurityConfig
-InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR))
-#endif
-
-DependTarget()
-
-#if DoLoadableServer
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-#endif
-
-InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR))
-InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
-InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/nx-X11/programs/Xserver/Xext/appgroup.c b/nx-X11/programs/Xserver/Xext/appgroup.c
deleted file mode 100644
index ad4afa9e4..000000000
--- a/nx-X11/programs/Xserver/Xext/appgroup.c
+++ /dev/null
@@ -1,829 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.10tsi Exp $ */
-/*
-Copyright 1996, 1998, 2001 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-*/
-/* $Xorg: appgroup.c,v 1.6 2001/02/09 02:04:32 xorgcvs Exp $ */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "colormapst.h"
-#include "servermd.h"
-#define _XAG_SERVER_
-#include <X11/extensions/Xagstr.h>
-#include <X11/extensions/Xagsrv.h>
-#define _SECURITY_SERVER
-#include <X11/extensions/security.h>
-#include <X11/Xfuncproto.h>
-
-#define XSERV_t
-#include <X11/Xtrans/Xtrans.h>
-#include "../os/osdep.h"
-
-#include <stdio.h>
-
-#include "modinit.h"
-#include "appgroup.h"
-
-typedef struct _AppGroupRec {
- struct _AppGroupRec* next;
- XID appgroupId;
- ClientPtr* clients;
- int nclients;
- ClientPtr leader;
- Bool single_screen;
- Window default_root;
- VisualID root_visual;
- Colormap default_colormap;
- Pixel black_pixel;
- Pixel white_pixel;
- xConnSetupPrefix connSetupPrefix;
- char* ConnectionInfo;
-} AppGroupRec, *AppGroupPtr;
-
-static int ProcXagDispatch(ClientPtr client);
-static int SProcXagDispatch(ClientPtr client);
-static void XagResetProc(ExtensionEntry* extEntry);
-
-#if 0
-static unsigned char XagReqCode = 0;
-static int XagErrorBase;
-#endif
-static int XagCallbackRefCount = 0;
-
-static RESTYPE RT_APPGROUP;
-static AppGroupPtr appGrpList = NULL;
-
-extern xConnSetupPrefix connSetupPrefix;
-extern char* ConnectionInfo;
-extern int connBlockScreenStart;
-
-static
-int XagAppGroupFree(
- pointer what,
- XID id) /* unused */
-{
- int i;
- AppGroupPtr pAppGrp = (AppGroupPtr) what;
-
- if (pAppGrp->leader)
- for (i = 0; i < pAppGrp->nclients; i++) {
- pAppGrp->clients[i]->appgroup = NULL;
- CloseDownClient (pAppGrp->clients[i]);
- }
-
- if (pAppGrp == appGrpList)
- appGrpList = appGrpList->next;
- else {
- AppGroupPtr tpAppGrp;
- for (tpAppGrp = appGrpList;
- tpAppGrp->next != NULL;
- tpAppGrp = tpAppGrp->next) {
- if (tpAppGrp->next == pAppGrp) {
- tpAppGrp->next = tpAppGrp->next->next;
- break;
- }
- }
- }
- (void) xfree (pAppGrp->clients);
- (void) xfree (pAppGrp->ConnectionInfo);
- (void) xfree (what);
- return Success;
-}
-
-/* static */
-void XagClientStateChange(
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata)
-{
- SecurityAuthorizationPtr pAuth;
- NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
- ClientPtr pClient = pci->client;
- AppGroupPtr pAppGrp;
- XID authId = 0;
-
- if (!pClient->appgroup) {
- switch (pClient->clientState) {
-
- case ClientStateAuthenticating:
- case ClientStateRunning:
- case ClientStateCheckingSecurity:
- return;
-
- case ClientStateInitial:
- case ClientStateCheckedSecurity:
- /*
- * If the client is connecting via a firewall proxy (which
- * uses XC-QUERY-SECURITY-1, then the authId is available
- * during ClientStateCheckedSecurity, otherwise it's
- * available during ClientStateInitial.
- *
- * Don't get it from pClient because can't guarantee the order
- * of the callbacks and the security extension might not have
- * plugged it in yet.
- */
- authId = AuthorizationIDOfClient(pClient);
- break;
-
- case ClientStateGone:
- case ClientStateRetained:
- /*
- * Don't get if from AuthorizationIDOfClient because can't
- * guarantee the order of the callbacks and the security
- * extension may have torn down the client's private data
- */
- authId = pClient->authId;
- break;
- }
-
- if (authId == None)
- return;
-
- pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient,
- authId, SecurityAuthorizationResType, SecurityReadAccess);
-
- if (pAuth == NULL)
- return;
-
- for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
- if (pAppGrp->appgroupId == pAuth->group) break;
- } else {
- pAppGrp = pClient->appgroup;
- }
-
- if (!pAppGrp)
- return;
-
- switch (pClient->clientState) {
- case ClientStateAuthenticating:
- case ClientStateRunning:
- case ClientStateCheckingSecurity:
- break;
-
- case ClientStateInitial:
- case ClientStateCheckedSecurity:
- /* see the comment above about Initial vs. CheckedSecurity */
- {
- /* if this client already in AppGroup, don't add it again */
- int i;
- for (i = 0; i < pAppGrp->nclients; i++)
- if (pClient == pAppGrp->clients[i]) return;
- }
- pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
- ++pAppGrp->nclients * sizeof (ClientPtr));
- pAppGrp->clients[pAppGrp->nclients - 1] = pClient;
- pClient->appgroup = pAppGrp;
- break;
-
- case ClientStateGone:
- case ClientStateRetained: /* client disconnected, dump it */
- {
- int i;
- for (i = 0; i < pAppGrp->nclients; i++)
- if (pAppGrp->clients[i] == pClient) {
- pAppGrp->clients[i] = NULL;
- break;
- }
- for (i = 0; i < pAppGrp->nclients; i++)
- if (pAppGrp->clients[i] == NULL && i + 1 < pAppGrp->nclients)
- pAppGrp->clients[i] = pAppGrp->clients[i + 1];
- pAppGrp->nclients--;
- }
- pClient->appgroup = NULL; /* redundant, pClient will be freed */
- break;
- }
-}
-
-void
-XagExtensionInit(INITARGS)
-{
-#if 0
- ExtensionEntry* extEntry;
-
- if ((extEntry = AddExtension (XAGNAME,
- 0,
- XagNumberErrors,
- ProcXagDispatch,
- SProcXagDispatch,
- XagResetProc,
- StandardMinorOpcode))) {
- XagReqCode = (unsigned char)extEntry->base;
- XagErrorBase = extEntry->errorBase;
-#else
- if (AddExtension (XAGNAME,
- 0,
- XagNumberErrors,
- ProcXagDispatch,
- SProcXagDispatch,
- XagResetProc,
- StandardMinorOpcode)) {
-#endif
- RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
- }
-}
-
-/*ARGSUSED*/
-static
-void XagResetProc(
- ExtensionEntry* extEntry)
-{
- DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
- XagCallbackRefCount = 0;
- while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0);
-}
-
-static
-int ProcXagQueryVersion(
- register ClientPtr client)
-{
- /* REQUEST (xXagQueryVersionReq); */
- xXagQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH (xXagQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.server_major_version = XAG_MAJOR_VERSION;
- rep.server_minor_version = XAG_MINOR_VERSION;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swaps (&rep.server_major_version, n);
- swaps (&rep.server_minor_version, n);
- }
- WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-void ProcessAttr(
- AppGroupPtr pAppGrp,
- ClientPtr client,
- unsigned int attrib_mask,
- CARD32* attribs)
-{
- int i;
-
- for (i = 0; i <= XagNappGroupLeader; i++) {
- switch (attrib_mask & (1 << i)) {
- case XagSingleScreenMask:
- pAppGrp->single_screen = *attribs;
- break;
- case XagDefaultRootMask:
- pAppGrp->default_root = *attribs;
- break;
- case XagRootVisualMask:
- pAppGrp->root_visual = *attribs;
- break;
- case XagDefaultColormapMask:
- pAppGrp->default_colormap = *attribs;
- break;
- case XagBlackPixelMask:
- pAppGrp->black_pixel = *attribs;
- break;
- case XagWhitePixelMask:
- pAppGrp->white_pixel = *attribs;
- break;
- case XagAppGroupLeaderMask:
- pAppGrp->leader = client;
- break;
- default: continue;
- }
- attribs++;
- }
-}
-
-static
-void CreateConnectionInfo(
- AppGroupPtr pAppGrp)
-{
- xWindowRoot* rootp;
- xWindowRoot* roots[MAXSCREENS];
- unsigned int rootlens[MAXSCREENS];
- xDepth* depth;
- int olen;
- int snum, i;
-
- rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
- for (snum = 0; snum < screenInfo.numScreens; snum++) {
-
- rootlens[snum] = sizeof (xWindowRoot);
- roots[snum] = rootp;
-
- depth = (xDepth*) (rootp + 1);
- for (i = 0; i < rootp->nDepths; i++) {
- rootlens[snum] += sizeof (xDepth) +
- depth->nVisuals * sizeof (xVisualType);
- depth = (xDepth *)(((char*)(depth + 1)) +
- depth->nVisuals * sizeof (xVisualType));
- }
- rootp = (xWindowRoot*) depth;
- }
- snum = 0;
- if (pAppGrp->default_root) {
- for (; snum < screenInfo.numVideoScreens; snum++) {
- if (roots[snum]->windowId == pAppGrp->default_root)
- break;
- }
- }
- olen = connBlockScreenStart + rootlens[snum];
- for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
- olen += rootlens[i];
- pAppGrp->ConnectionInfo = (char*) xalloc (olen);
- if (!pAppGrp->ConnectionInfo)
- return;
- memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
- ((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
- 1 + screenInfo.numScreens - screenInfo.numVideoScreens;
- memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
- (void*) roots[snum], rootlens[snum]);
- rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
- if (pAppGrp->default_colormap) {
- rootp->defaultColormap = pAppGrp->default_colormap;
- rootp->whitePixel = pAppGrp->white_pixel;
- rootp->blackPixel = pAppGrp->black_pixel;
- }
- if (pAppGrp->root_visual)
- rootp->rootVisualID = pAppGrp->root_visual;
- rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
- for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
- memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
- rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
- }
- pAppGrp->connSetupPrefix = connSetupPrefix;
- pAppGrp->connSetupPrefix.length = olen >> 2;
-}
-
-static
-AppGroupPtr CreateAppGroup(
- ClientPtr client,
- XID appgroupId,
- unsigned int attrib_mask,
- CARD32* attribs)
-{
- AppGroupPtr pAppGrp;
-
- pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
- if (pAppGrp) {
- pAppGrp->next = appGrpList;
- appGrpList = pAppGrp;
- pAppGrp->appgroupId = appgroupId;
- pAppGrp->clients = (ClientPtr*) xalloc (0);
- pAppGrp->nclients = 0;
- pAppGrp->leader = NULL;
- pAppGrp->default_root = 0;
- pAppGrp->root_visual = 0;
- pAppGrp->default_colormap = 0;
- pAppGrp->black_pixel = -1;
- pAppGrp->white_pixel = -1;
- pAppGrp->ConnectionInfo = NULL;
- ProcessAttr (pAppGrp, client, attrib_mask, attribs);
- }
- return pAppGrp;
-}
-
-static
-int AttrValidate(
- ClientPtr client,
- int attrib_mask,
- AppGroupPtr pAppGrp)
-{
- WindowPtr pWin;
- int idepth, ivids, found;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- ColormapPtr pColormap;
-
- pWin = LookupWindow (pAppGrp->default_root, client);
- /* XXX check that pWin is not NULL */
- pScreen = pWin->drawable.pScreen;
- if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
- return BadWindow;
- pDepth = pScreen->allowedDepths;
- if (pAppGrp->root_visual) {
- found = FALSE;
- for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
- for (ivids = 0; ivids < pDepth->numVids; ivids++) {
- if (pAppGrp->root_visual == pDepth->vids[ivids]) {
- found = TRUE;
- break;
- }
- }
- }
- if (!found)
- return BadMatch;
- }
- if (pAppGrp->default_colormap) {
-
- pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);
- /* XXX check that pColormap is not NULL */
- if (pColormap->pScreen != pScreen)
- return BadColor;
- if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
- return BadMatch;
- }
- return client->noClientException;
-}
-
-/* static */
-int ProcXagCreate (
- register ClientPtr client)
-{
- REQUEST (xXagCreateReq);
- AppGroupPtr pAppGrp;
- int ret;
-
- REQUEST_AT_LEAST_SIZE (xXagCreateReq);
-
- LEGAL_NEW_RESOURCE (stuff->app_group, client);
- pAppGrp = CreateAppGroup (client, stuff->app_group,
- stuff->attrib_mask, (CARD32*) &stuff[1]);
- if (!pAppGrp)
- return BadAlloc;
- ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
- if (ret != Success) {
- XagAppGroupFree ((pointer)pAppGrp, (XID)0);
- return ret;
- }
- if (pAppGrp->single_screen) {
- CreateConnectionInfo (pAppGrp);
- if (!pAppGrp->ConnectionInfo)
- return BadAlloc;
- }
- if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
- return BadAlloc;
- if (XagCallbackRefCount++ == 0)
- (void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
- return client->noClientException;
-}
-
-/* static */
-int ProcXagDestroy(
- register ClientPtr client)
-{
- AppGroupPtr pAppGrp;
- REQUEST (xXagDestroyReq);
-
- REQUEST_SIZE_MATCH (xXagDestroyReq);
- pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
- (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
- if (!pAppGrp) return XagBadAppGroup;
- FreeResource ((XID)stuff->app_group, RT_NONE);
- if (--XagCallbackRefCount == 0)
- (void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
- return client->noClientException;
-}
-
-static
-int ProcXagGetAttr(
- register ClientPtr client)
-{
- AppGroupPtr pAppGrp;
- REQUEST (xXagGetAttrReq);
- xXagGetAttrReply rep;
- int n;
-
- REQUEST_SIZE_MATCH (xXagGetAttrReq);
- pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
- (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
- if (!pAppGrp) return XagBadAppGroup;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.default_root = pAppGrp->default_root;
- rep.root_visual = pAppGrp->root_visual;
- rep.default_colormap = pAppGrp->default_colormap;
- rep.black_pixel = pAppGrp->black_pixel;
- rep.white_pixel = pAppGrp->white_pixel;
- rep.single_screen = pAppGrp->single_screen;
- rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swapl (&rep.default_root, n);
- swapl (&rep.root_visual, n);
- swapl (&rep.default_colormap, n);
- swapl (&rep.black_pixel, n);
- swapl (&rep.white_pixel, n);
- }
- WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcXagQuery(
- register ClientPtr client)
-{
- ClientPtr pClient;
- AppGroupPtr pAppGrp;
- REQUEST (xXagQueryReq);
- int n;
-
- REQUEST_SIZE_MATCH (xXagQueryReq);
- pClient = LookupClient (stuff->resource, client);
- for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
- for (n = 0; n < pAppGrp->nclients; n++)
- if (pAppGrp->clients[n] == pClient) {
- xXagQueryReply rep;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.app_group = pAppGrp->appgroupId;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swapl (&rep.app_group, n);
- }
- WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
- return client->noClientException;
- }
-
- return BadMatch;
-}
-
-static
-int ProcXagCreateAssoc(
- register ClientPtr client)
-{
- REQUEST (xXagCreateAssocReq);
-
- REQUEST_SIZE_MATCH (xXagCreateAssocReq);
-#ifdef WIN32
- if (stuff->window_type != XagWindowTypeWin32)
-#else
- if (stuff->window_type != XagWindowTypeX11)
-#endif
- return BadMatch;
-#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
- if (!LocalClient (client))
- return BadAccess;
-#endif
-
-/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
-
- return client->noClientException;
-}
-
-static
-int ProcXagDestroyAssoc(
- register ClientPtr client)
-{
- /* REQUEST (xXagDestroyAssocReq); */
-
- REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
-/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
- return client->noClientException;
-}
-
-static
-int ProcXagDispatch (
- register ClientPtr client)
-{
- REQUEST (xReq);
- switch (stuff->data)
- {
- case X_XagQueryVersion:
- return ProcXagQueryVersion (client);
- case X_XagCreate:
- return ProcXagCreate (client);
- case X_XagDestroy:
- return ProcXagDestroy (client);
- case X_XagGetAttr:
- return ProcXagGetAttr (client);
- case X_XagQuery:
- return ProcXagQuery (client);
- case X_XagCreateAssoc:
- return ProcXagCreateAssoc (client);
- case X_XagDestroyAssoc:
- return ProcXagDestroyAssoc (client);
- default:
- return BadRequest;
- }
-}
-
-static
-int SProcXagQueryVersion(
- register ClientPtr client)
-{
- register int n;
- REQUEST(xXagQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcXagQueryVersion(client);
-}
-
-static
-int SProcXagCreate(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagCreateReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXagCreateReq);
- swapl (&stuff->app_group, n);
- swapl (&stuff->attrib_mask, n);
- SwapRestL (stuff);
- return ProcXagCreate (client);
-}
-
-static
-int SProcXagDestroy(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagDestroyReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagDestroyReq);
- swapl (&stuff->app_group, n);
- return ProcXagDestroy (client);
-}
-
-static
-int SProcXagGetAttr(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagGetAttrReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagGetAttrReq);
- swapl (&stuff->app_group, n);
- return ProcXagGetAttr (client);
-}
-
-static
-int SProcXagQuery(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagQueryReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagQueryReq);
- swapl (&stuff->resource, n);
- return ProcXagQuery (client);
-}
-
-static
-int SProcXagCreateAssoc(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagCreateAssocReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagCreateAssocReq);
- swapl (&stuff->window, n);
- swapl (&stuff->window_type, n);
- swaps (&stuff->system_window_len, n);
- return ProcXagCreateAssoc (client);
-}
-
-static
-int SProcXagDestroyAssoc(
- ClientPtr client)
-{
- register int n;
- REQUEST (xXagDestroyAssocReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
- swapl (&stuff->window, n);
- return ProcXagDestroyAssoc (client);
-}
-
-static
-int SProcXagDispatch(
- register ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XagQueryVersion:
- return SProcXagQueryVersion (client);
- case X_XagCreate:
- return SProcXagCreate (client);
- case X_XagDestroy:
- return SProcXagDestroy (client);
- case X_XagGetAttr:
- return SProcXagGetAttr (client);
- case X_XagQuery:
- return SProcXagQuery (client);
- case X_XagCreateAssoc:
- return SProcXagCreateAssoc (client);
- case X_XagDestroyAssoc:
- return SProcXagDestroyAssoc (client);
- default:
- return BadRequest;
- }
-}
-
-Colormap XagDefaultColormap(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->default_colormap : None);
-}
-
-VisualID XagRootVisual(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->root_visual : 0);
-}
-
-ClientPtr XagLeader(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->leader : NULL);
-}
-
-/*
- * Return whether the Map request event should be sent to the appgroup leader.
- * We don't want to send it to the leader when the window is on a different
- * screen, e.g. a print screen.
- */
-Bool XagIsControlledRoot(
- ClientPtr client,
- WindowPtr pParent)
-{
- if (client->appgroup) {
- if (client->appgroup->single_screen &&
- pParent->drawable.id == client->appgroup->default_root)
- return TRUE;
- else if (!pParent->parent)
- return TRUE;
- else
- return FALSE;
- }
- return FALSE;
-}
-
-void XagConnectionInfo(
- ClientPtr client,
- xConnSetupPrefix** conn_prefix,
- char** conn_info,
- int* num_screen)
-{
- if (client->appgroup && client->appgroup->ConnectionInfo) {
- *conn_prefix = &client->appgroup->connSetupPrefix;
- *conn_info = client->appgroup->ConnectionInfo;
- *num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
- }
-}
-
-XID XagId(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->appgroupId : 0);
-}
-
-void XagGetDeltaInfo(
- ClientPtr client,
- CARD32* buf)
-{
- *buf++ = (CARD32) client->appgroup->default_root;
- *buf++ = (CARD32) client->appgroup->root_visual;
- *buf++ = (CARD32) client->appgroup->default_colormap;
- *buf++ = (CARD32) client->appgroup->black_pixel;
- *buf = (CARD32) client->appgroup->white_pixel;
-}
-
-void XagCallClientStateChange(
- ClientPtr client)
-{
- if (appGrpList) {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = client;
- XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/appgroup.h b/nx-X11/programs/Xserver/Xext/appgroup.h
deleted file mode 100644
index 05c9ef124..000000000
--- a/nx-X11/programs/Xserver/Xext/appgroup.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $XFree86$ */
-
-void XagClientStateChange(
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata);
-int ProcXagCreate (
- register ClientPtr client);
-int ProcXagDestroy(
- register ClientPtr client);
diff --git a/nx-X11/programs/Xserver/Xext/bigreq.c b/nx-X11/programs/Xserver/Xext/bigreq.c
index 1af8a930b..be5919328 100644
--- a/nx-X11/programs/Xserver/Xext/bigreq.c
+++ b/nx-X11/programs/Xserver/Xext/bigreq.c
@@ -1,4 +1,3 @@
-/* $Xorg: bigreq.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
/*
Copyright 1992, 1998 The Open Group
@@ -26,22 +25,19 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.8 2003/10/28 23:08:43 tsi Exp $ */
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
-#include <X11/extensions/bigreqstr.h>
+#include <nx-X11/extensions/bigreqstr.h>
#include "opaque.h"
-#include "modinit.h"
#if 0
static unsigned char XBigReqCode;
@@ -54,7 +50,7 @@ static void BigReqResetProc(
static DISPATCH_PROC(ProcBigReqDispatch);
void
-BigReqExtensionInit(INITARGS)
+BigReqExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
@@ -85,23 +81,23 @@ ProcBigReqDispatch (client)
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
- register int n;
if (client->swapped) {
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
+ memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.max_request_size, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.max_request_size);
}
- WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
+ WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
return(client->noClientException);
}
diff --git a/nx-X11/programs/Xserver/Xext/cup.c b/nx-X11/programs/Xserver/Xext/cup.c
deleted file mode 100644
index 198aa801f..000000000
--- a/nx-X11/programs/Xserver/Xext/cup.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/* $Xorg: cup.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-/*
-
-Copyright 1997, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.11tsi Exp $ */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "swapreq.h"
-#define _XCUP_SERVER_
-#include <X11/extensions/Xcupstr.h>
-#include <X11/Xfuncproto.h>
-
-#ifndef EXTMODULE
-#include "../os/osdep.h"
-#else
-#include "xf86_ansic.h"
-#endif
-
-#include "modinit.h"
-
-static int ProcDispatch(ClientPtr client);
-static int SProcDispatch(ClientPtr client);
-static void ResetProc(ExtensionEntry* extEntry);
-
-#if 0
-static unsigned char ReqCode = 0;
-static int ErrorBase;
-#endif
-
-#if defined(WIN32) || defined(TESTWIN32)
-#define HAVE_SPECIAL_DESKTOP_COLORS
-#endif
-
-static xColorItem citems[] = {
-#ifndef HAVE_SPECIAL_DESKTOP_COLORS
-#define CUP_BLACK_PIXEL 0
-#define CUP_WHITE_PIXEL 1
- /* pix red green blue */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0xffff, 0xffff, 0xffff, 0, 0 }
-#else
-#ifndef WIN32
- /*
- This approximates the MS-Windows desktop colormap for testing
- purposes but has black and white pixels in the typical Unix
- locations, which should be switched if necessary if your system
- has blackPixel and whitePixel swapped. No entries are provided
- for colormap entries 254 and 255 because AllocColor/FindColor
- will reuse entries zero and one.
- */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0xffff, 0xffff, 0xffff, 0, 0 },
- { 2, 0x8000, 0, 0, 0, 0 },
- { 3, 0, 0x8000, 0, 0, 0 },
- { 4, 0x8000, 0x8000, 0, 0, 0 },
- { 5, 0, 0, 0x8000, 0, 0 },
- { 6, 0x8000, 0, 0x8000, 0, 0 },
- { 7, 0, 0x8000, 0x8000, 0, 0 },
- { 8, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 246, 0xa000, 0xa000, 0xa000, 0, 0 },
- { 247, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 248, 0xffff, 0, 0, 0, 0 },
- { 249, 0, 0xffff, 0, 0, 0 },
- { 250, 0xffff, 0xffff, 0, 0, 0 },
- { 251, 0, 0, 0xffff, 0, 0 },
- { 252, 0xffff, 0, 0xffff, 0, 0 },
- { 253, 0, 0xffff, 0xffff, 0, 0 }
-#else
- /*
- this is the MS-Windows desktop, adjusted for X's 16-bit color
- specifications.
- */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0x8000, 0, 0, 0, 0 },
- { 2, 0, 0x8000, 0, 0, 0 },
- { 3, 0x8000, 0x8000, 0, 0, 0 },
- { 4, 0, 0, 0x8000, 0, 0 },
- { 5, 0x8000, 0, 0x8000, 0, 0 },
- { 6, 0, 0x8000, 0x8000, 0, 0 },
- { 7, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 9, 0xa600, 0xca00, 0xf000, 0, 0 },
- { 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
- { 247, 0xa000, 0xa000, 0xa400, 0, 0 },
- { 248, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 249, 0xff00, 0, 0, 0, 0 },
- { 250, 0, 0xff00, 0, 0, 0 },
- { 251, 0xff00, 0xff00, 0, 0, 0 },
- { 252, 0, 0, 0xff00, 0, 0 },
- { 253, 0xff00, 0, 0xff00, 0, 0 },
- { 254, 0, 0xff00, 0xff00, 0, 0 },
- { 255, 0xff00, 0xff00, 0xff00, 0, 0 }
-#endif
-#endif
-};
-#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
-
-void
-XcupExtensionInit (INITARGS)
-{
-#if 0
- ExtensionEntry* extEntry;
-
- if ((extEntry = AddExtension (XCUPNAME,
- 0,
- XcupNumberErrors,
- ProcDispatch,
- SProcDispatch,
- ResetProc,
- StandardMinorOpcode))) {
- ReqCode = (unsigned char)extEntry->base;
- ErrorBase = extEntry->errorBase;
- }
-#else
- (void) AddExtension (XCUPNAME,
- 0,
- XcupNumberErrors,
- ProcDispatch,
- SProcDispatch,
- ResetProc,
- StandardMinorOpcode);
-#endif
-
- /* PC servers initialize the desktop colors (citems) here! */
-}
-
-/*ARGSUSED*/
-static
-void ResetProc(
- ExtensionEntry* extEntry)
-{
-}
-
-static
-int ProcQueryVersion(
- register ClientPtr client)
-{
- /* REQUEST (xXcupQueryVersionReq); */
- xXcupQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.server_major_version = XCUP_MAJOR_VERSION;
- rep.server_minor_version = XCUP_MINOR_VERSION;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swaps (&rep.server_major_version, n);
- swaps (&rep.server_minor_version, n);
- }
- WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcGetReservedColormapEntries(
- register ClientPtr client)
-{
- REQUEST (xXcupGetReservedColormapEntriesReq);
- xXcupGetReservedColormapEntriesReply rep;
- xColorItem* cptr;
- register int n;
-
- REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
-
- if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
-#ifndef HAVE_SPECIAL_DESKTOP_COLORS
- citems[CUP_BLACK_PIXEL].pixel =
- screenInfo.screens[stuff->screen]->blackPixel;
- citems[CUP_WHITE_PIXEL].pixel =
- screenInfo.screens[stuff->screen]->whitePixel;
-#endif
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- rep.length = NUM_DESKTOP_COLORS * 3;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- }
- WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
- for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
- if (client->swapped) SwapColorItem (cptr);
- WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
- }
- return client->noClientException;
-}
-
-static
-int ProcStoreColors(
- register ClientPtr client)
-{
- REQUEST (xXcupStoreColorsReq);
- ColormapPtr pcmp;
-
- REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
- pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
- RT_COLORMAP, SecurityWriteAccess);
-
- if (pcmp) {
- int ncolors, n;
- xXcupStoreColorsReply rep;
- xColorItem* cptr;
-
- if (!(pcmp->class & DynamicClass))
- return BadMatch;
-
- ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
- if (ncolors % SIZEOF(xColorItem))
- return BadLength;
-
- ncolors /= SIZEOF (xColorItem);
-
-
- for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
- Pixel pixel = cptr->pixel;
-
- if (AllocColor (pcmp,
- &cptr->red, &cptr->green, &cptr->blue,
- &pixel, client->index) == Success) {
- cptr->pixel = pixel;
- cptr->flags = 0x08;
- } else
- cptr->flags = 0;
- cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
- }
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- rep.length = ncolors * 3;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- }
- WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
- for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
- if (client->swapped) SwapColorItem (cptr);
- WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
- cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
- }
- return client->noClientException;
- } else {
- client->errorValue = stuff->cmap;
- return BadColor;
- }
-}
-
-static
-int ProcDispatch(
- register ClientPtr client)
-{
- REQUEST (xReq);
- switch (stuff->data)
- {
- case X_XcupQueryVersion:
- return ProcQueryVersion (client);
- case X_XcupGetReservedColormapEntries:
- return ProcGetReservedColormapEntries (client);
- case X_XcupStoreColors:
- return ProcStoreColors (client);
- default:
- return BadRequest;
- }
-}
-
-static
-int SProcQueryVersion(
- register ClientPtr client)
-{
- register int n;
-
- REQUEST(xXcupQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcQueryVersion(client);
-}
-
-static
-int SProcGetReservedColormapEntries(
- ClientPtr client)
-{
- register int n;
-
- REQUEST (xXcupGetReservedColormapEntriesReq);
- swaps (&stuff->length, n);
- swapl (&stuff->screen, n);
- REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
- return ProcGetReservedColormapEntries (client);
-}
-
-static
-int SProcXcupStoreColors(
- ClientPtr client)
-{
- register int n;
- int count;
- xColorItem* pItem;
-
- REQUEST (xXcupStoreColorsReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
- swapl(&stuff->cmap, n);
- pItem = (xColorItem*) &stuff[1];
- for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
- SwapColorItem(pItem++);
- return ProcStoreColors (client);
-}
-
-static
-int SProcDispatch(
- register ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XcupQueryVersion:
- return SProcQueryVersion (client);
- case X_XcupGetReservedColormapEntries:
- return SProcGetReservedColormapEntries (client);
- case X_XcupStoreColors:
- return SProcXcupStoreColors (client);
- default:
- return BadRequest;
- }
-}
-
-
diff --git a/nx-X11/programs/Xserver/Xext/dgaproc.h b/nx-X11/programs/Xserver/Xext/dgaproc.h
deleted file mode 100644
index eb9791098..000000000
--- a/nx-X11/programs/Xserver/Xext/dgaproc.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.21 2000/06/30 19:06:54 keithp Exp $ */
-
-#ifndef __DGAPROC_H
-#define __DGAPROC_H
-
-#include <X11/Xproto.h>
-#include "pixmap.h"
-
-#define DGA_CONCURRENT_ACCESS 0x00000001
-#define DGA_FILL_RECT 0x00000002
-#define DGA_BLIT_RECT 0x00000004
-#define DGA_BLIT_RECT_TRANS 0x00000008
-#define DGA_PIXMAP_AVAILABLE 0x00000010
-
-#define DGA_INTERLACED 0x00010000
-#define DGA_DOUBLESCAN 0x00020000
-
-#define DGA_FLIP_IMMEDIATE 0x00000001
-#define DGA_FLIP_RETRACE 0x00000002
-
-#define DGA_COMPLETED 0x00000000
-#define DGA_PENDING 0x00000001
-
-#define DGA_NEED_ROOT 0x00000001
-
-typedef struct {
- int num; /* A unique identifier for the mode (num > 0) */
- char *name; /* name of mode given in the XF86Config */
- int VSync_num;
- int VSync_den;
- int flags; /* DGA_CONCURRENT_ACCESS, etc... */
- int imageWidth; /* linear accessible portion (pixels) */
- int imageHeight;
- int pixmapWidth; /* Xlib accessible portion (pixels) */
- int pixmapHeight; /* both fields ignored if no concurrent access */
- int bytesPerScanline;
- int byteOrder; /* MSBFirst, LSBFirst */
- int depth;
- int bitsPerPixel;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep; /* viewport position granularity */
- int yViewportStep;
- int maxViewportX; /* max viewport origin */
- int maxViewportY;
- int viewportFlags; /* types of page flipping possible */
- int offset;
- int reserved1;
- int reserved2;
-} XDGAModeRec, *XDGAModePtr;
-
-/* DDX interface */
-
-int
-DGASetMode(
- int Index,
- int num,
- XDGAModePtr mode,
- PixmapPtr *pPix
-);
-
-void
-DGASetInputMode(
- int Index,
- Bool keyboard,
- Bool mouse
-);
-
-void
-DGASelectInput(
- int Index,
- ClientPtr client,
- long mask
-);
-
-Bool DGAAvailable(int Index);
-Bool DGAActive(int Index);
-void DGAShutdown(void);
-void DGAInstallCmap(ColormapPtr cmap);
-int DGAGetViewportStatus(int Index);
-int DGASync(int Index);
-
-int
-DGAFillRect(
- int Index,
- int x, int y, int w, int h,
- unsigned long color
-);
-
-int
-DGABlitRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
-);
-
-int
-DGABlitTransRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-);
-
-int
-DGASetViewport(
- int Index,
- int x, int y,
- int mode
-);
-
-int DGAGetModes(int Index);
-int DGAGetOldDGAMode(int Index);
-
-int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
-
-Bool DGAVTSwitch(void);
-Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy);
-Bool DGAStealKeyEvent(int Index, xEvent *e);
-Bool DGAIsDgaEvent (xEvent *e);
-
-Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e);
-
-Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
- int *size, int *offset, int *flags);
-void DGACloseFramebuffer(int Index);
-Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
-int DGACreateColormap(int Index, ClientPtr client, int id, int mode,
- int alloc);
-
-extern unsigned char DGAReqCode;
-extern int DGAErrorBase;
-extern int DGAEventBase;
-extern int *XDGAEventBase;
-
-
-
-#endif /* __DGAPROC_H */
diff --git a/nx-X11/programs/Xserver/Xext/dmx.c b/nx-X11/programs/Xserver/Xext/dmx.c
deleted file mode 100644
index 75623e696..000000000
--- a/nx-X11/programs/Xserver/Xext/dmx.c
+++ /dev/null
@@ -1,1133 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file implements the server-side part of the DMX protocol. A
- * vector of fucntions is provided at extension initialization time, so
- * most all of the useful functions in this file are declared static and
- * do not appear in the doxygen documentation.
- *
- * Much of the low-level work is done by functions in #dmxextension.c
- *
- * Please see the Client-to-Server DMX Extension to the X Protocol
- * document for details about the protocol. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#define EXTENSION_PROC_ARGS void *
-#include "extnsionst.h"
-#include "opaque.h"
-
-#include "dmxextension.h"
-#include <X11/extensions/dmxproto.h>
-
-#define _DMX_SERVER_
-#include <X11/extensions/dmxext.h>
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-extern unsigned long XRT_WINDOW;
-extern int PanoramiXNumScreens;
-#endif
-
-extern void DMXExtensionInit(void);
-
-static unsigned char DMXCode;
-
-static DISPATCH_PROC(ProcDMXDispatch);
-static DISPATCH_PROC(ProcDMXQueryVersion);
-static DISPATCH_PROC(ProcDMXSync);
-static DISPATCH_PROC(ProcDMXForceWindowCreation);
-static DISPATCH_PROC(ProcDMXGetScreenCount);
-static DISPATCH_PROC(ProcDMXGetScreenAttributes);
-static DISPATCH_PROC(ProcDMXChangeScreensAttributes);
-static DISPATCH_PROC(ProcDMXAddScreen);
-static DISPATCH_PROC(ProcDMXRemoveScreen);
-static DISPATCH_PROC(ProcDMXGetWindowAttributes);
-static DISPATCH_PROC(ProcDMXGetDesktopAttributes);
-static DISPATCH_PROC(ProcDMXChangeDesktopAttributes);
-static DISPATCH_PROC(ProcDMXGetInputCount);
-static DISPATCH_PROC(ProcDMXGetInputAttributes);
-static DISPATCH_PROC(ProcDMXAddInput);
-static DISPATCH_PROC(ProcDMXRemoveInput);
-
-static DISPATCH_PROC(SProcDMXDispatch);
-static DISPATCH_PROC(SProcDMXQueryVersion);
-static DISPATCH_PROC(SProcDMXSync);
-static DISPATCH_PROC(SProcDMXForceWindowCreation);
-static DISPATCH_PROC(SProcDMXGetScreenCount);
-static DISPATCH_PROC(SProcDMXGetScreenAttributes);
-static DISPATCH_PROC(SProcDMXChangeScreensAttributes);
-static DISPATCH_PROC(SProcDMXAddScreen);
-static DISPATCH_PROC(SProcDMXRemoveScreen);
-static DISPATCH_PROC(SProcDMXGetWindowAttributes);
-static DISPATCH_PROC(SProcDMXGetDesktopAttributes);
-static DISPATCH_PROC(SProcDMXChangeDesktopAttributes);
-static DISPATCH_PROC(SProcDMXGetInputCount);
-static DISPATCH_PROC(SProcDMXGetInputAttributes);
-static DISPATCH_PROC(SProcDMXAddInput);
-static DISPATCH_PROC(SProcDMXRemoveInput);
-
-static int _DMXXineramaActive(void)
-{
-#ifdef PANORAMIX
- return !noPanoramiXExtension;
-#endif
- return 0;
-}
-
-static void DMXResetProc(ExtensionEntry *extEntry)
-{
-}
-
-/** Initialize the extension. */
-void DMXExtensionInit(void)
-{
- ExtensionEntry *extEntry;
-
- if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
- ProcDMXDispatch, SProcDMXDispatch,
- DMXResetProc, StandardMinorOpcode)))
- DMXCode = extEntry->base;
-}
-
-static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXScreenWindowWidth: attr->screenWindowWidth = value; break;
- case DMXScreenWindowHeight: attr->screenWindowHeight = value; break;
- case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
- case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
- case DMXRootWindowWidth: attr->rootWindowWidth = value; break;
- case DMXRootWindowHeight: attr->rootWindowHeight = value; break;
- case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break;
- case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break;
- case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break;
- case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break;
- }
-}
-
-static int dmxFetchScreenAttributes(unsigned int mask,
- DMXScreenAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetScreenAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXDesktopWidth: attr->width = value; break;
- case DMXDesktopHeight: attr->height = value; break;
- case DMXDesktopShiftX: attr->shiftX = value; break;
- case DMXDesktopShiftY: attr->shiftY = value; break;
- }
-}
-
-static int dmxFetchDesktopAttributes(unsigned int mask,
- DMXDesktopAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetDesktopAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXInputType: attr->inputType = value; break;
- case DMXInputPhysicalScreen: attr->physicalScreen = value; break;
- case DMXInputSendsCore: attr->sendsCore = !!value; break;
- }
-}
-
-static int dmxFetchInputAttributes(unsigned int mask,
- DMXInputAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetInputAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static int ProcDMXQueryVersion(ClientPtr client)
-{
- xDMXQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = DMX_EXTENSION_MAJOR;
- rep.minorVersion = DMX_EXTENSION_MINOR;
- rep.patchVersion = DMX_EXTENSION_PATCH;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.majorVersion, n);
- swapl(&rep.minorVersion, n);
- swapl(&rep.patchVersion, n);
- }
- WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXSync(ClientPtr client)
-{
- xDMXSyncReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXSyncReq);
-
- dmxFlushPendingSyncs();
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXForceWindowCreation(ClientPtr client)
-{
- xDMXForceWindowCreationReply rep;
- REQUEST(xDMXForceWindowCreationReq);
- WindowPtr pWin;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXRes *win;
- int i;
-
- if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- FOR_NSCREENS(i) {
- if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxForceWindowCreation(pWin);
- }
- goto doreply;
- }
-#endif
-
- if (!(pWin = SecurityLookupWindow(stuff->window, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxForceWindowCreation(pWin);
- doreply:
- dmxFlushPendingSyncs();
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
- return Success;
-}
-
-static int ProcDMXGetScreenCount(ClientPtr client)
-{
- xDMXGetScreenCountReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.screenCount = dmxGetNumScreens();
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.screenCount, n);
- }
- WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetScreenAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetScreenAttributesReq);
- xDMXGetScreenAttributesReply rep;
- int n;
- int length;
- int paddedLength;
- DMXScreenAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
-
- if (stuff->physicalScreen < 0
- || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;
-
- if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
- return BadValue;
-
- rep.logicalScreen = attr.logicalScreen;
- rep.screenWindowWidth = attr.screenWindowWidth;
- rep.screenWindowHeight = attr.screenWindowHeight;
- rep.screenWindowXoffset = attr.screenWindowXoffset;
- rep.screenWindowYoffset = attr.screenWindowYoffset;
- rep.rootWindowWidth = attr.rootWindowWidth;
- rep.rootWindowHeight = attr.rootWindowHeight;
- rep.rootWindowXoffset = attr.rootWindowXoffset;
- rep.rootWindowYoffset = attr.rootWindowYoffset;
- rep.rootWindowXorigin = attr.rootWindowXorigin;
- rep.rootWindowYorigin = attr.rootWindowYorigin;
-
- length = attr.displayName ? strlen(attr.displayName) : 0;
- paddedLength = (length + 3) & ~3;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = paddedLength >> 2;
- rep.displayNameLength = length;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.displayNameLength, n);
- swapl(&rep.logicalScreen, n);
- swaps(&rep.screenWindowWidth, n);
- swaps(&rep.screenWindowHeight, n);
- swaps(&rep.screenWindowXoffset, n);
- swaps(&rep.screenWindowYoffset, n);
- swaps(&rep.rootWindowWidth, n);
- swaps(&rep.rootWindowHeight, n);
- swaps(&rep.rootWindowXoffset, n);
- swaps(&rep.rootWindowYoffset, n);
- swaps(&rep.rootWindowXorigin, n);
- swaps(&rep.rootWindowYorigin, n);
- }
- WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.displayName);
- return client->noClientException;
-}
-
-static int ProcDMXChangeScreensAttributes(ClientPtr client)
-{
- REQUEST(xDMXChangeScreensAttributesReq);
- xDMXChangeScreensAttributesReply rep;
- int n;
- int status = DMX_BAD_XINERAMA;
- unsigned int mask = 0;
- unsigned int i;
- CARD32 *screen_list;
- CARD32 *mask_list;
- CARD32 *value_list;
- DMXScreenAttributesPtr attribs;
- int errorScreen = 0;
- unsigned int len;
- int ones = 0;
-
-
- REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
- len = client->req_len - (sizeof(xDMXChangeScreensAttributesReq) >> 2);
- if (len < stuff->screenCount + stuff->maskCount)
- return BadLength;
-
- screen_list = (CARD32 *)(stuff + 1);
- mask_list = &screen_list[stuff->screenCount];
- value_list = &mask_list[stuff->maskCount];
-
- for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
- if (len != stuff->screenCount + stuff->maskCount + ones)
- return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
-
- if (!(attribs = ALLOCATE_LOCAL(stuff->screenCount * sizeof(*attribs))))
- return BadAlloc;
-
- for (i = 0; i < stuff->screenCount; i++) {
- int count;
-
- if (i < stuff->maskCount) mask = mask_list[i];
- dmxGetScreenAttributes(screen_list[i], &attribs[i]);
- count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
- value_list += count;
- }
-
-#if PANORAMIX
- status = dmxConfigureScreenWindows(stuff->screenCount,
- screen_list,
- attribs,
- &errorScreen);
-#endif
-
- DEALLOCATE_LOCAL(attribs);
-
- if (status == BadValue) return status;
-
- noxinerama:
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.errorScreen = errorScreen;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.errorScreen, n);
- }
- WriteToClient(client,
- sizeof(xDMXChangeScreensAttributesReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXAddScreen(ClientPtr client)
-{
- REQUEST(xDMXAddScreenReq);
- xDMXAddScreenReply rep;
- int n;
- int status = 0;
- CARD32 *value_list;
- DMXScreenAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
-
- REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- len = client->req_len - (sizeof(xDMXAddScreenReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
- return BadLength;
-
- memset(&attr, 0, sizeof(attr));
- dmxGetScreenAttributes(stuff->physicalScreen, &attr);
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
-
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
- return BadAlloc;
- memcpy(name, &value_list[count], stuff->displayNameLength);
- name[stuff->displayNameLength] = '\0';
- attr.displayName = name;
-
- status = dmxAttachScreen(stuff->physicalScreen, &attr);
-
- DEALLOCATE_LOCAL(name);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalScreen = stuff->physicalScreen;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.physicalScreen, n);
- }
- WriteToClient(client,
- sizeof(xDMXAddScreenReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXRemoveScreen(ClientPtr client)
-{
- REQUEST(xDMXRemoveScreenReq);
- xDMXRemoveScreenReply rep;
- int n;
- int status = 0;
-
- REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
-
- status = dmxDetachScreen(stuff->physicalScreen);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client,
- sizeof(xDMXRemoveScreenReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-
-#ifdef PANORAMIX
-static int dmxPopulatePanoramiX(ClientPtr client, Window window,
- CARD32 *screens, CARD32 *windows,
- xRectangle *pos, xRectangle *vis)
-{
- WindowPtr pWin;
- PanoramiXRes *win;
- int i;
- int count = 0;
- DMXWindowAttributesRec attr;
-
- if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- FOR_NSCREENS(i) {
- if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
- if (dmxGetWindowAttributes(pWin, &attr)) {
- screens[count] = attr.screen;
- windows[count] = attr.window;
- pos[count] = attr.pos;
- vis[count] = attr.vis;
- ++count; /* Only count existing windows */
- }
- }
- return count;
-}
-#endif
-
-static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
- CARD32 *windows, xRectangle *pos, xRectangle *vis)
-{
- WindowPtr pWin;
- DMXWindowAttributesRec attr;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- return dmxPopulatePanoramiX(client, window, screens, windows,
- pos, vis);
-#endif
-
- if (!(pWin = SecurityLookupWindow(window, client, SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxGetWindowAttributes(pWin, &attr);
- *screens = attr.screen;
- *windows = attr.window;
- *pos = attr.pos;
- *vis = attr.vis;
- return 1;
-}
-
-static int dmxMaxNumScreens(void)
-{
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) return PanoramiXNumScreens;
-#endif
- return 1;
-}
-
-static int ProcDMXGetWindowAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetWindowAttributesReq);
- xDMXGetWindowAttributesReply rep;
- int i, n;
- CARD32 *screens;
- CARD32 *windows;
- xRectangle *pos, *vis;
- int count = dmxMaxNumScreens();
-
- REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
-
- if (!(screens = ALLOCATE_LOCAL(count * sizeof(*screens))))
- return BadAlloc;
- if (!(windows = ALLOCATE_LOCAL(count * sizeof(*windows)))) {
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
- if (!(pos = ALLOCATE_LOCAL(count * sizeof(*pos)))) {
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
- if (!(vis = ALLOCATE_LOCAL(count * sizeof(*vis)))) {
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
-
- if ((count = dmxPopulate(client, stuff->window, screens, windows,
- pos, vis)) < 0) {
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadWindow;
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = count * 6;
- rep.screenCount = count;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.screenCount, n);
- for (i = 0; i < count; i++) {
- swapl(&screens[i], n);
- swapl(&windows[i], n);
-
- swaps(&pos[i].x, n);
- swaps(&pos[i].y, n);
- swaps(&pos[i].width, n);
- swaps(&pos[i].height, n);
-
- swaps(&vis[i].x, n);
- swaps(&vis[i].y, n);
- swaps(&vis[i].width, n);
- swaps(&vis[i].height, n);
- }
- }
-
- dmxFlushPendingSyncs();
-
- WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
- if (count) {
- WriteToClient(client, count * sizeof(*screens), (char *)screens);
- WriteToClient(client, count * sizeof(*windows), (char *)windows);
- WriteToClient(client, count * sizeof(*pos), (char *)pos);
- WriteToClient(client, count * sizeof(*vis), (char *)vis);
- }
-
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
-
- return client->noClientException;
-}
-
-static int ProcDMXGetDesktopAttributes(ClientPtr client)
-{
- xDMXGetDesktopAttributesReply rep;
- int n;
- DMXDesktopAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
-
- dmxGetDesktopAttributes(&attr);
-
- rep.width = attr.width;
- rep.height = attr.height;
- rep.shiftX = attr.shiftX;
- rep.shiftY = attr.shiftY;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.width, n);
- swapl(&rep.height, n);
- swapl(&rep.shiftX, n);
- swapl(&rep.shiftY, n);
- }
- WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXChangeDesktopAttributes(ClientPtr client)
-{
- REQUEST(xDMXChangeDesktopAttributesReq);
- xDMXChangeDesktopAttributesReply rep;
- int n;
- int status = DMX_BAD_XINERAMA;
- CARD32 *value_list;
- DMXDesktopAttributesRec attr;
- int len;
-
- REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
- len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
- if (len != Ones(stuff->valueMask))
- return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
-
- value_list = (CARD32 *)(stuff + 1);
-
- dmxGetDesktopAttributes(&attr);
- dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
-
-#if PANORAMIX
- status = dmxConfigureDesktop(&attr);
-#endif
- if (status == BadValue) return status;
-
- noxinerama:
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client,
- sizeof(xDMXChangeDesktopAttributesReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetInputCount(ClientPtr client)
-{
- xDMXGetInputCountReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.inputCount = dmxGetInputCount();
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.inputCount, n);
- }
- WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetInputAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetInputAttributesReq);
- xDMXGetInputAttributesReply rep;
- int n;
- int length;
- int paddedLength;
- DMXInputAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
-
- if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
- rep.inputType = attr.inputType;
- rep.physicalScreen = attr.physicalScreen;
- rep.physicalId = attr.physicalId;
- rep.isCore = attr.isCore;
- rep.sendsCore = attr.sendsCore;
- rep.detached = attr.detached;
-
- length = attr.name ? strlen(attr.name) : 0;
- paddedLength = (length + 3) & ~3;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = paddedLength >> 2;
- rep.nameLength = length;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.inputType, n);
- swapl(&rep.physicalScreen, n);
- swapl(&rep.physicalId, n);
- swapl(&rep.nameLength, n);
- }
- WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.name);
- return client->noClientException;
-}
-
-static int ProcDMXAddInput(ClientPtr client)
-{
- REQUEST(xDMXAddInputReq);
- xDMXAddInputReply rep;
- int n;
- int status = 0;
- CARD32 *value_list;
- DMXInputAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
- int id = -1;
-
- REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
- return BadLength;
-
- memset(&attr, 0, sizeof(attr));
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
-
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
- return BadAlloc;
- memcpy(name, &value_list[count], stuff->displayNameLength);
- name[stuff->displayNameLength] = '\0';
- attr.name = name;
-
- status = dmxAddInput(&attr, &id);
-
- DEALLOCATE_LOCAL(name);
-
- if (status) return status;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalId = id;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.physicalId, n);
- }
- WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXRemoveInput(ClientPtr client)
-{
- REQUEST(xDMXRemoveInputReq);
- xDMXRemoveInputReply rep;
- int n;
- int status = 0;
-
- REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
-
- status = dmxRemoveInput(stuff->physicalId);
-
- if (status) return status;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_DMXQueryVersion: return ProcDMXQueryVersion(client);
- case X_DMXSync: return ProcDMXSync(client);
- case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client);
- case X_DMXChangeScreensAttributes:
- return ProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return ProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
- case X_DMXChangeDesktopAttributes:
- return ProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return ProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return ProcDMXAddInput(client);
- case X_DMXRemoveInput: return ProcDMXRemoveInput(client);
-
- case X_DMXGetScreenInformationDEPRECATED:
- case X_DMXForceWindowCreationDEPRECATED:
- case X_DMXReconfigureScreenDEPRECATED:
- return BadImplementation;
-
- default: return BadRequest;
- }
-}
-
-static int SProcDMXQueryVersion(ClientPtr client)
-{
- int n;
- REQUEST(xDMXQueryVersionReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
- return ProcDMXQueryVersion(client);
-}
-
-static int SProcDMXSync(ClientPtr client)
-{
- int n;
- REQUEST(xDMXSyncReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXSyncReq);
- return ProcDMXSync(client);
-}
-
-static int SProcDMXForceWindowCreation(ClientPtr client)
-{
- int n;
- REQUEST(xDMXForceWindowCreationReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
- swaps(&stuff->window, n);
- return ProcDMXForceWindowCreation(client);
-}
-
-static int SProcDMXGetScreenCount(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetScreenCountReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
- return ProcDMXGetScreenCount(client);
-}
-
-static int SProcDMXGetScreenAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetScreenAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
- swapl(&stuff->physicalScreen, n);
- return ProcDMXGetScreenAttributes(client);
-}
-
-static int SProcDMXChangeScreensAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXChangeScreensAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq);
- swapl(&stuff->screenCount, n);
- swapl(&stuff->maskCount, n);
- SwapRestL(stuff);
- return ProcDMXGetScreenAttributes(client);
-}
-
-static int SProcDMXAddScreen(ClientPtr client)
-{
- int n;
- int paddedLength;
- REQUEST(xDMXAddScreenReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
- swapl(&stuff->displayNameLength, n);
- swapl(&stuff->valueMask, n);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
- return ProcDMXAddScreen(client);
-}
-
-static int SProcDMXRemoveScreen(ClientPtr client)
-{
- int n;
- REQUEST(xDMXRemoveScreenReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
- swapl(&stuff->physicalScreen, n);
- return ProcDMXRemoveScreen(client);
-}
-
-static int SProcDMXGetWindowAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetWindowAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
- swapl(&stuff->window, n);
- return ProcDMXGetWindowAttributes(client);
-}
-
-static int SProcDMXGetDesktopAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetDesktopAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
- return ProcDMXGetDesktopAttributes(client);
-}
-
-static int SProcDMXChangeDesktopAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXChangeDesktopAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
- swapl(&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcDMXChangeDesktopAttributes(client);
-}
-
-static int SProcDMXGetInputCount(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetInputCountReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
- return ProcDMXGetInputCount(client);
-}
-
-static int SProcDMXGetInputAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetInputAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
- swapl(&stuff->deviceId, n);
- return ProcDMXGetInputAttributes(client);
-}
-
-static int SProcDMXAddInput(ClientPtr client)
-{
- int n;
- int paddedLength;
- REQUEST(xDMXAddInputReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
- swapl(&stuff->displayNameLength, n);
- swapl(&stuff->valueMask, n);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
- return ProcDMXAddInput(client);
-}
-
-static int SProcDMXRemoveInput(ClientPtr client)
-{
- int n;
- REQUEST(xDMXRemoveInputReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
- swapl(&stuff->physicalId, n);
- return ProcDMXRemoveInput(client);
-}
-
-static int SProcDMXDispatch (ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_DMXQueryVersion: return SProcDMXQueryVersion(client);
- case X_DMXSync: return SProcDMXSync(client);
- case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client);
- case X_DMXChangeScreensAttributes:
- return SProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return SProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes:
- return SProcDMXGetDesktopAttributes(client);
- case X_DMXChangeDesktopAttributes:
- return SProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return SProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return SProcDMXAddInput(client);
- case X_DMXRemoveInput: return SProcDMXRemoveInput(client);
-
- case X_DMXGetScreenInformationDEPRECATED:
- case X_DMXForceWindowCreationDEPRECATED:
- case X_DMXReconfigureScreenDEPRECATED:
- return BadImplementation;
-
- default: return BadRequest;
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/dpms.c b/nx-X11/programs/Xserver/Xext/dpms.c
index 3e79602d1..ea9781353 100644
--- a/nx-X11/programs/Xserver/Xext/dpms.c
+++ b/nx-X11/programs/Xserver/Xext/dpms.c
@@ -1,4 +1,3 @@
-/* $Xorg: dpms.c,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
@@ -33,24 +32,22 @@ Equipment Corporation.
* @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
*/
-/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.10tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
-#include <X11/extensions/dpmsstr.h>
+#include <nx-X11/extensions/dpms.h>
+#include <nx-X11/extensions/dpmsstr.h>
#include "dpmsproc.h"
-#include "modinit.h"
#if 0
static unsigned char DPMSCode;
@@ -76,7 +73,7 @@ static DISPATCH_PROC(SProcDPMSCapable);
static void DPMSResetProc(ExtensionEntry* extEntry);
void
-DPMSExtensionInit(INITARGS)
+DPMSExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
@@ -105,7 +102,6 @@ ProcDPMSGetVersion(client)
{
/* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
@@ -115,11 +111,11 @@ ProcDPMSGetVersion(client)
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
return(client->noClientException);
}
@@ -128,7 +124,6 @@ ProcDPMSCapable(register ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep;
- register int n;
REQUEST_SIZE_MATCH(xDPMSCapableReq);
@@ -138,9 +133,9 @@ ProcDPMSCapable(register ClientPtr client)
rep.capable = DPMSCapableFlag;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
+ swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
return(client->noClientException);
}
@@ -150,7 +145,6 @@ ProcDPMSGetTimeouts(client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep;
- register int n;
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
@@ -162,12 +156,12 @@ ProcDPMSGetTimeouts(client)
rep.off = DPMSOffTime / MILLI_PER_SECOND;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.standby, n);
- swaps(&rep.suspend, n);
- swaps(&rep.off, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.standby);
+ swaps(&rep.suspend);
+ swaps(&rep.off);
}
- WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
return(client->noClientException);
}
@@ -265,7 +259,6 @@ ProcDPMSInfo(register ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep;
- register int n;
REQUEST_SIZE_MATCH(xDPMSInfoReq);
@@ -276,10 +269,10 @@ ProcDPMSInfo(register ClientPtr client)
rep.state = DPMSEnabled;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.power_level, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.power_level);
}
- WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
return(client->noClientException);
}
@@ -316,13 +309,12 @@ static int
SProcDPMSGetVersion(client)
register ClientPtr client;
{
- register int n;
REQUEST(xDPMSGetVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion, n);
+ swaps(&stuff->majorVersion);
+ swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
@@ -330,9 +322,8 @@ static int
SProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
@@ -343,9 +334,8 @@ SProcDPMSGetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSGetTimeoutsReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
@@ -356,14 +346,13 @@ SProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
- swaps(&stuff->standby, n);
- swaps(&stuff->suspend, n);
- swaps(&stuff->off, n);
+ swaps(&stuff->standby);
+ swaps(&stuff->suspend);
+ swaps(&stuff->off);
return ProcDPMSSetTimeouts(client);
}
@@ -372,9 +361,8 @@ SProcDPMSEnable(client)
register ClientPtr client;
{
REQUEST(xDPMSEnableReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
@@ -385,9 +373,8 @@ SProcDPMSDisable(client)
register ClientPtr client;
{
REQUEST(xDPMSDisableReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
@@ -398,12 +385,11 @@ SProcDPMSForceLevel(client)
register ClientPtr client;
{
REQUEST(xDPMSForceLevelReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
- swaps(&stuff->level, n);
+ swaps(&stuff->level);
return ProcDPMSForceLevel(client);
}
@@ -413,9 +399,8 @@ SProcDPMSInfo(client)
register ClientPtr client;
{
REQUEST(xDPMSInfoReq);
- register int n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
diff --git a/nx-X11/programs/Xserver/Xext/dpmsproc.h b/nx-X11/programs/Xserver/Xext/dpmsproc.h
index ae1e6e25a..f5485ea79 100644
--- a/nx-X11/programs/Xserver/Xext/dpmsproc.h
+++ b/nx-X11/programs/Xserver/Xext/dpmsproc.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/dpmsproc.h,v 1.3 2001/10/28 03:32:50 tsi Exp $ */
/* Prototypes for functions that the DDX must provide */
diff --git a/nx-X11/programs/Xserver/Xext/dpmsstubs.c b/nx-X11/programs/Xserver/Xext/dpmsstubs.c
index 128c57bb0..9f99a2d22 100644
--- a/nx-X11/programs/Xserver/Xext/dpmsstubs.c
+++ b/nx-X11/programs/Xserver/Xext/dpmsstubs.c
@@ -1,4 +1,3 @@
-/* $Xorg: dpmsstubs.c,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
@@ -26,7 +25,6 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/dpmsstubs.c,v 3.4 2001/01/17 22:13:15 dawes Exp $ */
typedef int Bool;
diff --git a/nx-X11/programs/Xserver/Xext/extmod/Imakefile b/nx-X11/programs/Xserver/Xext/extmod/Imakefile
deleted file mode 100644
index 450a318b4..000000000
--- a/nx-X11/programs/Xserver/Xext/extmod/Imakefile
+++ /dev/null
@@ -1,127 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.21 2001/03/05 04:51:56 mvojkovi Exp $
-XCOMM This directory is only entered if DoLoadableServer is set
-
-#define IHaveModules
-#include <Server.tmpl>
-
-#if BuildMultibuffer
- MULTIBUFSRC = mbuf.c
- MULTIBUFOBJ = mbuf.o
-LinkSourceFile(mbuf.c,..)
-#endif
-
-#if BuildScreenSaverExt
- SCRNSAVSRC = saver.c
- SCRNSAVOBJ = saver.o
-LinkSourceFile(saver.c,..)
-#endif
-
-#if BuildXF86VidModeExt
- VIDMODESRCS = xf86vmode.c
- VIDMODEOBJS = xf86vmode.o
-LinkSourceFile(xf86vmode.c,..)
-#endif
-
-#if BuildXF86MiscExt
- XF86MISCSRCS = xf86misc.c
- XF86MISCOBJS = xf86misc.o
-LinkSourceFile(xf86misc.c,..)
-#endif
-
-#if BuildXF86DGA
- XF86DGASRCS = xf86dga.c xf86dga2.c
- XF86DGAOBJS = xf86dga.o xf86dga2.o
-LinkSourceFile(xf86dga.c,..)
-LinkSourceFile(xf86dga2.c,..)
-#endif
-
-#if BuildDPMS
- DPMSSRCS = dpms.c
- DPMSOBJS = dpms.o
-LinkSourceFile(dpms.c,..)
-#endif
-
-#if BuildFontCache
- FONTCACHESRCS = fontcache.c
- FONTCACHEOBJS = fontcache.o
-#if 0
- FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
-#endif
-LinkSourceFile(fontcache.c,..)
-#endif
-
-#if BuildXvExt
- XVSRCS = xvmain.c xvdisp.c xvmod.c xvmc.c
- XVOBJS = xvmain.o xvdisp.o xvmod.o xvmc.o
-LinkSourceFile(xvmain.c,..)
-LinkSourceFile(xvdisp.c,..)
-LinkSourceFile(xvmod.c,..)
-LinkSourceFile(xvmc.c,..)
-#endif
-
-#if BuildXResExt
- XRESSRCS = xres.c
- XRESOBJS = xres.o
-LinkSourceFile(xres.c,..)
-#endif
-
-#if BuildEVI
- EVISRCS = EVI.c sampleEVI.c
- EVIOBJS = EVI.o sampleEVI.o
-LinkSourceFile(EVI.c,..)
-LinkSourceFile(sampleEVI.c,..)
-#endif
-
-#if BuildCup
- CUPSRCS = cup.c
- CUPOBJS = cup.o
-LinkSourceFile(cup.c,..)
-#endif
-
- MODINITSRCS = modinit.c
- MODINITOBJS = modinit.o
-
- SRCS = shape.c $(MULTIBUFSRC) \
- mitmisc.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86DGASRCS) \
- $(CUPSRCS) $(DPMSSRCS) $(FONTCACHESRCS) \
- $(EVISRCS) $(XVSRCS) $(MODINITSRCS) $(XRESSRCS)
-
- MOBJS = $(MODINITOBJS) shape.o $(MULTIBUFOBJ) mitmisc.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o \
- $(VIDMODEOBJS) $(XF86MISCOBJS) $(XF86DGAOBJS) \
- $(CUPOBJS) $(DPMSOBJS) $(FONTCACHEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(XRESOBJS)
-
- DEFINES = -DEXTMODULE $(EXT_DEFINES)
-
-XF86INCLUDES = -I$(XF86COMSRC)
- INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(XF86INCLUDES) $(FONTCACHEINCLUDES) -I$(FONTINCSRC)
- LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln
-
-LinkSourceFile(shape.c,..)
-LinkSourceFile(mitmisc.c,..)
-LinkSourceFile(bigreq.c,..)
-LinkSourceFile(sync.c,..)
-LinkSourceFile(xcmisc.c,..)
-
-ModuleObjectRule()
-
-/*
- * A hack to work around an optimization problem with gcc 2.95.2
- */
-#if BuildXF86VidModeExt && defined(GccOptBug295)
-SpecialCObjectRule(xf86vmode,NullParameter,-O0)
-#endif
-
-SpecialCObjectRule(modinit,$(ICONFIGFILES),$(EXT_DEFINES))
-LibraryModuleTarget(extmod,$(MOBJS))
-NormalLintTarget($(SRCS))
-
-InstallLibraryModule(extmod,$(MODULEDIR),extensions)
-
-DependTarget()
-
-InstallDriverSDKLibraryModule(extmod,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.c b/nx-X11/programs/Xserver/Xext/extmod/modinit.c
deleted file mode 100644
index 3c2044f78..000000000
--- a/nx-X11/programs/Xserver/Xext/extmod/modinit.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.c,v 1.16 2002/03/06 21:12:33 mvojkovi Exp $ */
-
-/*
- *
- * Copyright (c) 1997 Matthieu Herrb
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Matthieu Herrb not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Matthieu Herrb makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifdef XFree86LOADER
-#include "xf86_ansic.h"
-
-#include "xf86Module.h"
-#include "xf86Opt.h"
-
-#include <X11/Xproto.h>
-
-#include "modinit.h"
-#include "globals.h"
-
-static MODULESETUPPROTO(extmodSetup);
-
-/*
- * Array describing extensions to be initialized
- */
-ExtensionModule extensionModules[] = {
-#ifdef SHAPE
- {
- ShapeExtensionInit,
- SHAPENAME,
- &noShapeExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef MULTIBUFFER
- {
- MultibufferExtensionInit,
- MULTIBUFFER_PROTOCOL_NAME,
- &noMultibufferExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef MITMISC
- {
- MITMiscExtensionInit,
- MITMISCNAME,
- &noMITMiscExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef notyet
- {
- XTestExtensionInit,
- XTestExtensionName,
- &noTestExtensions,
- NULL,
- NULL
- },
-#endif
-#ifdef BIGREQS
- {
- BigReqExtensionInit,
- XBigReqExtensionName,
- &noBigReqExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XSYNC
- {
- SyncExtensionInit,
- SYNC_NAME,
- &noSyncExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef SCREENSAVER
- {
- ScreenSaverExtensionInit,
- ScreenSaverName,
- &noScreenSaverExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XCMISC
- {
- XCMiscExtensionInit,
- XCMiscExtensionName,
- &noXCMiscExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XF86VIDMODE
- {
- XFree86VidModeExtensionInit,
- XF86VIDMODENAME,
- &noXFree86VidModeExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XF86MISC
- {
- XFree86MiscExtensionInit,
- XF86MISCNAME,
- &noXFree86MiscExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XFreeXDGA
- {
- XFree86DGAExtensionInit,
- XF86DGANAME,
- &noXFree86DGAExtension,
- XFree86DGARegister,
- NULL
- },
-#endif
-#ifdef DPMSExtension
- {
- DPMSExtensionInit,
- DPMSExtensionName,
- &noDPMSExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef FONTCACHE
- {
- FontCacheExtensionInit,
- FONTCACHENAME,
- &noFontCacheExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef TOGCUP
- {
- XcupExtensionInit,
- XCUPNAME,
- &noXcupExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef EVI
- {
- EVIExtensionInit,
- EVINAME,
- &noEVIExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XV
- {
- XvExtensionInit,
- XvName,
- &noXvExtension,
- XvRegister,
- NULL
- },
- {
- XvMCExtensionInit,
- XvMCName,
- &noXvExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef RES
- {
- ResExtensionInit,
- XRES_NAME,
- &noResExtension,
- NULL,
- NULL
- },
-#endif
- { /* DON'T delete this entry ! */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- }
-};
-
-static XF86ModuleVersionInfo VersRec =
-{
- "extmod",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_EXTENSION,
- {0,0,0,0}
-};
-
-/*
- * Data for the loader
- */
-XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
-
-static pointer
-extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- int i;
-
- /* XXX the option stuff here is largely a sample/test case */
-
- for (i = 0; extensionModules[i].name != NULL; i++) {
- if (opts) {
- char *s;
- s = (char *)xalloc(strlen(extensionModules[i].name) + 5);
- if (s) {
- pointer o;
- strcpy(s, "omit");
- strcat(s, extensionModules[i].name);
- o = xf86FindOption(opts, s);
- xfree(s);
- if (o) {
- xf86MarkOptionUsed(o);
- continue;
- }
- }
- }
- LoadExtension(&extensionModules[i], FALSE);
- }
- /* Need a non-NULL return */
- return (pointer)1;
-}
-
-#endif /* XFree86LOADER */
diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.h b/nx-X11/programs/Xserver/Xext/extmod/modinit.h
deleted file mode 100644
index 2bafdb2b0..000000000
--- a/nx-X11/programs/Xserver/Xext/extmod/modinit.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/extmod/modinit.h,v 1.5 2005/07/03 07:01:06 daniels Exp $ */
-/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.h,v 1.1 2003/07/16 01:38:33 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef INITARGS
-#define INITARGS void
-#endif
-
-#ifdef SHAPE
-extern void ShapeExtensionInit(INITARGS);
-#define _SHAPE_SERVER_ /* don't want Xlib structures */
-#include <X11/extensions/shapestr.h>
-#endif
-
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#include <X11/extensions/multibufst.h>
-#endif
-
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#define _MITMISC_SERVER_
-#include <X11/extensions/mitmiscstr.h>
-#endif
-
-#ifdef XTEST
-extern void XTestExtensionInit(INITARGS);
-#define _XTEST_SERVER_
-#include <X11/extensions/XTest.h>
-#include <X11/extensions/xteststr.h>
-#endif
-
-#if 1
-extern void XTestExtension1Init(INITARGS);
-#endif
-
-#ifdef BIGREQS
-extern void BigReqExtensionInit(INITARGS);
-#include <X11/extensions/bigreqstr.h>
-#endif
-
-#ifdef XSYNC
-extern void SyncExtensionInit(INITARGS);
-#define _SYNC_SERVER
-#include <X11/extensions/sync.h>
-#include <X11/extensions/syncstr.h>
-#endif
-
-#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit (INITARGS);
-#include <X11/extensions/saver.h>
-#endif
-
-#ifdef XCMISC
-extern void XCMiscExtensionInit(INITARGS);
-#include <X11/extensions/xcmiscstr.h>
-#endif
-
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit(INITARGS);
-#define _XF86VIDMODE_SERVER_
-#include <X11/extensions/xf86vmstr.h>
-#endif
-
-#ifdef XF86MISC
-extern void XFree86MiscExtensionInit(INITARGS);
-#define _XF86MISC_SERVER_
-#define _XF86MISC_SAVER_COMPAT_
-#include <X11/extensions/xf86mscstr.h>
-#endif
-
-#ifdef XFreeXDGA
-extern void XFree86DGAExtensionInit(INITARGS);
-extern void XFree86DGARegister(INITARGS);
-#define _XF86DGA_SERVER_
-#include <X11/extensions/xf86dgastr.h>
-#endif
-
-#ifdef DPMSExtension
-extern void DPMSExtensionInit(INITARGS);
-#include <X11/extensions/dpmsstr.h>
-#endif
-
-#ifdef FONTCACHE
-extern void FontCacheExtensionInit(INITARGS);
-#define _FONTCACHE_SERVER_
-#include "fontcacheP.h"
-#include "fontcachstr.h"
-#endif
-
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#define _XCUP_SERVER_
-#include <X11/extensions/Xcupstr.h>
-#endif
-
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#endif
-
-#ifdef XV
-extern void XvExtensionInit(INITARGS);
-extern void XvMCExtensionInit(INITARGS);
-extern void XvRegister(INITARGS);
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/XvMC.h>
-#endif
-
-#ifdef RES
-extern void ResExtensionInit(INITARGS);
-#include <X11/extensions/XResproto.h>
-#endif
-
-#ifdef SHM
-extern void ShmExtensionInit(INITARGS);
-#include <X11/extensions/shmstr.h>
-extern void ShmSetPixmapFormat(
- ScreenPtr pScreen,
- int format);
-extern void ShmRegisterFuncs(
- ScreenPtr pScreen,
- ShmFuncsPtr funcs);
-#endif
-
-#if 1
-extern void SecurityExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void XagExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void XpExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void PanoramiXExtensionInit(int argc, char *argv[]);
-#endif
-
-#if 1
-extern void XkbExtensionInit(INITARGS);
-#endif
diff --git a/nx-X11/programs/Xserver/Xext/fontcache.c b/nx-X11/programs/Xserver/Xext/fontcache.c
deleted file mode 100644
index 9ab23a122..000000000
--- a/nx-X11/programs/Xserver/Xext/fontcache.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*-
- * Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
- * All rights reserved.
- * Copyright (c) 1998-1999 X-TrueType Server Project, All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Id: fontcache.c,v 1.12 1999/01/31 13:47:45 akiyama Exp $
- */
-/* $XFree86: xc/programs/Xserver/Xext/fontcache.c,v 1.7 2003/10/28 23:08:43 tsi Exp $ */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "inputstr.h"
-#include "servermd.h"
-#define _FONTCACHE_SERVER_
-#include "fontcacheP.h"
-#include "fontcachstr.h"
-#include <X11/Xfuncproto.h>
-
-#include "swaprep.h"
-#include "modinit.h"
-
-static int miscErrorBase;
-
-static void FontCacheResetProc(
- ExtensionEntry* /* extEntry */
-);
-
-static DISPATCH_PROC(ProcFontCacheDispatch);
-static DISPATCH_PROC(ProcFontCacheGetCacheSettings);
-static DISPATCH_PROC(ProcFontCacheGetCacheStatistics);
-static DISPATCH_PROC(ProcFontCacheQueryVersion);
-static DISPATCH_PROC(ProcFontCacheChangeCacheSettings);
-static DISPATCH_PROC(SProcFontCacheDispatch);
-static DISPATCH_PROC(SProcFontCacheGetCacheSettings);
-static DISPATCH_PROC(SProcFontCacheGetCacheStatistics);
-static DISPATCH_PROC(SProcFontCacheQueryVersion);
-static DISPATCH_PROC(SProcFontCacheChangeCacheSettings);
-
-#if 0
-static unsigned char FontCacheReqCode = 0;
-#endif
-
-void
-FontCacheExtensionInit(INITARGS)
-{
- ExtensionEntry* extEntry;
-
- if (
- (extEntry = AddExtension(FONTCACHENAME,
- FontCacheNumberEvents,
- FontCacheNumberErrors,
- ProcFontCacheDispatch,
- SProcFontCacheDispatch,
- FontCacheResetProc,
- StandardMinorOpcode))) {
-#if 0
- FontCacheReqCode = (unsigned char)extEntry->base;
-#endif
- miscErrorBase = extEntry->errorBase;
- }
-}
-
-/*ARGSUSED*/
-static void
-FontCacheResetProc (extEntry)
- ExtensionEntry* extEntry;
-{
-}
-
-static int
-ProcFontCacheQueryVersion(client)
- register ClientPtr client;
-{
- xFontCacheQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH(xFontCacheQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = FONTCACHE_MAJOR_VERSION;
- rep.minorVersion = FONTCACHE_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, SIZEOF(xFontCacheQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcFontCacheGetCacheSettings(client)
- register ClientPtr client;
-{
- xFontCacheGetCacheSettingsReply rep;
- FontCacheSettings cinfo;
- register int n;
-
- REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
- /* XXX */
- FontCacheGetSettings(&cinfo);
- rep.himark = cinfo.himark;
- rep.lowmark = cinfo.lowmark;
- rep.balance = cinfo.balance;
- rep.reserve0 = 0;
- rep.reserve1 = 0;
- rep.reserve2 = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.himark, n);
- swapl(&rep.lowmark, n);
- swapl(&rep.balance, n);
- swapl(&rep.reserve0, n);
- swapl(&rep.reserve1, n);
- swapl(&rep.reserve2, n);
- }
- /* XXX */
-
- WriteToClient(client, SIZEOF(xFontCacheGetCacheSettingsReply),
- (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcFontCacheGetCacheStatistics(client)
- register ClientPtr client;
-{
- xFontCacheGetCacheStatisticsReply rep;
- FontCacheStatistics cstats;
- register int n;
-
- REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = (sz_xFontCacheGetCacheStatisticsReply - 32) >> 2;
-
- /* XXX */
- FontCacheGetStatistics(&cstats);
- rep.purge_runs = cstats.purge_runs;
- rep.purge_stat = cstats.purge_stat;
- rep.balance = cstats.balance;
- rep.reserve0 = 0;
- rep.f_hits = cstats.f.hits;
- rep.f_misshits = cstats.f.misshits;
- rep.f_purged = cstats.f.purged;
- rep.f_usage = cstats.f.usage;
- rep.f_reserve0 = 0;
- rep.v_hits = cstats.v.hits;
- rep.v_misshits = cstats.v.misshits;
- rep.v_purged = cstats.v.purged;
- rep.v_usage = cstats.v.usage;
- rep.v_reserve0 = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.purge_runs, n);
- swapl(&rep.purge_stat, n);
- swapl(&rep.balance, n);
- swapl(&rep.reserve0, n);
- swapl(&rep.f_hits, n);
- swapl(&rep.f_misshits, n);
- swapl(&rep.f_purged, n);
- swapl(&rep.f_usage, n);
- swapl(&rep.f_reserve0, n);
- swapl(&rep.v_hits, n);
- swapl(&rep.v_misshits, n);
- swapl(&rep.v_purged, n);
- swapl(&rep.v_usage, n);
- swapl(&rep.v_reserve0, n);
- }
- /* XXX */
- WriteToClient(client, SIZEOF(xFontCacheGetCacheStatisticsReply),
- (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcFontCacheChangeCacheSettings(client)
- register ClientPtr client;
-{
- FontCacheSettings cs;
-
- REQUEST(xFontCacheChangeCacheSettingsReq);
-
- REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
-
- /* XXX */
- cs.himark = stuff->himark;
- cs.lowmark = stuff->lowmark;
- cs.balance = stuff->balance;
-
- if (cs.himark < 0 || cs.lowmark < 0)
- return BadValue;
- if (cs.himark <= cs.lowmark)
- return BadValue;
- if (!(10 <= cs.balance && cs.balance <= 90))
- return BadValue;
-
- if (FontCacheChangeSettings(&cs) == 0)
- return miscErrorBase + FontCacheCannotAllocMemory;
- /* XXX */
-
- return (client->noClientException);
-}
-
-static int
-ProcFontCacheDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_FontCacheQueryVersion:
- return ProcFontCacheQueryVersion(client);
- case X_FontCacheGetCacheSettings:
- return ProcFontCacheGetCacheSettings(client);
- case X_FontCacheGetCacheStatistics:
- return ProcFontCacheGetCacheStatistics(client);
- case X_FontCacheChangeCacheSettings:
- return ProcFontCacheChangeCacheSettings(client);
- default:
- return miscErrorBase + FontCacheBadProtocol;
- }
-}
-
-static int
-SProcFontCacheQueryVersion(client)
- register ClientPtr client;
-{
- register int n;
- REQUEST(xFontCacheQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcFontCacheQueryVersion(client);
-}
-
-static int
-SProcFontCacheGetCacheSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xFontCacheGetCacheSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
- return ProcFontCacheGetCacheSettings(client);
-}
-
-static int
-SProcFontCacheGetCacheStatistics(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xFontCacheGetCacheStatisticsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
- return ProcFontCacheGetCacheStatistics(client);
-}
-
-static int
-SProcFontCacheChangeCacheSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xFontCacheChangeCacheSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
- /* XXX */
- swapl(&stuff->himark, n);
- swapl(&stuff->lowmark, n);
- swapl(&stuff->balance, n);
- /* XXX */
- return ProcFontCacheChangeCacheSettings(client);
-}
-
-static int
-SProcFontCacheDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_FontCacheQueryVersion:
- return SProcFontCacheQueryVersion(client);
- case X_FontCacheGetCacheSettings:
- return SProcFontCacheGetCacheSettings(client);
- case X_FontCacheGetCacheStatistics:
- return SProcFontCacheGetCacheStatistics(client);
- case X_FontCacheChangeCacheSettings:
- return SProcFontCacheChangeCacheSettings(client);
- default:
- return miscErrorBase + FontCacheBadProtocol;
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/mbuf.c b/nx-X11/programs/Xserver/Xext/mbuf.c
deleted file mode 100644
index 3129edd87..000000000
--- a/nx-X11/programs/Xserver/Xext/mbuf.c
+++ /dev/null
@@ -1,1787 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.15 2003/10/28 23:08:43 tsi Exp $ */
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-/* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "window.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "sleepuntil.h"
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#include <X11/extensions/multibufst.h>
-
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#else
-#include <stdio.h>
-#if !defined(WIN32) && !defined(Lynx)
-#include <sys/time.h>
-#endif
-#endif
-
-/* given an OtherClientPtr obj, get the ClientPtr */
-#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-
-/* given a MultibufferPtr b, get the ClientPtr */
-#define bClient(b) (clients[CLIENT_ID(b->pPixmap->drawable.id)])
-
-#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
-
-#if 0
-static unsigned char MultibufferReqCode;
-#endif
-static int MultibufferEventBase;
-static int MultibufferErrorBase;
-int MultibufferScreenIndex = -1;
-int MultibufferWindowIndex = -1;
-
-static void PerformDisplayRequest (
- MultibuffersPtr * /* ppMultibuffers */,
- MultibufferPtr * /* pMultibuffer */,
- int /* nbuf */
- );
-static Bool QueueDisplayRequest (
- ClientPtr /* client */,
- TimeStamp /* activateTime */
- );
-
-static void BumpTimeStamp (
- TimeStamp * /* ts */,
- CARD32 /* inc */
- );
-
-static void AliasMultibuffer (
- MultibuffersPtr /* pMultibuffers */,
- int /* i */
- );
-static void RecalculateMultibufferOtherEvents (
- MultibufferPtr /* pMultibuffer */
- );
-static int EventSelectForMultibuffer(
- MultibufferPtr /* pMultibuffer */,
- ClientPtr /* client */,
- Mask /* mask */
- );
-
-/*
- * The Pixmap associated with a buffer can be found as a resource
- * with this type
- */
-RESTYPE MultibufferDrawableResType;
-static int MultibufferDrawableDelete (
- pointer /* value */,
- XID /* id */
- );
-/*
- * The per-buffer data can be found as a resource with this type.
- * the resource id of the per-buffer data is the same as the resource
- * id of the pixmap
- */
-static RESTYPE MultibufferResType;
-static int MultibufferDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/*
- * The per-window data can be found as a resource with this type,
- * using the window resource id
- */
-static RESTYPE MultibuffersResType;
-static int MultibuffersDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/*
- * Clients other than the buffer creator attach event masks in
- * OtherClient structures; each has a resource of this type.
- */
-static RESTYPE OtherClientResType;
-static int OtherClientDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/****************
- * MultibufferExtensionInit
- *
- * Called from InitExtensions in main()
- *
- ****************/
-
-extern DISPATCH_PROC(ProcGetBufferAttributes);
-
-static DISPATCH_PROC(ProcClearImageBufferArea);
-static DISPATCH_PROC(ProcCreateImageBuffers);
-static DISPATCH_PROC(ProcDestroyImageBuffers);
-static DISPATCH_PROC(ProcDisplayImageBuffers);
-static DISPATCH_PROC(ProcGetBufferInfo);
-static DISPATCH_PROC(ProcGetBufferVersion);
-static DISPATCH_PROC(ProcGetMBufferAttributes);
-static DISPATCH_PROC(ProcMultibufferDispatch);
-static DISPATCH_PROC(ProcSetBufferAttributes);
-static DISPATCH_PROC(ProcSetMBufferAttributes);
-static DISPATCH_PROC(SProcClearImageBufferArea);
-static DISPATCH_PROC(SProcCreateImageBuffers);
-static DISPATCH_PROC(SProcDestroyImageBuffers);
-static DISPATCH_PROC(SProcDisplayImageBuffers);
-static DISPATCH_PROC(SProcGetBufferAttributes);
-static DISPATCH_PROC(SProcGetBufferInfo);
-static DISPATCH_PROC(SProcGetBufferVersion);
-static DISPATCH_PROC(SProcGetMBufferAttributes);
-static DISPATCH_PROC(SProcMultibufferDispatch);
-static DISPATCH_PROC(SProcSetBufferAttributes);
-static DISPATCH_PROC(SProcSetMBufferAttributes);
-
-static void MultibufferResetProc(
- ExtensionEntry * /* extEntry */
- );
-static void SClobberNotifyEvent(
- xMbufClobberNotifyEvent * /* from */,
- xMbufClobberNotifyEvent * /* to */
- );
-static void SUpdateNotifyEvent(
- xMbufUpdateNotifyEvent * /* from */,
- xMbufUpdateNotifyEvent * /* to */
- );
-static Bool MultibufferPositionWindow(
- WindowPtr /* pWin */,
- int /* x */,
- int /* y */
- );
-
-static void SetupBackgroundPainter (
- WindowPtr /* pWin */,
- GCPtr /* pGC */
- );
-
-static int DeliverEventsToMultibuffer (
- MultibufferPtr /* pMultibuffer */,
- xEvent * /* pEvents */,
- int /* count */,
- Mask /* filter */
- );
-
-void
-MultibufferExtensionInit()
-{
- ExtensionEntry *extEntry;
- int i, j;
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
-
- /*
- * allocate private pointers in windows and screens. Allocating
- * window privates may seem like an unnecessary expense, but every
- * PositionWindow call must check to see if the window is
- * multi-buffered; a resource lookup is too expensive.
- */
- MultibufferScreenIndex = AllocateScreenPrivateIndex ();
- if (MultibufferScreenIndex < 0)
- return;
- MultibufferWindowIndex = AllocateWindowPrivateIndex ();
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) ||
- !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
- {
- for (j = 0; j < i; j++)
- xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr);
- return;
- }
- pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen;
- /*
- * wrap PositionWindow to resize the pixmap when the window
- * changes size
- */
- pMultibufferScreen->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = MultibufferPositionWindow;
- }
- /*
- * create the resource types
- */
- MultibufferDrawableResType =
- CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE;
- MultibufferResType = CreateNewResourceType(MultibufferDelete);
- MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
- OtherClientResType = CreateNewResourceType(OtherClientDelete);
- if (MultibufferDrawableResType && MultibufferResType &&
- MultibuffersResType && OtherClientResType &&
- (extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
- MultibufferNumberEvents,
- MultibufferNumberErrors,
- ProcMultibufferDispatch, SProcMultibufferDispatch,
- MultibufferResetProc, StandardMinorOpcode)))
- {
-#if 0
- MultibufferReqCode = (unsigned char)extEntry->base;
-#endif
- MultibufferEventBase = extEntry->eventBase;
- MultibufferErrorBase = extEntry->errorBase;
- EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
- EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
- }
-}
-
-/*ARGSUSED*/
-static void
-MultibufferResetProc (extEntry)
-ExtensionEntry *extEntry;
-{
- int i;
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
-
- if (MultibufferScreenIndex < 0)
- return;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (pScreen->devPrivates[MultibufferScreenIndex].ptr)
- {
- pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
- pScreen->PositionWindow = pMultibufferScreen->PositionWindow;
- xfree (pMultibufferScreen);
- }
- }
-}
-
-static int
-ProcGetBufferVersion (client)
- register ClientPtr client;
-{
- xMbufGetBufferVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = MULTIBUFFER_MAJOR_VERSION;
- rep.minorVersion = MULTIBUFFER_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof (xMbufGetBufferVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static void
-SetupBackgroundPainter (pWin, pGC)
- WindowPtr pWin;
- GCPtr pGC;
-{
- pointer gcvalues[4];
- int ts_x_origin, ts_y_origin;
- PixUnion background;
- int backgroundState;
- Mask gcmask;
-
- /*
- * First take care of any ParentRelative stuff by altering the
- * tile/stipple origin to match the coordinates of the upper-left
- * corner of the first ancestor without a ParentRelative background.
- * This coordinate is, of course, negative.
- */
-
- ts_x_origin = ts_y_origin = 0;
- while (pWin->backgroundState == ParentRelative) {
- ts_x_origin -= pWin->origin.x;
- ts_y_origin -= pWin->origin.y;
- pWin = pWin->parent;
- }
- backgroundState = pWin->backgroundState;
- background = pWin->background;
-
- switch (backgroundState)
- {
- case BackgroundPixel:
- gcvalues[0] = (pointer) background.pixel;
- gcvalues[1] = (pointer) FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0] = (pointer) FillTiled;
- gcvalues[1] = (pointer) background.pixmap;
- gcvalues[2] = (pointer)(long) ts_x_origin;
- gcvalues[3] = (pointer)(long) ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- gcvalues[0] = (pointer) GXnoop;
- gcmask = GCFunction;
- }
- DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
-}
-
-int
-CreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- MultibuffersPtr pMultibuffers;
- MultibufferPtr pMultibuffer;
- ScreenPtr pScreen;
- int width, height, depth;
- int i;
- GCPtr pClearGC = NULL;
- xRectangle clearRect;
-
- DestroyImageBuffers(pWin);
- pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) +
- nbuf * sizeof (MultibufferRec));
- if (!pMultibuffers)
- return BadAlloc;
- pMultibuffers->pWindow = pWin;
- pMultibuffers->buffers = (MultibufferPtr) (pMultibuffers + 1);
- pMultibuffers->refcnt = pMultibuffers->numMultibuffer = 0;
- if (!AddResource (pWin->drawable.id, MultibuffersResType, (pointer) pMultibuffers))
- return BadAlloc;
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- depth = pWin->drawable.depth;
- pScreen = pWin->drawable.pScreen;
-
- if (pWin->backgroundState != None)
- {
- pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
- SetupBackgroundPainter (pWin, pClearGC);
- clearRect.x = clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
-
- for (i = 0; i < nbuf; i++)
- {
- pMultibuffer = &pMultibuffers->buffers[i];
- pMultibuffer->eventMask = 0L;
- pMultibuffer->otherEventMask = 0L;
- pMultibuffer->otherClients = (OtherClientsPtr) NULL;
- pMultibuffer->number = i;
- pMultibuffer->side = MultibufferSideMono;
- pMultibuffer->clobber = MultibufferUnclobbered;
- pMultibuffer->pMultibuffers = pMultibuffers;
- if (!AddResource (ids[i], MultibufferResType, (pointer) pMultibuffer))
- break;
- pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth);
- if (!pMultibuffer->pPixmap)
- break;
- if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap))
- {
- FreeResource (ids[i], MultibufferResType);
- (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
- break;
- }
- pMultibuffer->pPixmap->drawable.id = ids[i];
-
- if (i > 0 && pClearGC)
- {
- ValidateGC((DrawablePtr)pMultibuffer->pPixmap, pClearGC);
- (*pClearGC->ops->PolyFillRect)((DrawablePtr)pMultibuffer->pPixmap,
- pClearGC, 1, &clearRect);
- }
- }
- pMultibuffers->numMultibuffer = i;
- pMultibuffers->refcnt = i;
- pMultibuffers->displayedMultibuffer = -1;
- if (i > 0)
- AliasMultibuffer (pMultibuffers, 0);
- pMultibuffers->updateAction = action;
- pMultibuffers->updateHint = hint;
- pMultibuffers->windowMode = MultibufferModeMono;
- pMultibuffers->lastUpdate.months = 0;
- pMultibuffers->lastUpdate.milliseconds = 0;
- pMultibuffers->width = width;
- pMultibuffers->height = height;
- pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers;
- if (pClearGC) FreeScratchGC(pClearGC);
- return Success;
-}
-
-
-static int
-ProcCreateImageBuffers (client)
- register ClientPtr client;
-{
- REQUEST(xMbufCreateImageBuffersReq);
- xMbufCreateImageBuffersReply rep;
- register int n;
- WindowPtr pWin;
- XID *ids;
- int len, nbuf;
- int i;
- int err;
-
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
- if (len == 0)
- return BadLength;
- if (!(pWin = LookupWindow (stuff->window, client)))
- return BadWindow;
- if (pWin->drawable.class == InputOnly)
- return BadMatch;
- switch (stuff->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- case MultibufferUpdateActionBackground:
- case MultibufferUpdateActionUntouched:
- case MultibufferUpdateActionCopied:
- break;
- default:
- client->errorValue = stuff->updateAction;
- return BadValue;
- }
- switch (stuff->updateHint)
- {
- case MultibufferUpdateHintFrequent:
- case MultibufferUpdateHintIntermittent:
- case MultibufferUpdateHintStatic:
- break;
- default:
- client->errorValue = stuff->updateHint;
- return BadValue;
- }
- nbuf = len;
- ids = (XID *) &stuff[1];
- for (i = 0; i < nbuf; i++)
- {
- LEGAL_NEW_RESOURCE(ids[i], client);
- }
- err = CreateImageBuffers (pWin, nbuf, ids,
- stuff->updateAction, stuff->updateHint);
- if (err != Success)
- return err;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.numberBuffer, n);
- }
- WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcDisplayImageBuffers (client)
- register ClientPtr client;
-{
- REQUEST(xMbufDisplayImageBuffersReq);
- MultibufferPtr *pMultibuffer;
- MultibuffersPtr *ppMultibuffers;
- int nbuf;
- XID *ids;
- int i, j;
- CARD32 minDelay;
- TimeStamp activateTime, bufferTime;
-
-
- REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
- nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
- if (!nbuf)
- return Success;
- minDelay = stuff->minDelay;
- ids = (XID *) &stuff[1];
- ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
- pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
- if (!ppMultibuffers || !pMultibuffer)
- {
- if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers);
- if (pMultibuffer) DEALLOCATE_LOCAL(pMultibuffer);
- client->errorValue = 0;
- return BadAlloc;
- }
- activateTime.months = 0;
- activateTime.milliseconds = 0;
- for (i = 0; i < nbuf; i++)
- {
- pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
-MultibufferResType);
- if (!pMultibuffer[i])
- {
- DEALLOCATE_LOCAL(ppMultibuffers);
- DEALLOCATE_LOCAL(pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- ppMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
- for (j = 0; j < i; j++)
- {
- if (ppMultibuffers[i] == ppMultibuffers[j])
- {
- DEALLOCATE_LOCAL(ppMultibuffers);
- DEALLOCATE_LOCAL(pMultibuffer);
- client->errorValue = ids[i];
- return BadMatch;
- }
- }
- bufferTime = ppMultibuffers[i]->lastUpdate;
- BumpTimeStamp (&bufferTime, minDelay);
- if (CompareTimeStamps (bufferTime, activateTime) == LATER)
- activateTime = bufferTime;
- }
- UpdateCurrentTime ();
- if (CompareTimeStamps (activateTime, currentTime) == LATER &&
- QueueDisplayRequest (client, activateTime))
- {
- ;
- }
- else
- PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
-
- DEALLOCATE_LOCAL(ppMultibuffers);
- DEALLOCATE_LOCAL(pMultibuffer);
- return Success;
-}
-
-
-static int
-ProcDestroyImageBuffers (client)
- register ClientPtr client;
-{
- REQUEST (xMbufDestroyImageBuffersReq);
- WindowPtr pWin;
-
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- if (!(pWin = LookupWindow (stuff->window, client)))
- return BadWindow;
- DestroyImageBuffers (pWin);
- return Success;
-}
-
-static int
-ProcSetMBufferAttributes (client)
- register ClientPtr client;
-{
- REQUEST (xMbufSetMBufferAttributesReq);
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- int len;
- Mask vmask;
- Mask index2;
- CARD32 updateHint;
- XID *vlist;
-
- REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
- pWin = LookupWindow (stuff->window, client);
- if (!pWin)
- return BadWindow;
- pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
- if (!pMultibuffers)
- return BadMatch;
- len = stuff->length - (sizeof (xMbufSetMBufferAttributesReq) >> 2);
- vmask = stuff->valueMask;
- if (len != Ones (vmask))
- return BadLength;
- vlist = (XID *) &stuff[1];
- while (vmask)
- {
- index2 = (Mask) lowbit (vmask);
- vmask &= ~index2;
- switch (index2)
- {
- case MultibufferWindowUpdateHint:
- updateHint = (CARD32) *vlist;
- switch (updateHint)
- {
- case MultibufferUpdateHintFrequent:
- case MultibufferUpdateHintIntermittent:
- case MultibufferUpdateHintStatic:
- pMultibuffers->updateHint = updateHint;
- break;
- default:
- client->errorValue = updateHint;
- return BadValue;
- }
- vlist++;
- break;
- default:
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
- }
- return Success;
-}
-
-static int
-ProcGetMBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST (xMbufGetMBufferAttributesReq);
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- XID *ids;
- xMbufGetMBufferAttributesReply rep;
- int i, n;
-
- REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
- pWin = LookupWindow (stuff->window, client);
- if (!pWin)
- return BadWindow;
- pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
- if (!pMultibuffers)
- return BadAccess;
- ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID));
- if (!ids)
- return BadAlloc;
- for (i = 0; i < pMultibuffers->numMultibuffer; i++)
- ids[i] = pMultibuffers->buffers[i].pPixmap->drawable.id;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = pMultibuffers->numMultibuffer;
- rep.displayedBuffer = pMultibuffers->displayedMultibuffer;
- rep.updateAction = pMultibuffers->updateAction;
- rep.updateHint = pMultibuffers->updateHint;
- rep.windowMode = pMultibuffers->windowMode;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.displayedBuffer, n);
- SwapLongs (ids, pMultibuffers->numMultibuffer);
- }
- WriteToClient (client, sizeof(xMbufGetMBufferAttributesReply),
- (char *)&rep);
- WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
- (char *)ids);
- DEALLOCATE_LOCAL((pointer) ids);
- return client->noClientException;
-}
-
-static int
-ProcSetBufferAttributes (client)
- register ClientPtr client;
-{
- REQUEST(xMbufSetBufferAttributesReq);
- MultibufferPtr pMultibuffer;
- int len;
- Mask vmask, index2;
- XID *vlist;
- Mask eventMask;
- int result;
-
- REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq);
- pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
- if (!pMultibuffer)
- return MultibufferErrorBase + MultibufferBadBuffer;
- len = stuff->length - (sizeof (xMbufSetBufferAttributesReq) >> 2);
- vmask = stuff->valueMask;
- if (len != Ones (vmask))
- return BadLength;
- vlist = (XID *) &stuff[1];
- while (vmask)
- {
- index2 = (Mask) lowbit (vmask);
- vmask &= ~index2;
- switch (index2)
- {
- case MultibufferBufferEventMask:
- eventMask = (Mask) *vlist;
- vlist++;
- result = EventSelectForMultibuffer (pMultibuffer, client, eventMask);
- if (result != Success)
- return result;
- break;
- default:
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
- }
- return Success;
-}
-
-int
-ProcGetBufferAttributes (client)
- register ClientPtr client;
-{
- REQUEST(xMbufGetBufferAttributesReq);
- MultibufferPtr pMultibuffer;
- xMbufGetBufferAttributesReply rep;
- OtherClientsPtr other;
- int n;
-
- REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq);
- pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
- if (!pMultibuffer)
- return MultibufferErrorBase + MultibufferBadBuffer;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.window = pMultibuffer->pMultibuffers->pWindow->drawable.id;
- if (bClient (pMultibuffer) == client)
- rep.eventMask = pMultibuffer->eventMask;
- else
- {
- rep.eventMask = (Mask) 0L;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- if (SameClient (other, client))
- {
- rep.eventMask = other->mask;
- break;
- }
- }
- rep.bufferIndex = pMultibuffer->number;
- rep.side = pMultibuffer->side;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.window, n);
- swapl(&rep.eventMask, n);
- swaps(&rep.bufferIndex, n);
- }
- WriteToClient(client, sizeof (xMbufGetBufferAttributesReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcGetBufferInfo (client)
- register ClientPtr client;
-{
- REQUEST (xMbufGetBufferInfoReq);
- DrawablePtr pDrawable;
- xMbufGetBufferInfoReply rep;
- ScreenPtr pScreen;
- int i, j, k;
- int n;
- xMbufBufferInfo *pInfo;
- int nInfo;
- DepthPtr pDepth;
-
- pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client);
- if (!pDrawable)
- return BadDrawable;
- pScreen = pDrawable->pScreen;
- nInfo = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- nInfo += pDepth->numVids;
- }
- pInfo = (xMbufBufferInfo *)
- ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo));
- if (!pInfo)
- return BadAlloc;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = nInfo * (sizeof (xMbufBufferInfo) >> 2);
- rep.normalInfo = nInfo;
- rep.stereoInfo = 0;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.normalInfo, n);
- swaps(&rep.stereoInfo, n);
- }
-
- k = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- for (j = 0; j < pDepth->numVids; j++)
- {
- pInfo[k].visualID = pDepth->vids[j];
- pInfo[k].maxBuffers = 0;
- pInfo[k].depth = pDepth->depth;
- if (client->swapped)
- {
- swapl (&pInfo[k].visualID, n);
- swaps (&pInfo[k].maxBuffers, n);
- }
- k++;
- }
- }
- WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep);
- WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo);
- DEALLOCATE_LOCAL ((pointer) pInfo);
- return client->noClientException;
-}
-
-static int
-ProcClearImageBufferArea (client)
- register ClientPtr client;
-{
- REQUEST (xMbufClearImageBufferAreaReq);
- MultibufferPtr pMultibuffer;
- WindowPtr pWin;
- xRectangle clearRect;
- int width, height;
- DrawablePtr pDrawable;
- ScreenPtr pScreen;
-
- REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
- pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
- if (!pMultibuffer)
- return MultibufferErrorBase + MultibufferBadBuffer;
- if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
- {
- client->errorValue = stuff->exposures;
- return(BadValue);
- }
- pWin = pMultibuffer->pMultibuffers->pWindow;
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- pScreen = pWin->drawable.pScreen;
-
- clearRect.x = stuff->x;
- clearRect.y = stuff->y;
- clearRect.width = stuff->width ? stuff->width : width;
- clearRect.height = stuff->height ? stuff->height : height;
-
- if (pWin->backgroundState != None)
- {
- GCPtr pClearGC;
- pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
- SetupBackgroundPainter (pWin, pClearGC);
-
- if (pMultibuffer->number == pMultibuffer->pMultibuffers->displayedMultibuffer)
- pDrawable = (DrawablePtr)pWin;
- else
- pDrawable = (DrawablePtr)pMultibuffer->pPixmap;
-
- ValidateGC(pDrawable, pClearGC);
- (*pClearGC->ops->PolyFillRect) (pDrawable, pClearGC, 1, &clearRect);
- FreeScratchGC(pClearGC);
- }
-
- if (stuff->exposures)
- {
- RegionRec region;
- BoxRec box;
- box.x1 = clearRect.x;
- box.y1 = clearRect.y;
- box.x2 = clearRect.x + clearRect.width;
- box.y2 = clearRect.y + clearRect.height;
- REGION_INIT(pScreen, &region, &box, 1);
- MultibufferExpose(pMultibuffer, &region);
- REGION_UNINIT(pScreen, &region);
- }
- return Success;
-}
-
-static int
-ProcMultibufferDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_MbufGetBufferVersion:
- return ProcGetBufferVersion (client);
- case X_MbufCreateImageBuffers:
- return ProcCreateImageBuffers (client);
- case X_MbufDisplayImageBuffers:
- return ProcDisplayImageBuffers (client);
- case X_MbufDestroyImageBuffers:
- return ProcDestroyImageBuffers (client);
- case X_MbufSetMBufferAttributes:
- return ProcSetMBufferAttributes (client);
- case X_MbufGetMBufferAttributes:
- return ProcGetMBufferAttributes (client);
- case X_MbufSetBufferAttributes:
- return ProcSetBufferAttributes (client);
- case X_MbufGetBufferAttributes:
- return ProcGetBufferAttributes (client);
- case X_MbufGetBufferInfo:
- return ProcGetBufferInfo (client);
- case X_MbufClearImageBufferArea:
- return ProcClearImageBufferArea (client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcGetBufferVersion (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufGetBufferVersionReq);
-
- swaps (&stuff->length, n);
- return ProcGetBufferVersion (client);
-}
-
-static int
-SProcCreateImageBuffers (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufCreateImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- swapl (&stuff->window, n);
- SwapRestL(stuff);
- return ProcCreateImageBuffers (client);
-}
-
-static int
-SProcDisplayImageBuffers (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufDisplayImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
- swaps (&stuff->minDelay, n);
- swaps (&stuff->maxDelay, n);
- SwapRestL(stuff);
- return ProcDisplayImageBuffers (client);
-}
-
-static int
-SProcDestroyImageBuffers (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufDestroyImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- swapl (&stuff->window, n);
- return ProcDestroyImageBuffers (client);
-}
-
-static int
-SProcSetMBufferAttributes (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufSetMBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufSetMBufferAttributesReq);
- swapl (&stuff->window, n);
- swapl (&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcSetMBufferAttributes (client);
-}
-
-static int
-SProcGetMBufferAttributes (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufGetMBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufGetMBufferAttributesReq);
- swapl (&stuff->window, n);
- return ProcGetMBufferAttributes (client);
-}
-
-static int
-SProcSetBufferAttributes (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufSetBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufSetBufferAttributesReq);
- swapl (&stuff->buffer, n);
- swapl (&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcSetBufferAttributes (client);
-}
-
-static int
-SProcGetBufferAttributes (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufGetBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufGetBufferAttributesReq);
- swapl (&stuff->buffer, n);
- return ProcGetBufferAttributes (client);
-}
-
-static int
-SProcGetBufferInfo (client)
- register ClientPtr client;
-{
- register int n;
- REQUEST (xMbufGetBufferInfoReq);
-
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufGetBufferInfoReq);
- swapl (&stuff->drawable, n);
- return ProcGetBufferInfo (client);
-}
-
-static int
-SProcClearImageBufferArea(client)
- register ClientPtr client;
-{
- register char n;
- REQUEST(xMbufClearImageBufferAreaReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
- swapl(&stuff->buffer, n);
- swaps(&stuff->x, n);
- swaps(&stuff->y, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- return ProcClearImageBufferArea(client);
-}
-
-static int
-SProcMultibufferDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_MbufGetBufferVersion:
- return SProcGetBufferVersion (client);
- case X_MbufCreateImageBuffers:
- return SProcCreateImageBuffers (client);
- case X_MbufDisplayImageBuffers:
- return SProcDisplayImageBuffers (client);
- case X_MbufDestroyImageBuffers:
- return SProcDestroyImageBuffers (client);
- case X_MbufSetMBufferAttributes:
- return SProcSetMBufferAttributes (client);
- case X_MbufGetMBufferAttributes:
- return SProcGetMBufferAttributes (client);
- case X_MbufSetBufferAttributes:
- return SProcSetBufferAttributes (client);
- case X_MbufGetBufferAttributes:
- return SProcGetBufferAttributes (client);
- case X_MbufGetBufferInfo:
- return SProcGetBufferInfo (client);
- case X_MbufClearImageBufferArea:
- return SProcClearImageBufferArea (client);
- default:
- return BadRequest;
- }
-}
-
-static void
-SUpdateNotifyEvent (from, to)
- xMbufUpdateNotifyEvent *from, *to;
-{
- to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->buffer, to->buffer);
- cpswapl (from->timeStamp, to->timeStamp);
-}
-
-static void
-SClobberNotifyEvent (from, to)
- xMbufClobberNotifyEvent *from, *to;
-{
- to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->buffer, to->buffer);
- to->state = from->state;
-}
-
-static void
-PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
- MultibufferPtr *pMultibuffer;
- MultibuffersPtr *ppMultibuffers;
- int nbuf;
-{
- GCPtr pGC;
- PixmapPtr pPrevPixmap, pNewPixmap;
- xRectangle clearRect;
- WindowPtr pWin;
- RegionPtr pExposed;
- int i;
- MultibufferPtr pPrevMultibuffer;
- XID graphicsExpose;
-
- UpdateCurrentTime ();
- for (i = 0; i < nbuf; i++)
- {
- pWin = ppMultibuffers[i]->pWindow;
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- pPrevMultibuffer =
- &ppMultibuffers[i]->buffers[ppMultibuffers[i]->displayedMultibuffer];
- pPrevPixmap = pPrevMultibuffer->pPixmap;
- pNewPixmap = pMultibuffer[i]->pPixmap;
- switch (ppMultibuffers[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
- case MultibufferUpdateActionBackground:
- SetupBackgroundPainter (pWin, pGC);
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = pPrevPixmap->drawable.width;
- clearRect.height = pPrevPixmap->drawable.height;
- (*pGC->ops->PolyFillRect) ((DrawablePtr)pPrevPixmap, pGC,
- 1, &clearRect);
- break;
- case MultibufferUpdateActionUntouched:
- /* copy the window to the pixmap that represents the
- * currently displayed buffer
- */
- if (pPrevMultibuffer->eventMask & ExposureMask)
- {
- graphicsExpose = TRUE;
- DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
- }
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- pExposed = (*pGC->ops->CopyArea)
- ((DrawablePtr) pWin,
- (DrawablePtr) pPrevPixmap,
- pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
-
- /* if we couldn't copy the whole window to the buffer,
- * send expose events (if any client wants them)
- */
- if (pPrevMultibuffer->eventMask & ExposureMask)
- { /* some client wants expose events */
- if (pExposed)
- {
- RegionPtr pWinSize;
-
- pWinSize = CreateUnclippedWinSize (pWin);
- /* pExposed is window-relative, but at this point
- * pWinSize is screen-relative. Make pWinSize be
- * window-relative so that region ops involving
- * pExposed and pWinSize behave sensibly.
- */
- REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
- -pWin->drawable.x, -pWin->drawable.y);
- REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
- pExposed, pWinSize);
- REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
- MultibufferExpose (pPrevMultibuffer, pExposed);
- REGION_DESTROY(pWin->drawable.pScreen, pExposed);
- }
- graphicsExpose = FALSE;
- DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
- }
- break; /* end case MultibufferUpdateActionUntouched */
-
- case MultibufferUpdateActionCopied:
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
- (DrawablePtr)pPrevPixmap, pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- break;
- } /* end switch on update action */
-
- /* display the new buffer */
- ValidateGC ((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- ppMultibuffers[i]->lastUpdate = currentTime;
- MultibufferUpdate (pMultibuffer[i],
- ppMultibuffers[i]->lastUpdate.milliseconds);
- AliasMultibuffer (ppMultibuffers[i],
- pMultibuffer[i] - ppMultibuffers[i]->buffers);
- FreeScratchGC (pGC);
- }
-}
-
-DrawablePtr
-GetBufferPointer (pWin, i)
- WindowPtr pWin;
- int i;
-{
- MultibuffersPtr pMultibuffers;
-
- if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
- return NULL;
- return (DrawablePtr) pMultibuffers->buffers[i].pPixmap;
-}
-
-int
-DisplayImageBuffers (ids, nbuf)
- XID *ids;
- int nbuf;
-{
- MultibufferPtr *pMultibuffer;
- MultibuffersPtr *pMultibuffers;
- int i, j;
-
- pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer +
- nbuf * sizeof *pMultibuffers);
- if (!pMultibuffer)
- return BadAlloc;
- pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf);
- for (i = 0; i < nbuf; i++)
- {
- pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType);
- if (!pMultibuffer[i])
- {
- DEALLOCATE_LOCAL (pMultibuffer);
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- pMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
- for (j = 0; j < i; j++)
- if (pMultibuffers[i] == pMultibuffers[j])
- {
- DEALLOCATE_LOCAL (pMultibuffer);
- return BadMatch;
- }
- }
- PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf);
- DEALLOCATE_LOCAL (pMultibuffer);
- return Success;
-}
-
-
-static Bool
-QueueDisplayRequest (client, activateTime)
- ClientPtr client;
- TimeStamp activateTime;
-{
- /* see xtest.c:ProcXTestFakeInput for code similar to this */
-
- if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
- {
- return FALSE;
- }
- /* swap the request back so we can simply re-execute it */
- if (client->swapped)
- {
- register int n;
- REQUEST (xMbufDisplayImageBuffersReq);
-
- SwapRestL(stuff);
- swaps (&stuff->length, n);
- swaps (&stuff->minDelay, n);
- swaps (&stuff->maxDelay, n);
- }
- ResetCurrentRequest (client);
- client->sequence--;
- return TRUE;
-}
-
-
-/*
- * Deliver events to a buffer
- */
-
-static int
-DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
- MultibufferPtr pMultibuffer;
- xEvent *pEvents;
- int count;
- Mask filter;
-{
- int deliveries = 0, nondeliveries = 0;
- int attempt;
- OtherClients *other;
-
- /* if nobody wants the event, we're done */
- if (!((pMultibuffer->otherEventMask|pMultibuffer->eventMask) & filter))
- return 0;
-
- /* maybe send event to owner */
- if ((attempt = TryClientEvents(
- bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
- {
- if (attempt > 0)
- deliveries++;
- else
- nondeliveries--;
- }
-
- /* maybe send event to other clients */
- for (other = pMultibuffer->otherClients; other; other=other->next)
- {
- if ((attempt = TryClientEvents(
- rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
- {
- if (attempt > 0)
- deliveries++;
- else
- nondeliveries--;
- }
- }
- if (deliveries)
- return deliveries;
- return nondeliveries;
-}
-
-/*
- * Send Expose events to interested clients
- */
-
-void
-MultibufferExpose (pMultibuffer, pRegion)
- MultibufferPtr pMultibuffer;
- RegionPtr pRegion;
-{
- if (pRegion && !REGION_NIL(pRegion))
- {
- xEvent *pEvent;
- PixmapPtr pPixmap;
- register xEvent *pe;
- register BoxPtr pBox;
- register int i;
- int numRects;
-
- pPixmap = pMultibuffer->pPixmap;
- REGION_TRANSLATE(pPixmap->drawable.pScreen, pRegion,
- -pPixmap->drawable.x, -pPixmap->drawable.y);
- /* XXX MultibufferExpose "knows" the region representation */
- numRects = REGION_NUM_RECTS(pRegion);
- pBox = REGION_RECTS(pRegion);
-
- pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent));
- if (pEvent) {
- pe = pEvent;
-
- for (i=1; i<=numRects; i++, pe++, pBox++)
- {
- pe->u.u.type = Expose;
- pe->u.expose.window = pPixmap->drawable.id;
- pe->u.expose.x = pBox->x1;
- pe->u.expose.y = pBox->y1;
- pe->u.expose.width = pBox->x2 - pBox->x1;
- pe->u.expose.height = pBox->y2 - pBox->y1;
- pe->u.expose.count = (numRects - i);
- }
- (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
- ExposureMask);
- DEALLOCATE_LOCAL(pEvent);
- }
- }
-}
-
-/* send UpdateNotify event */
-void
-MultibufferUpdate (pMultibuffer, time2)
- MultibufferPtr pMultibuffer;
- CARD32 time2;
-{
- xMbufUpdateNotifyEvent event;
-
- event.type = MultibufferEventBase + MultibufferUpdateNotify;
- event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.timeStamp = time2;
- (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
- 1, (Mask)MultibufferUpdateNotifyMask);
-}
-
-/*
- * The sample implementation will never generate MultibufferClobberNotify
- * events
- */
-
-void
-MultibufferClobber (pMultibuffer)
- MultibufferPtr pMultibuffer;
-{
- xMbufClobberNotifyEvent event;
-
- event.type = MultibufferEventBase + MultibufferClobberNotify;
- event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.state = pMultibuffer->clobber;
- (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
- 1, (Mask)MultibufferClobberNotifyMask);
-}
-
-/*
- * make the resource id for buffer i refer to the window
- * drawable instead of the pixmap;
- */
-
-static void
-AliasMultibuffer (pMultibuffers, i)
- MultibuffersPtr pMultibuffers;
- int i;
-{
- MultibufferPtr pMultibuffer;
-
- if (i == pMultibuffers->displayedMultibuffer)
- return;
- /*
- * remove the old association
- */
- if (pMultibuffers->displayedMultibuffer >= 0)
- {
- pMultibuffer = &pMultibuffers->buffers[pMultibuffers->displayedMultibuffer];
- ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pMultibuffer->pPixmap);
- }
- /*
- * make the new association
- */
- pMultibuffer = &pMultibuffers->buffers[i];
- ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pMultibuffers->pWindow);
- pMultibuffers->displayedMultibuffer = i;
-}
-
-/*
- * free everything associated with multibuffering for this
- * window
- */
-
-void
-DestroyImageBuffers (pWin)
- WindowPtr pWin;
-{
- FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE);
- /* Zero out the window's pointer to the buffers so they won't be reused */
- pWin->devPrivates[MultibufferWindowIndex].ptr = NULL;
-}
-
-/*
- * resize the buffers when the window is resized
- */
-
-static Bool
-MultibufferPositionWindow (pWin, x, y)
- WindowPtr pWin;
- int x, y;
-{
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
- MultibuffersPtr pMultibuffers;
- MultibufferPtr pMultibuffer;
- int width, height;
- int i;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- PixmapPtr pPixmap;
- GCPtr pGC;
- int savewidth, saveheight;
- xRectangle clearRect;
- Bool clear;
-
- pScreen = pWin->drawable.pScreen;
- pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
- (*pMultibufferScreen->PositionWindow) (pWin, x, y);
-
- /* if this window is not multibuffered, we're done */
- if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
- return TRUE;
-
- /* if new size is same as old, we're done */
- if (pMultibuffers->width == pWin->drawable.width &&
- pMultibuffers->height == pWin->drawable.height)
- return TRUE;
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- dx = pWin->drawable.x - pMultibuffers->x;
- dy = pWin->drawable.x - pMultibuffers->y;
- dw = width - pMultibuffers->width;
- dh = height - pMultibuffers->height;
- GravityTranslate (0, 0, -dx, -dy, dw, dh,
- pWin->bitGravity, &destx, &desty);
-
- /* if the window grew, remember to paint the window background,
- * and maybe send expose events, for the new areas of the buffers
- */
- clear = pMultibuffers->width < width || pMultibuffers->height < height ||
- pWin->bitGravity == ForgetGravity;
-
- sourcex = 0;
- sourcey = 0;
- savewidth = pMultibuffers->width;
- saveheight = pMultibuffers->height;
- /* clip rectangle to source and destination */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
- }
- if (destx + savewidth > width)
- savewidth = width - destx;
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
- }
- if (desty + saveheight > height)
- saveheight = height - desty;
-
- pMultibuffers->width = width;
- pMultibuffers->height = height;
- pMultibuffers->x = pWin->drawable.x;
- pMultibuffers->y = pWin->drawable.y;
-
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
- if (clear)
- {
- SetupBackgroundPainter (pWin, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
- for (i = 0; i < pMultibuffers->numMultibuffer; i++)
- {
- pMultibuffer = &pMultibuffers->buffers[i];
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pWin->drawable.depth);
- if (!pPixmap)
- {
- DestroyImageBuffers (pWin);
- break;
- }
- ValidateGC ((DrawablePtr)pPixmap, pGC);
- /*
- * I suppose this could avoid quite a bit of work if
- * it computed the minimal area required.
- */
- if (clear)
- (*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC, 1, &clearRect);
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr)pMultibuffer->pPixmap,
- (DrawablePtr)pPixmap, pGC,
- sourcex, sourcey, savewidth, saveheight,
- destx, desty);
- }
- pPixmap->drawable.id = pMultibuffer->pPixmap->drawable.id;
- (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
- pMultibuffer->pPixmap = pPixmap;
- if (i != pMultibuffers->displayedMultibuffer)
- {
- ChangeResourceValue (pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- return TRUE;
-}
-
-/* Resource delete func for MultibufferDrawableResType */
-/*ARGSUSED*/
-static int
-MultibufferDrawableDelete (value, id)
- pointer value;
- XID id;
-{
- DrawablePtr pDrawable = (DrawablePtr)value;
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- PixmapPtr pPixmap;
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDrawable;
- pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr;
- pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap;
- }
- else
- {
- pPixmap = (PixmapPtr) pDrawable;
- }
- (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
- return Success;
-}
-
-/* Resource delete func for MultibufferResType */
-/*ARGSUSED*/
-static int
-MultibufferDelete (value, id)
- pointer value;
- XID id;
-{
- MultibufferPtr pMultibuffer = (MultibufferPtr)value;
- MultibuffersPtr pMultibuffers;
-
- pMultibuffers = pMultibuffer->pMultibuffers;
- if (--pMultibuffers->refcnt == 0)
- {
- FreeResourceByType (pMultibuffers->pWindow->drawable.id,
- MultibuffersResType, TRUE);
- xfree (pMultibuffers);
- }
- return Success;
-}
-
-/* Resource delete func for MultibuffersResType */
-/*ARGSUSED*/
-static int
-MultibuffersDelete (value, id)
- pointer value;
- XID id;
-{
- MultibuffersPtr pMultibuffers = (MultibuffersPtr)value;
- int i;
-
- if (pMultibuffers->refcnt == pMultibuffers->numMultibuffer)
- {
- for (i = pMultibuffers->numMultibuffer; --i >= 0; )
- FreeResource (pMultibuffers->buffers[i].pPixmap->drawable.id, 0);
- }
- return Success;
-}
-
-/* Resource delete func for OtherClientResType */
-static int
-OtherClientDelete (value, id)
- pointer value;
- XID id;
-{
- MultibufferPtr pMultibuffer = (MultibufferPtr)value;
- register OtherClientsPtr other, prev;
-
- prev = 0;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- {
- if (other->resource == id)
- {
- if (prev)
- prev->next = other->next;
- else
- pMultibuffer->otherClients = other->next;
- xfree (other);
- RecalculateMultibufferOtherEvents (pMultibuffer);
- break;
- }
- prev = other;
- }
- return Success;
-}
-
-static int
-EventSelectForMultibuffer (pMultibuffer, client, mask)
- MultibufferPtr pMultibuffer;
- ClientPtr client;
- Mask mask;
-{
- OtherClientsPtr other;
-
- if (mask & ~ValidEventMasks)
- {
- client->errorValue = mask;
- return BadValue;
- }
- if (bClient (pMultibuffer) == client)
- {
- pMultibuffer->eventMask = mask;
- }
- else /* some other client besides the creator wants events */
- {
- for (other = pMultibuffer->otherClients; other; other = other->next)
- {
- if (SameClient (other, client))
- {
- if (mask == 0)
- {
- FreeResource (other->resource, RT_NONE);
- break;
- }
- other->mask = mask;
- break;
- }
- }
- if (!other)
- { /* new client that never selected events on this buffer before */
- other = (OtherClients *) xalloc (sizeof (OtherClients));
- if (!other)
- return BadAlloc;
- other->mask = mask;
- other->resource = FakeClientID (client->index);
- if (!AddResource (other->resource, OtherClientResType, (pointer) pMultibuffer))
- {
- xfree (other);
- return BadAlloc;
- }
- other->next = pMultibuffer->otherClients;
- pMultibuffer->otherClients = other;
- }
- RecalculateMultibufferOtherEvents (pMultibuffer);
- }
- return (client->noClientException);
-}
-
-/* or together all the otherClients event masks */
-static void
-RecalculateMultibufferOtherEvents (pMultibuffer)
- MultibufferPtr pMultibuffer;
-{
- Mask otherEventMask;
- OtherClients *other;
-
- otherEventMask = 0L;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- otherEventMask |= other->mask;
- pMultibuffer->otherEventMask = otherEventMask;
-}
-
-/* add milliseconds to a timestamp, handling overflow */
-static void
-BumpTimeStamp (ts, inc)
-TimeStamp *ts;
-CARD32 inc;
-{
- CARD32 newms;
-
- newms = ts->milliseconds + inc;
- if (newms < ts->milliseconds)
- ts->months++;
- ts->milliseconds = newms;
-}
diff --git a/nx-X11/programs/Xserver/Xext/mbufbf.c b/nx-X11/programs/Xserver/Xext/mbufbf.c
deleted file mode 100644
index 8585c52d2..000000000
--- a/nx-X11/programs/Xserver/Xext/mbufbf.c
+++ /dev/null
@@ -1,1030 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.5tsi Exp $ */
-/*
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-
-/* $Xorg: mbufbf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#include "validate.h"
-#include <sys/time.h>
-
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#define _MULTIBUF_BUFFER_
-#include <X11/extensions/multibufst.h>
-
-/*
-Support for doublebuffer hardare
-
-This code is designed to support doublebuffer hardware where the
-displayed buffer is selected on a per-pixel basis by an additional bit
-plane, called the select plane. It could probably be easily modified
-to work with systems that use window-id planes.
-
-This is done by creating a new drawable type, DRAWABLE_BUFFER. The
-type has the same exact layout as a window drawable. Your code should
-treat a DRAWABLE_BUFFER the same as it would tread a DRAWABLE_WINDOW
-when handling the gc drawing functions. In addition, PaintWindowBackground,
-CopyWindow, and all of the gc drawing functions to be able to draw into both
-framebuffers. Which framebuffer to draw into is selected by the contents of
- pWin->devPrivates[frameWindowPrivateIndex].
-The content of the devPrivate is either from frameBuffer[0] or
-frameBuffer[1], depending on which buffer is being drawn into. When
- pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[0],
-the functions should draw into the front framebuffer. When
- pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[1],
-the functions should draw into the back framebuffer.
-
-In addition, you need to provide a function that allows you to copy
-bits between the buffers (optional since CopyArea can be used) and a
-function that draws into the select plane. Then, you need to register
-your functions and other information, by calling:
-
-void
-RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
- CopyBufferBitsFunc, DrawSelectPlaneFunc)
- int nInfo;
- xMbufBufferInfo *pInfo;
- DevUnion *frameBuffer;
- DevUnion selectPlane;
-
-"pInfo" is an array indicating which visuals and depths that double
-buffering is supported on. "nInfo" is the length of the array.
-
-"frameBuffer" is array of length 2. The contents of the array element
-is ddx-specific. The content of frameBuffer[0] should, when placed in
-the window private, indicate that framebuffer 0 should be drawn into.
-The contents of frameBuffer[1], when placed into the window private,
-should indicate that framebuffer 1 should be drawn into.
-
-"selectPlane" is ddx-specific. It should contain information
-neccessary for your displayProc to access the select plane.
-It is passed to DrawSelectPlaneFunc.
-
-"CopyBufferBitsFunc" is a ddx-specific function that copies from one
-buffer of a multibuffered window to another buffer. If the CopyBufferBitsFunc
-is NULL, a default function will be used that calls pScreen->CopyArea.
-
- void CopyBufferBitsFunc(pMBWindow, srcBufferNum, dstBufferNum)
- mbufWindowPtr pMBWindow;
- int srcBufferNum, dstBufferNum;
-
-"DrawSelectPlaneFunc" is a ddx-specific function that fills the
-regions "prgn" of select plane with the value "bufferNum". If
-selectPlane is a DrawablePtr (such as a PixmapPtr), you can pass
-NULL for DrawSelectPlaneFunc, a default function will be used that
-calls FillRectangle on the selectPlane.
-
- void DrawSelectPlaneFunc(pScreen, selectPlane, prgn, bufferNum)
- ScreenPtr pScreen;
- DevUnion selectPlane;
- RegionPtr prgn;
- long bufferNum;
-
-...
-...
-...
-
-*/
-
-#define MAX_BUFFERS 2 /* Only supports 2 buffers */
-#define FRONT_BUFFER 0
-#define BACK_BUFFER 1
-
-
-/* Buffer drawables have the same structure as window drawables */
-typedef WindowRec BufferRec;
-typedef WindowPtr BufferPtr;
-
-
-/*
- * Call RegisterHdwrBuffer for every screen that has doublebuffer hardware.
- */
-
-static int bufNumInfo[MAXSCREENS];
-static xMbufBufferInfo *bufInfo[MAXSCREENS];
-static DevUnion *bufFrameBuffer[MAXSCREENS];
-static DevUnion bufselectPlane[MAXSCREENS];
-static void (* bufCopyBufferBitsFunc[MAXSCREENS])();
-static void (* bufDrawSelectPlaneFunc[MAXSCREENS])();
-
-static Bool bufMultibufferInit();
-
-
-void
-RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
- CopyBufferBitsFunc, DrawSelectPlaneFunc)
- ScreenPtr pScreen;
- int nInfo;
- xMbufBufferInfo *pInfo;
- DevUnion *frameBuffer;
- DevUnion selectPlane;
- void (* CopyBufferBitsFunc)();
- void (* DrawSelectPlaneFunc)();
-{
- bufNumInfo[pScreen->myNum] = nInfo;
- bufInfo[pScreen->myNum] = pInfo;
- bufFrameBuffer[pScreen->myNum] = frameBuffer;
- bufselectPlane[pScreen->myNum] = selectPlane;
-
- bufCopyBufferBitsFunc[pScreen->myNum] = CopyBufferBitsFunc;
- bufDrawSelectPlaneFunc[pScreen->myNum] = DrawSelectPlaneFunc;
-
- /* Register ourselves with device-independent multibuffers code */
- RegisterMultibufferInit(pScreen, bufMultibufferInit);
-}
-
-
-/*
- * Called by Multibuffer extension initialization.
- * Initializes mbufScreenRec and its devPrivate.
- */
-
-static Bool NoopDDA_True() { return TRUE; }
-static Bool bufPositionWindow();
-static int bufCreateImageBuffers();
-static void bufDestroyImageBuffers();
-static void bufDisplayImageBuffers();
-static void bufClearImageBufferArea();
-static void bufDestroyBuffer();
-static void bufCopyBufferBits();
-static void bufDrawSelectPlane();
-static void bufWrapScreenFuncs();
-static void bufResetProc();
-
-static void bufPostValidateTree();
-static void bufClipNotify();
-static void bufWindowExposures();
-static Bool bufChangeWindowAttributes();
-static void bufClearToBackground();
-static void bufCopyWindow();
-
-extern WindowPtr *WindowTable;
-
-static Bool
-bufMultibufferInit(pScreen, pMBScreen)
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
-{
- mbufBufferPrivPtr pMBPriv;
- BoxRec box;
-
- /* Multibuffer info */
- pMBScreen->nInfo = bufNumInfo[pScreen->myNum];
- pMBScreen->pInfo = bufInfo[pScreen->myNum];
-
- /* Hooks */
- pMBScreen->CreateImageBuffers = bufCreateImageBuffers;
- pMBScreen->DestroyImageBuffers = bufDestroyImageBuffers;
- pMBScreen->DisplayImageBuffers = bufDisplayImageBuffers;
- pMBScreen->ClearImageBufferArea = bufClearImageBufferArea;
- pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
- pMBScreen->ChangeBufferAttributes = NoopDDA_True;
- pMBScreen->DeleteBufferDrawable = bufDestroyBuffer;
- pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
- pMBScreen->ResetProc = bufResetProc;
- /* Create devPrivate part */
- pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv);
- if (!pMBPriv)
- return (FALSE);
-
- pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
- pMBPriv->frameBuffer = bufFrameBuffer[pScreen->myNum];
- pMBPriv->selectPlane = bufselectPlane[pScreen->myNum];
-
- /*
- * Initializing the subtractRgn to the screen area will ensure that
- * the selectPlane will get cleared on the first PostValidateTree.
- */
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
-
- pMBPriv->rgnChanged = TRUE;
- REGION_INIT(pScreen, &pMBPriv->backBuffer, &box, 1);
- REGION_INIT(pScreen, &pMBPriv->subtractRgn, &box, 1);
- REGION_NULL(pScreen, &pMBPriv->unionRgn);
-
- /* Misc functions */
- pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum];
- pMBPriv->DrawSelectPlane = bufDrawSelectPlaneFunc[pScreen->myNum];
-
- if (!pMBPriv->CopyBufferBits)
- pMBPriv->CopyBufferBits = bufCopyBufferBits;
-
- if (!pMBPriv->DrawSelectPlane)
- pMBPriv->DrawSelectPlane = bufDrawSelectPlane;
-
- /* screen functions */
- pMBPriv->funcsWrapped = 0;
- pMBPriv->inClearToBackground = FALSE;
- pMBPriv->WindowExposures = NULL;
- pMBPriv->CopyWindow = NULL;
- pMBPriv->ClearToBackground = NULL;
- pMBPriv->ClipNotify = NULL;
- pMBPriv->ChangeWindowAttributes = NULL;
-
- /* Start out wrapped to clear select plane */
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
- return TRUE;
-}
-
-static void
-UpdateBufferFromWindow(pBuffer, pWin)
- BufferPtr pBuffer;
- WindowPtr pWin;
-{
- pBuffer->drawable.x = pWin->drawable.x;
- pBuffer->drawable.y = pWin->drawable.y;
- pBuffer->drawable.width = pWin->drawable.width;
- pBuffer->drawable.height = pWin->drawable.height;
-
- pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- /* Update for PaintWindowBackground */
- pBuffer->parent = pWin->parent;
-
- /*
- * Make the borderClip the same as the clipList so
- * NotClippedByChildren comes out with just clipList.
- */
-
- pBuffer->clipList = pWin->clipList;
- pBuffer->borderClip = pWin->clipList;
- pBuffer->winSize = pWin->winSize;
- pBuffer->borderSize = pWin->borderSize;
-
- pBuffer->origin = pWin->origin;
-}
-
-static BufferPtr
-bufCreateBuffer(pScreen, pWin, bufferNum)
- ScreenPtr pScreen;
- WindowPtr pWin;
- int bufferNum;
-{
- mbufBufferPrivPtr pMBPriv;
- DevUnion *devPrivates;
- BufferPtr pBuffer;
- int i;
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- pBuffer = AllocateWindow(pWin->drawable.pScreen);
- if (!pBuffer)
- return (NULL);
-
- /* XXX- Until we know what is needed, copy everything. */
- devPrivates = pBuffer->devPrivates;
- *pBuffer = *pWin;
- pBuffer->devPrivates = devPrivates;
-
- pBuffer->drawable.type = DRAWABLE_BUFFER;
- pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pBuffer->nextSib = NULL;
- pBuffer->prevSib = NULL;
- pBuffer->firstChild = NULL;
- pBuffer->lastChild = NULL;
-
- /* XXX - Worry about backingstore later */
- pBuffer->backStorage = NULL;
- pBuffer->backingStore = NotUseful;
-
- /* XXX - Need to call pScreen->CreateWindow for tile/stipples
- * or should I just copy the devPrivates?
- */
-
- for (i=0; i < pScreen->WindowPrivateLen; i++)
- pBuffer->devPrivates[i] = pWin->devPrivates[i];
-
- pBuffer->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[bufferNum];
-
- return pBuffer;
-}
-
-static void
-bufDestroyBuffer(pDrawable)
- DrawablePtr pDrawable;
-{
- xfree(pDrawable);
-}
-
-/*ARGSUSED*/
-static int
-bufCreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- int i;
-
- pScreen = pWin->drawable.pScreen;
- pMBScreen = MB_SCREEN_PRIV(pScreen);
- pMBWindow = MB_WINDOW_PRIV(pWin);
-
- pMBWindow->devPrivate.ptr = (pointer) REGION_CREATE(pScreen, 0,0);
- if (!pMBWindow->devPrivate.ptr)
- return(0);
- REGION_COPY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr,
- &pWin->clipList);
-
- for (i = 0; i < nbuf; i++)
- {
- pMBBuffer = pMBWindow->buffers + i;
- pMBBuffer->pDrawable = (DrawablePtr) bufCreateBuffer(pScreen,pWin,i);
-
- if (!pMBBuffer->pDrawable)
- break;
-
- if (!AddResource (ids[i], MultibufferDrawableResType,
- (pointer) pMBBuffer->pDrawable))
- {
- bufDestroyBuffer((BufferPtr) pMBBuffer->pDrawable);
- break;
- }
- pMBBuffer->pDrawable->id = ids[i];
-
- /*
- * If window is already mapped, generate exposures and
- * clear the area of the newly buffers.
- */
-
- if ((pWin->realized) && (i != pMBWindow->displayedMultibuffer))
- (* pMBScreen->ClearImageBufferArea)(pMBBuffer, 0,0, 0,0, TRUE);
- }
-
- return i;
-}
-
-static void
-bufDestroyImageBuffers(pWin)
- WindowPtr pWin;
-{
- ScreenPtr pScreen;
- mbufWindowPtr pMBWindow;
-
- pScreen = pWin->drawable.pScreen;
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- /*
- * if the backbuffer is currently being displayed, move the bits
- * to the frontbuffer and display it instead.
- */
-
- if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER))
- {
- (* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER);
- REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer,
- &pMBPriv->backBuffer, &pWin->clipList);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &pWin->clipList, FRONT_BUFFER);
- }
-
- /* Switch window rendering to front buffer */
- pWin->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[FRONT_BUFFER];
-
- REGION_DESTROY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr);
- pMBWindow->devPrivate.ptr = NULL;
- }
-}
-
-/*
- * Can be replaced by pScreen->ClearToBackground if pBuffer->eventMask
- * and wOtherEventsMasks(pBuffer) were setup.
- */
-
-static void
-bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures)
- mbufBufferPtr pMBBuffer;
- short x,y;
- unsigned short w,h;
- Bool generateExposures;
-{
- BoxRec box;
- RegionRec reg;
- RegionPtr pBSReg = NullRegion;
- ScreenPtr pScreen;
- BoxPtr extents;
- int x1, y1, x2, y2;
- BufferPtr pBuffer;
-
- pBuffer = (BufferPtr) pMBBuffer->pDrawable;
- /* compute everything using ints to avoid overflow */
-
- x1 = pBuffer->drawable.x + x;
- y1 = pBuffer->drawable.y + y;
- if (w)
- x2 = x1 + (int) w;
- else
- x2 = x1 + (int) pBuffer->drawable.width - (int) x;
- if (h)
- y2 = y1 + h;
- else
- y2 = y1 + (int) pBuffer->drawable.height - (int) y;
-
- extents = &pBuffer->clipList.extents;
-
- /* clip the resulting rectangle to the window clipList extents. This
- * makes sure that the result will fit in a box, given that the
- * screen is < 32768 on a side.
- */
-
- if (x1 < extents->x1)
- x1 = extents->x1;
- if (x2 > extents->x2)
- x2 = extents->x2;
- if (y1 < extents->y1)
- y1 = extents->y1;
- if (y2 > extents->y2)
- y2 = extents->y2;
-
- if (x2 <= x1 || y2 <= y1)
- {
- x2 = x1 = 0;
- y2 = y1 = 0;
- }
-
- box.x1 = x1;
- box.x2 = x2;
- box.y1 = y1;
- box.y2 = y2;
-
- pScreen = pBuffer->drawable.pScreen;
- REGION_INIT(pScreen, &reg, &box, 1);
- if (pBuffer->backStorage)
- {
- /*
- * If the window has backing-store on, call through the
- * ClearToBackground vector to handle the special semantics
- * (i.e. things backing store is to be cleared out and
- * an Expose event is to be generated for those areas in backing
- * store if generateExposures is TRUE).
- */
- pBSReg = (* pScreen->ClearBackingStore)(pBuffer, x, y, w, h,
- generateExposures);
- }
-
- REGION_INTERSECT(pScreen, &reg, &reg, &pBuffer->clipList);
- if (pBuffer->backgroundState != None)
- (*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
- if (generateExposures)
- MultibufferExpose(pMBBuffer, &reg);
-#ifdef _notdef
- /* XXBS - This is the original miClearToBackground code.
- * WindowExposures needs to be called (or the functionality emulated)
- * in order for backingStore to work, but first, pBuffer->eventMask
- * and wOtherEventsMasks(pBuffer) need to be setup correctly.
- */
-
- if (generateExposures)
- (*pScreen->WindowExposures)(pBuffer, &reg, pBSReg);
- else if (pBuffer->backgroundState != None)
- (*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
-#endif
- REGION_UNINIT(pScreen, &reg);
- if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
-}
-
-static void
-bufWrapScreenFuncs(pScreen)
- ScreenPtr pScreen;
-{
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClipNotify, bufClipNotify);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,WindowExposures,bufWindowExposures);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ChangeWindowAttributes, bufChangeWindowAttributes);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClearToBackground,bufClearToBackground);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,CopyWindow,bufCopyWindow);
-}
-
-static void
-bufResetProc(pScreen)
- ScreenPtr pScreen;
-{
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- /*
- * frameBuffer, selectPlane, and pInfo should be freed by
- * whoever called RegisterDoubleBufferHardware
- */
-
- REGION_UNINIT(pScreen, &pMBPriv->backBuffer);
- REGION_UNINIT(pScreen, &pMBPriv->subtractRgn);
- REGION_UNINIT(pScreen, &pMBPriv->unionRgn);
- xfree(pMBPriv);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Used if CopyBufferBitsFunc is not provided when registering.
- * This should work for everybody since CopyArea needs to support
- * copying between buffers anyway.
- */
-
-static void
-bufCopyBufferBits(pMBWindow, srcBufferNum, dstBufferNum)
- mbufWindowPtr pMBWindow;
- int srcBufferNum, dstBufferNum;
-{
- DrawablePtr pSrcBuffer, pDstBuffer;
- GCPtr pGC;
-
- pSrcBuffer = pMBWindow->buffers[srcBufferNum].pDrawable;
- pDstBuffer = pMBWindow->buffers[dstBufferNum].pDrawable;
-
- pGC = GetScratchGC (pDstBuffer->depth, pDstBuffer->pScreen);
- if (!pGC)
- return;
-
- ValidateGC (pDstBuffer, pGC);
- (* pGC->ops->CopyArea) (pSrcBuffer, pDstBuffer, pGC,
- 0,0, pDstBuffer->width, pDstBuffer->height, 0,0);
- FreeScratchGC (pGC);
-}
-
-/*
- * Used if DrawSelectPlanFunc is not provided for when registering.
- * However, it only works if selectPlane.ptr is a drawable. Also
- * assumes that painting with color 0 selects the front buffer,
- * while color 1 selects the back buffer.
- */
-
-static void
-bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
- ScreenPtr pScreen;
- DevUnion selectPlane;
- RegionPtr prgn;
- long bufferNum;
-{
- DrawablePtr pDrawable;
- GCPtr pGC;
- register int i;
- register BoxPtr pbox;
- register xRectangle *prect;
- int numRects;
- XID value;
-
- if (REGION_NUM_RECTS(prgn) == 0)
- return;
-
- pDrawable = (DrawablePtr) selectPlane.ptr;
- pGC = GetScratchGC (pDrawable->depth, pScreen);
- if (!pGC)
- return;
-
- prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
- sizeof(xRectangle));
- if (!prect)
- {
- FreeScratchGC(pGC);
- return;
- }
-
- value = (XID) bufferNum;
- DoChangeGC(pGC, GCForeground, &value, 0);
- ValidateGC(pDrawable, pGC);
-
- numRects = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
- for (i= numRects; --i >= 0; pbox++, prect++)
- {
- prect->x = pbox->x1;
- prect->y = pbox->y1;
- prect->width = pbox->x2 - pbox->x1;
- prect->height = pbox->y2 - pbox->y1;
- }
- prect -= numRects;
- (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
-
- DEALLOCATE_LOCAL(prect);
- FreeScratchGC (pGC);
-}
-
-
-static void
-bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
- ScreenPtr pScreen;
- mbufBufferPtr *ppMBBuffer;
- mbufWindowPtr *ppMBWindow;
- int nbuf;
-{
- WindowPtr pWin;
- BufferPtr pPrevBuffer, pNewBuffer;
- int i, number;
- mbufBufferPrivPtr pMBPriv;
- mbufBufferPtr pPrevMBBuffer;
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- for (i = 0; i < nbuf; i++)
- {
- number = ppMBBuffer[i]->number; /* 0=frontbuffer, 1=backbuffer */
- pWin = ppMBWindow[i]->pWindow;
- pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
-
- pPrevBuffer = (BufferPtr) pPrevMBBuffer->pDrawable;
- pNewBuffer = (BufferPtr) ppMBBuffer[i]->pDrawable;
-
- if (pPrevBuffer != pNewBuffer)
- {
- RegionPtr backBuffer = &pMBPriv->backBuffer;
-
- /*
- * Update the select plane and the backBuffer region.
- */
-
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &pWin->clipList, number);
-
- if (number == BACK_BUFFER)
- REGION_UNION(pScreen, backBuffer, backBuffer,
- &pWin->clipList);
- else
- REGION_SUBTRACT(pScreen, backBuffer, backBuffer,
- &pWin->clipList);
-
- /* Switch which framebuffer the window draws into */
- pWin->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[number];
- }
-
- switch (ppMBWindow[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
- case MultibufferUpdateActionBackground:
- (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
- (pPrevMBBuffer, 0,0, 0,0, FALSE);
- break;
- case MultibufferUpdateActionUntouched:
- break;
- case MultibufferUpdateActionCopied:
- if (pPrevBuffer != pNewBuffer)
- {
- (* pMBPriv->CopyBufferBits) (ppMBWindow[i],
- ppMBBuffer[i]->number, pPrevMBBuffer->number);
- }
- break;
- }
- }
-}
-
-/* Updates the backBuffer region and paints the selectPlane. */
-
-static void
-bufPostValidateTree(pParent, pChild, kind)
- WindowPtr pParent, pChild;
- VTKind kind;
-{
- ScreenPtr pScreen;
- mbufBufferPrivPtr pMBPriv;
-
- if (pParent)
- pScreen = pParent->drawable.pScreen;
- else if (pChild)
- pScreen = pChild->drawable.pScreen;
- else
- return; /* Hopeless */
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
- if (pScreen->PostValidateTree)
- (* pScreen->PostValidateTree)(pParent, pChild, kind);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
-
- /* Does backBuffer need to change? */
- if (pMBPriv->rgnChanged)
- {
- RegionRec exposed;
- RegionPtr pSubtractRgn, pUnionRgn;
- Bool overlap;
-
- pMBPriv->rgnChanged = FALSE;
-
- pSubtractRgn = &pMBPriv->subtractRgn;
- pUnionRgn = &pMBPriv->unionRgn;
- REGION_VALIDATE(pScreen, pSubtractRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: subtractRgn overlaps");
-#endif
- REGION_VALIDATE(pScreen, pUnionRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: unionRgn overlaps");
-#endif
-
- /* Update backBuffer: subtract must come before union */
- REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pSubtractRgn);
- REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pUnionRgn);
-
- /* Paint gained and lost backbuffer areas in select plane */
- REGION_NULL(pScreen, &exposed);
- REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, FRONT_BUFFER);
-
- REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, BACK_BUFFER);
-
- REGION_UNINIT(pScreen, &exposed);
- REGION_EMPTY(pScreen, pSubtractRgn);
- REGION_EMPTY(pScreen, pUnionRgn);
- }
-}
-
-/*
- * If the window is multibuffered and displaying the backbuffer,
- * add the old clipList to the subtractRgn and add the new clipList
- * to the unionRgn. PostValidateTree will use subtractRgn and unionRgn
- * to update the backBuffer region and the selectPlane.
- *
- * Copy changes to the window structure into the buffers.
- * Send ClobberNotify events.
- */
-
-static void
-bufClipNotify(pWin, dx,dy)
- WindowPtr pWin;
- int dx,dy;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- mbufWindowPtr pMBWindow;
- int i;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify)(pWin, dx,dy);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr;
-
- if (! REGION_EQUAL(pScreen, pOldClipList, &pWin->clipList))
- {
- if (pMBWindow->displayedMultibuffer == BACK_BUFFER)
- {
- pMBPriv->rgnChanged = TRUE;
- REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList);
- REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList);
- }
-
- REGION_COPY(pScreen, pOldClipList,&pWin->clipList);
- }
-
- /* Update buffer x,y,w,h, and clipList */
- for (i=0; i<pMBWindow->numMultibuffer; i++)
- {
- mbufBufferPtr pMBBuffer = pMBWindow->buffers + i;
- if (pMBBuffer->clobber != pWin->visibility)
- {
- pMBBuffer->clobber = pWin->visibility;
- MultibufferClobber(pMBBuffer);
- }
- UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin);
- }
- }
-}
-
-/*
- * Updates buffer's background fields when the window's changes.
- * This is necessary because pScreen->PaintWindowBackground
- * is used to paint the buffer.
- *
- * XXBS - Backingstore state will have be tracked too if it is supported.
- */
-
-static Bool
-bufChangeWindowAttributes(pWin, mask)
- WindowPtr pWin;
- unsigned long mask;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- mbufWindowPtr pMBWindow;
- Bool ret;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
- ret = (* pScreen->ChangeWindowAttributes)(pWin, mask);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- if (mask & (CWBackPixmap | CWBackPixel))
- {
- BufferPtr pBuffer;
- int i;
-
- for (i=0; i<pMBWindow->displayedMultibuffer; i++)
- {
- pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable;
- pBuffer->backgroundState = pWin->backgroundState;
- pBuffer->background = pWin->background;
- }
- }
- }
- return ret;
-}
-
-/*
- * Send exposures and clear the background for a buffer whenever
- * its corresponding window is exposed, except when called by
- * ClearToBackground.
- */
-
-static void
-bufWindowExposures(pWin, prgn, other_exposed)
- WindowPtr pWin;
- register RegionPtr prgn, other_exposed;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- RegionRec tmp_rgn;
- int i;
- Bool handleBuffers;
-
- handleBuffers = (!pMBPriv->inClearToBackground) &&
- (pWin->drawable.type == DRAWABLE_WINDOW) &&
- pMBWindow && (prgn && !REGION_NIL(prgn));
-
- /* miWindowExposures munges prgn and other_exposed. */
- if (handleBuffers)
- {
- REGION_NULL(pScreen, &tmp_rgn);
- REGION_COPY(pScreen, &tmp_rgn, prgn);
- }
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
- (* pScreen->WindowExposures) (pWin, prgn, other_exposed);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
-
- if (!handleBuffers)
- return;
-
- /*
- * Send expose events to all clients. Paint the exposed region for all
- * buffers except the displayed buffer since it is handled when the
- * window is painted.
- *
- * XXBS - Will have to be re-written to handle BackingStore on buffers.
- */
-
- for (i=0; i<pMBWindow->numMultibuffer; i++)
- {
- mbufBufferPtr pMBBuffer;
- BufferPtr pBuffer;
-
- pMBBuffer = pMBWindow->buffers + i;
- pBuffer = (BufferPtr) pMBBuffer->pDrawable;
-
- if (i != pMBWindow->displayedMultibuffer)
- (* pScreen->PaintWindowBackground)(pBuffer,&tmp_rgn,PW_BACKGROUND);
- if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask)
- MultibufferExpose(pMBBuffer, &tmp_rgn);
- }
-
- REGION_UNINIT(pScreen, &tmp_rgn);
-}
-
-/*
- * Set ``inClearToBackground'' so that WindowExposures does not attempt
- * to send expose events or clear the background on the buffers.
- */
-
-static void
-bufClearToBackground(pWin, x,y,w,h, sendExpose)
- WindowPtr pWin;
- int x,y, w,h;
- Bool sendExpose;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- pMBPriv->inClearToBackground = TRUE;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
- (* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
-
- pMBPriv->inClearToBackground = FALSE;
-}
-
-/*
- * Move bits in both buffers. It does this by calling pScreen->CopyWindow
- * twice, once with the root window's devPrivate[frameWindowPrivateIndex]
- * pointing to the frontbuffer pixmap and once with it pointed to the
- * backbuffer pixmap. It does this if there are *any* existing multibuffered
- * window... a possible optimization is to copy the backbuffer only if this
- * window or its inferiors are multibuffered. May be faster, maybe not.
- *
- * XXX - Only works if your CopyWindow checks the root window's devPrivate
- * to see which buffer to draw into. Works for cfbPaintWindow.
- */
-
-/*ARGSUSED*/
-static void
-bufCopyWindow(pWin, ptOldOrg, prgnSrc)
- WindowPtr pWin;
- DDXPointRec ptOldOrg;
- RegionPtr prgnSrc;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- WindowPtr pwinroot;
- DevUnion save;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
-
- pwinroot = WindowTable[pScreen->myNum];
- save = pwinroot->devPrivates[frameWindowPrivateIndex];
-
- /*
- * Copy front buffer
- */
-
- pwinroot->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[FRONT_BUFFER];
- (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
-
- /*
- * Copy back buffer
- */
-
- /* CopyWindow translates prgnSrc... translate it back for 2nd call. */
- REGION_TRANSLATE(pScreen, prgnSrc,
- ptOldOrg.x - pWin->drawable.x,
- ptOldOrg.y - pWin->drawable.y);
- pwinroot->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[BACK_BUFFER];
- (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
-
- pwinroot->devPrivates[frameWindowPrivateIndex] = save;
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
-}
diff --git a/nx-X11/programs/Xserver/Xext/mbufpx.c b/nx-X11/programs/Xserver/Xext/mbufpx.c
deleted file mode 100644
index c986217ee..000000000
--- a/nx-X11/programs/Xserver/Xext/mbufpx.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.3 2001/07/23 13:15:44 dawes Exp $ */
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-/* $Xorg: mbufpx.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#include <sys/time.h>
-
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#define _MULTIBUF_PIXMAP_
-#include <X11/extensions/multibufst.h>
-
-
-static Bool NoopDDA_True() { return TRUE; }
-
-static Bool pixPositionWindow();
-static int pixCreateImageBuffers();
-static void pixDisplayImageBuffers();
-static void pixClearImageBufferArea();
-static void pixDeleteBufferDrawable();
-static void pixWrapScreenFuncs();
-static void pixResetProc();
-
-Bool
-pixMultibufferInit(pScreen, pMBScreen)
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
-{
- int i, j, k;
- xMbufBufferInfo *pInfo;
- int nInfo;
- DepthPtr pDepth;
- mbufPixmapPrivPtr pMBPriv;
-
- pMBScreen->CreateImageBuffers = pixCreateImageBuffers;
- pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA;
- pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers;
- pMBScreen->ClearImageBufferArea = pixClearImageBufferArea;
- pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
- pMBScreen->ChangeBufferAttributes = NoopDDA_True;
- pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable;
- pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs;
- pMBScreen->ResetProc = pixResetProc;
-
- /* Support every depth and visual combination that the screen does */
-
- nInfo = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- nInfo += pDepth->numVids;
- }
-
- pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo));
- if (!pInfo)
- return FALSE;
-
- k = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- for (j = 0; j < pDepth->numVids; j++)
- {
- pInfo[k].visualID = pDepth->vids[j];
- pInfo[k].maxBuffers = 0;
- pInfo[k].depth = pDepth->depth;
- k++;
- }
- }
-
- pMBScreen->nInfo = nInfo;
- pMBScreen->pInfo = pInfo;
-
- /*
- * Setup the devPrivate to mbufScreenRec
- */
-
- pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv));
- if (!pMBPriv)
- {
- xfree(pInfo);
- return (FALSE);
- }
- pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
- pMBPriv->PositionWindow = NULL;
- pMBPriv->funcsWrapped = 0;
-
- return TRUE;
-}
-
-/*ARGSUSED*/
-static int
-pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- ScreenPtr pScreen;
- int width, height, depth;
- int i;
-
- pMBWindow = MB_WINDOW_PRIV(pWin);
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- depth = pWin->drawable.depth;
- pScreen = pWin->drawable.pScreen;
-
- for (i = 0; i < nbuf; i++)
- {
- pMBBuffer = &pMBWindow->buffers[i];
- pMBBuffer->pDrawable = (DrawablePtr)
- (*pScreen->CreatePixmap) (pScreen, width, height, depth);
- if (!pMBBuffer->pDrawable)
- break;
-
- if (!AddResource (ids[i], MultibufferDrawableResType,
- (pointer) pMBBuffer->pDrawable))
- {
- (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
- break;
- }
- pMBBuffer->pDrawable->id = ids[i];
-
- /*
- * In the description of the CreateImageBuffers request:
- * "If the window is mapped, or if these image buffers have
- * backing store, their contents will be tiled with the window
- * background, and zero or more expose events will be generated
- * for each of these buffers."
- */
-
- (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
- (pMBBuffer, 0,0, 0,0, TRUE);
- }
-
- return i;
-}
-
-/*
- * set up the gc to clear the pixmaps;
- */
-static Bool
-SetupBackgroundPainter (pWin, pGC)
- WindowPtr pWin;
- GCPtr pGC;
-{
- XID gcvalues[4];
- int ts_x_origin, ts_y_origin;
- PixUnion background;
- int backgroundState;
- Mask gcmask;
-
- /*
- * First take care of any ParentRelative stuff by altering the
- * tile/stipple origin to match the coordinates of the upper-left
- * corner of the first ancestor without a ParentRelative background.
- * This coordinate is, of course, negative.
- */
-
- ts_x_origin = ts_y_origin = 0;
- while (pWin->backgroundState == ParentRelative) {
- ts_x_origin -= pWin->origin.x;
- ts_y_origin -= pWin->origin.y;
- pWin = pWin->parent;
- }
- backgroundState = pWin->backgroundState;
- background = pWin->background;
-
- switch (backgroundState)
- {
- case BackgroundPixel:
- gcvalues[0] = (XID) background.pixel;
- gcvalues[1] = FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0] = FillTiled;
- gcvalues[1] = (XID) background.pixmap;
- gcvalues[2] = ts_x_origin;
- gcvalues[3] = ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- return FALSE;
- }
- DoChangeGC(pGC, gcmask, gcvalues, TRUE);
- return TRUE;
-}
-
-static void
-MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects)
- WindowPtr pWin;
- DrawablePtr pDrawable;
- int nrects;
- xRectangle *pRects;
-{
- GCPtr pGC;
-
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- if (SetupBackgroundPainter(pWin, pGC))
- {
- ValidateGC(pDrawable, pGC);
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects);
- }
- FreeScratchGC(pGC);
-}
-
-static void
-MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
- WindowPtr pWin;
- DrawablePtr pDrawable;
- RegionPtr pRegion;
-{
- xRectangle *pRects;
- int nrects = REGION_NUM_RECTS(pRegion);
- BoxPtr pbox = REGION_RECTS(pRegion);
-
- pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
- if (pRects)
- {
- int i;
- for (i = 0; i < nrects; i++)
- {
- pRects[i].x = pbox->x1;
- pRects[i].y = pbox->y1;
- pRects[i].width = pbox->x2 - pbox->x1;
- pRects[i].height = pbox->y2 - pbox->y1;
- }
- MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
- DEALLOCATE_LOCAL(pRects);
- }
-}
-
-static void
-pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
- mbufBufferPtr *ppMBBuffer;
- mbufWindowPtr *ppMBWindow;
- int nbuf;
-{
- GCPtr pGC = NULL;
- PixmapPtr pPrevPixmap, pNewPixmap;
- WindowPtr pWin;
- RegionPtr pExposed;
- int i;
- mbufBufferPtr pPrevMBBuffer;
- XID bool;
- xRectangle r;
-
- UpdateCurrentTime ();
- for (i = 0; i < nbuf; i++)
- {
- pWin = ppMBWindow[i]->pWindow;
-
- /* Time to get a different scratch GC? */
-
- if (!pGC
- || pGC->depth != pWin->drawable.depth
- || pGC->pScreen != pWin->drawable.pScreen)
- {
- if (pGC) FreeScratchGC(pGC);
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- }
- pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
- pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable;
- pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable;
-
- if (pPrevPixmap == pNewPixmap)
- {
- /* "If a specified buffer is already displayed, any delays and
- * update action will still be performed for that buffer."
- *
- * We special-case this because applications do occasionally
- * request a redundant DisplayImageBuffers, and we can save
- * strokes by recognizing that the only update action that will
- * change the buffer contents in this case is Background.
- */
- if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground)
- {
- r.x = r.y = 0;
- r.width = pWin->drawable.width;
- r.height = pWin->drawable.height;
- MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin,
- 1, &r);
- }
- }
- else /* different buffer is being displayed */
- {
- /* perform update action */
-
- switch (ppMBWindow[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
-
- case MultibufferUpdateActionBackground:
-
- r.x = r.y = 0;
- r.width = pPrevPixmap->drawable.width;
- r.height = pPrevPixmap->drawable.height;
- MultibufferPaintBackgroundRectangles(pWin,
- (DrawablePtr)pPrevPixmap,
- 1, &r);
- break;
-
- case MultibufferUpdateActionUntouched:
-
- /* copy the window to the pixmap that represents the
- * currently displayed buffer
- */
-
- if (pPrevMBBuffer->eventMask & ExposureMask)
- {
- bool = TRUE;
- DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
- }
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin,
- (DrawablePtr) pPrevPixmap,
- pGC,
- 0, 0,
- pWin->drawable.width,
- pWin->drawable.height,
- 0, 0);
-
- /* if we couldn't copy the whole window to the buffer,
- * send expose events (if any client wants them)
- */
-
- if (pPrevMBBuffer->eventMask & ExposureMask)
- { /* some client wants expose events */
- if (pExposed)
- {
- RegionPtr pWinSize;
- extern RegionPtr CreateUnclippedWinSize();
- ScreenPtr pScreen = pWin->drawable.pScreen;
- pWinSize = CreateUnclippedWinSize (pWin);
- /*
- * pExposed is window-relative, but at this point
- * pWinSize is screen-relative. Make pWinSize be
- * window-relative so that region ops involving
- * pExposed and pWinSize behave sensibly.
- */
- REGION_TRANSLATE(pScreen, pWinSize,
- -pWin->drawable.x,
- -pWin->drawable.y);
- REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
- REGION_DESTROY(pScreen, pWinSize);
- MultibufferExpose (pPrevMBBuffer, pExposed);
- REGION_DESTROY(pScreen, pExposed);
- }
- bool = FALSE;
- DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
- } /* end some client wants expose events */
-
- break; /* end case MultibufferUpdateActionUntouched */
-
- case MultibufferUpdateActionCopied:
-
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
- (DrawablePtr)pPrevPixmap, pGC,
- 0, 0, pWin->drawable.width,
- pWin->drawable.height, 0, 0);
- break;
-
- } /* end switch on update action */
-
- /* display the new buffer */
-
- ValidateGC ((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin,
- pGC, 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- }
-
- ppMBWindow[i]->lastUpdate = currentTime;
- }
-
- if (pGC) FreeScratchGC (pGC);
- return;
-}
-
-/*
- * resize the buffers when the window is resized
- */
-
-static Bool
-pixPositionWindow (pWin, x, y)
- WindowPtr pWin;
- int x, y;
-{
- ScreenPtr pScreen;
- mbufPixmapPrivPtr pMBPriv;
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- int width, height;
- int i;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- PixmapPtr pPixmap;
- GCPtr pGC;
- int savewidth, saveheight;
- Bool clear;
- RegionRec exposedRegion;
- Bool ret;
-
- pScreen = pWin->drawable.pScreen;
- pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
- ret = (* pScreen->PositionWindow) (pWin, x, y);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
-
- if (!(pMBWindow = MB_WINDOW_PRIV(pWin)))
- return ret;
-
- /* if new size is same as old, we're done */
-
- if (pMBWindow->width == pWin->drawable.width &&
- pMBWindow->height == pWin->drawable.height)
- return ret;
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- dx = pWin->drawable.x - pMBWindow->x;
- dy = pWin->drawable.x - pMBWindow->y;
- dw = width - pMBWindow->width;
- dh = height - pMBWindow->height;
- GravityTranslate (0, 0, -dx, -dy, dw, dh,
- pWin->bitGravity, &destx, &desty);
-
- /* if the window grew, remember to paint the window background,
- * and maybe send expose events, for the new areas of the buffers
- */
-
- clear = pMBWindow->width < width || pMBWindow->height < height ||
- pWin->bitGravity == ForgetGravity;
-
- sourcex = 0;
- sourcey = 0;
- savewidth = pMBWindow->width;
- saveheight = pMBWindow->height;
- /* clip rectangle to source and destination */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
- }
- if (destx + savewidth > width)
- savewidth = width - destx;
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
- }
- if (desty + saveheight > height)
- saveheight = height - desty;
-
- pMBWindow->width = width;
- pMBWindow->height = height;
- pMBWindow->x = pWin->drawable.x;
- pMBWindow->y = pWin->drawable.y;
-
- if (clear)
- {
- BoxRec box;
-
- box.x1 = box.y1 = 0;
- box.x2 = width;
- box.y2 = height;
- REGION_INIT(pScreen, &exposedRegion, &box, 1);
- if (pWin->bitGravity != ForgetGravity)
- {
- RegionRec preservedRegion;
- box.x1 = destx;
- box.y1 = desty;
- box.x2 = destx + savewidth;
- box.y2 = desty + saveheight;
- REGION_INIT(pScreen, &preservedRegion, &box, 1);
- REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion);
- REGION_UNINIT(pScreen, &preservedRegion);
- }
-
- } /* end if (clear) */
-
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- /* create buffers with new window size */
-
- for (i = 0; i < pMBWindow->numMultibuffer; i++)
- {
- pMBBuffer = &pMBWindow->buffers[i];
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth);
- if (!pPixmap)
- {
- (* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
- break;
- }
- if (clear)
- {
- MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion);
- MultibufferExpose(pMBBuffer, &exposedRegion);
- }
- if (pWin->bitGravity != ForgetGravity)
- {
- ValidateGC ((DrawablePtr)pPixmap, pGC);
- (*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap,
- pGC,
- sourcex, sourcey, savewidth, saveheight,
- destx, desty);
- }
- pPixmap->drawable.id = pMBBuffer->pDrawable->id;
- (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
- pMBBuffer->pDrawable = (DrawablePtr) pPixmap;
- if (i != pMBWindow->displayedMultibuffer)
- {
- ChangeResourceValue (pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- if (clear)
- REGION_UNINIT(pScreen, &exposedRegion);
- return TRUE;
-}
-
-static void
-pixWrapScreenFuncs(pScreen)
- ScreenPtr pScreen;
-{
- mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
- WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow);
-}
-
-static void
-pixResetProc(pScreen)
- ScreenPtr pScreen;
-{
- mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen);
- mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
-
- xfree(pMBScreen->pInfo);
- xfree(pMBPriv);
-}
-
-static void
-pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures)
- mbufBufferPtr pMBBuffer;
- short x, y;
- unsigned short width, height;
- Bool exposures;
-{
- WindowPtr pWin;
- ScreenPtr pScreen;
- BoxRec box;
- RegionRec region;
- int w_width, w_height;
- DrawablePtr pDrawable;
-
- pWin = pMBBuffer->pMBWindow->pWindow;
- pScreen = pWin->drawable.pScreen;
-
- w_width = pWin->drawable.width;
- w_height = pWin->drawable.height;
-
- box.x1 = x;
- box.y1 = y;
- box.x2 = width ? (box.x1 + width) : w_width;
- box.y2 = height ? (box.y1 + height) : w_height;
-
- if (box.x1 < 0) box.x1 = 0;
- if (box.y1 < 0) box.y1 = 0;
- if (box.x2 > w_width) box.x2 = w_width;
- if (box.y2 > w_height) box.y2 = w_height;
-
- REGION_INIT(pScreen, &region, &box, 1);
-
- if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer)
- pDrawable = (DrawablePtr) pWin;
- else
- pDrawable = pMBBuffer->pDrawable;
-
- MultibufferPaintBackgroundRegion(pWin, pDrawable, &region);
-
- if (exposures)
- MultibufferExpose(pMBBuffer, &region);
-
- REGION_UNINIT(pScreen, &region);
-}
-
-static void
-pixDeleteBufferDrawable(pDrawable)
- DrawablePtr pDrawable;
-{
- (* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable);
-}
diff --git a/nx-X11/programs/Xserver/Xext/mitmisc.c b/nx-X11/programs/Xserver/Xext/mitmisc.c
deleted file mode 100644
index f7b0ee55c..000000000
--- a/nx-X11/programs/Xserver/Xext/mitmisc.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.6 2003/10/28 23:08:43 tsi Exp $ */
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
-
-/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#define _MITMISC_SERVER_
-#include <X11/extensions/mitmiscstr.h>
-#include "modinit.h"
-
-extern Bool permitOldBugs;
-
-#if 0
-static unsigned char MITReqCode;
-#endif
-
-static void MITResetProc(
- ExtensionEntry * /* extEntry */
-);
-
-static DISPATCH_PROC(ProcMITDispatch);
-static DISPATCH_PROC(ProcMITGetBugMode);
-static DISPATCH_PROC(ProcMITSetBugMode);
-static DISPATCH_PROC(SProcMITDispatch);
-static DISPATCH_PROC(SProcMITGetBugMode);
-static DISPATCH_PROC(SProcMITSetBugMode);
-
-void
-MITMiscExtensionInit(INITARGS)
-{
-#if 0
- ExtensionEntry *extEntry;
-
- if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
- ProcMITDispatch, SProcMITDispatch,
- MITResetProc, StandardMinorOpcode)) != 0)
- MITReqCode = (unsigned char)extEntry->base;
-#else
- (void) AddExtension(MITMISCNAME, 0, 0,
- ProcMITDispatch, SProcMITDispatch,
- MITResetProc, StandardMinorOpcode);
-#endif
-}
-
-/*ARGSUSED*/
-static void
-MITResetProc (extEntry)
-ExtensionEntry *extEntry;
-{
-}
-
-static int
-ProcMITSetBugMode(client)
- register ClientPtr client;
-{
- REQUEST(xMITSetBugModeReq);
-
- REQUEST_SIZE_MATCH(xMITSetBugModeReq);
- if ((stuff->onOff != xTrue) && (stuff->onOff != xFalse))
- {
- client->errorValue = stuff->onOff;
- return BadValue;
- }
- permitOldBugs = stuff->onOff;
- return(client->noClientException);
-}
-
-static int
-ProcMITGetBugMode(client)
- register ClientPtr client;
-{
- xMITGetBugModeReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH(xMITGetBugModeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.onOff = permitOldBugs;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
- return(client->noClientException);
-}
-
-static int
-ProcMITDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_MITSetBugMode:
- return ProcMITSetBugMode(client);
- case X_MITGetBugMode:
- return ProcMITGetBugMode(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcMITSetBugMode(client)
- register ClientPtr client;
-{
- register int n;
- REQUEST(xMITSetBugModeReq);
-
- swaps(&stuff->length, n);
- return ProcMITSetBugMode(client);
-}
-
-static int
-SProcMITGetBugMode(client)
- register ClientPtr client;
-{
- register int n;
- REQUEST(xMITGetBugModeReq);
-
- swaps(&stuff->length, n);
- return ProcMITGetBugMode(client);
-}
-
-static int
-SProcMITDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_MITSetBugMode:
- return SProcMITSetBugMode(client);
- case X_MITGetBugMode:
- return SProcMITGetBugMode(client);
- default:
- return BadRequest;
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c
index 33faedc57..e720965d4 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiX.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiX.c
@@ -1,4 +1,3 @@
-/* $Xorg: panoramiX.c,v 1.5 2000/08/17 19:47:57 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +22,6 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.37tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -33,11 +31,10 @@ Equipment Corporation.
#include <dmx-config.h>
#endif
-#define NEED_REPLIES
#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xarch.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
+#include <nx-X11/Xarch.h>
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@@ -50,7 +47,7 @@ Equipment Corporation.
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
-#include <X11/extensions/panoramiXproto.h>
+#include <nx-X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "servermd.h"
@@ -58,8 +55,7 @@ Equipment Corporation.
#ifdef RENDER
#include "picturestr.h"
#endif
-#include "modinit.h"
-
+#include "protocol-versions.h"
#ifdef GLXPROXY
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
@@ -133,7 +129,7 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
static void XineramaChangeGC(GCPtr, unsigned long);
static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
static void XineramaDestroyGC(GCPtr);
-static void XineramaChangeClip(GCPtr, int, pointer, int);
+static void XineramaChangeClip(GCPtr, int, void *, int);
static void XineramaDestroyClip(GCPtr);
static void XineramaCopyClip(GCPtr, GCPtr);
@@ -153,7 +149,7 @@ GCFuncs XineramaGCFuncs = {
static Bool
-XineramaCloseScreen (int i, ScreenPtr pScreen)
+XineramaCloseScreen (ScreenPtr pScreen)
{
PanoramiXScreenPtr pScreenPriv =
(PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
@@ -161,13 +157,13 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateGC = pScreenPriv->CreateGC;
- REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]);
+ RegionUninit(&XineramaScreenRegions[pScreen->myNum]);
if (pScreen->myNum == 0)
- REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
+ RegionUninit(&PanoramiXScreenRegion);
- xfree ((pointer) pScreenPriv);
+ free ((void *) pScreenPriv);
- return (*pScreen->CloseScreen) (i, pScreen);
+ return (*pScreen->CloseScreen) (pScreen);
}
Bool
@@ -308,7 +304,7 @@ static void
XineramaChangeClip (
GCPtr pGC,
int type,
- pointer pvalue,
+ void *pvalue,
int nrects
){
Xinerama_GC_FUNC_PROLOGUE (pGC);
@@ -335,15 +331,15 @@ XineramaDestroyClip(GCPtr pGC)
int
-XineramaDeleteResource(pointer data, XID id)
+XineramaDeleteResource(void * data, XID id)
{
- xfree(data);
+ free(data);
return 1;
}
static Bool
-XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata)
+XineramaFindIDOnAnyScreen(void * resource, XID id, void * privdata)
{
PanoramiXRes *res = (PanoramiXRes*)resource;
int j;
@@ -368,7 +364,7 @@ typedef struct {
static Bool
-XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
+XineramaFindIDByScrnum(void * resource, XID id, void * privdata)
{
PanoramiXRes *res = (PanoramiXRes*)resource;
PanoramiXSearchData *data = (PanoramiXSearchData*)privdata;
@@ -420,7 +416,7 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
{
XineramaConnectionCallbackList *newlist;
- if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
+ if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
return FALSE;
newlist->next = ConnectionCallbackList;
@@ -434,7 +430,7 @@ static void XineramaInitData(ScreenPtr pScreen)
{
int i, w, h;
- REGION_NULL(pScreen, &PanoramiXScreenRegion)
+ RegionNull(&PanoramiXScreenRegion);
for (i = 0; i < PanoramiXNumScreens; i++) {
BoxRec TheBox;
@@ -450,8 +446,8 @@ static void XineramaInitData(ScreenPtr pScreen)
TheBox.y1 = panoramiXdataPtr[i].y;
TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height;
- REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1);
- REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion,
+ RegionInit(&XineramaScreenRegions[i], &TheBox, 1);
+ RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion,
&XineramaScreenRegions[i]);
}
@@ -473,9 +469,9 @@ void XineramaReinitData(ScreenPtr pScreen)
{
int i;
- REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
+ RegionUninit(&PanoramiXScreenRegion);
for (i = 0; i < PanoramiXNumScreens; i++)
- REGION_UNINIT(pScreen, &XineramaScreenRegions[i]);
+ RegionUninit(&XineramaScreenRegions[i]);
XineramaInitData(pScreen);
}
@@ -525,7 +521,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
*/
panoramiXdataPtr = (PanoramiXData *)
- xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
+ calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
BREAK_IF(!panoramiXdataPtr);
BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
@@ -539,9 +535,9 @@ void PanoramiXExtensionInit(int argc, char *argv[])
return;
}
- pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
+ pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
pScreen->devPrivates[PanoramiXScreenIndex].ptr =
- (pointer)pScreenPriv;
+ (void *)pScreenPriv;
if(!pScreenPriv) {
noPanoramiXExtension = TRUE;
return;
@@ -727,10 +723,10 @@ Bool PanoramiXCreateConnectionBlock(void)
connSetupPrefix.length = length >> 2;
- xfree(PanoramiXVisuals);
+ free(PanoramiXVisuals);
for (i = 0; i < PanoramiXNumDepths; i++)
- xfree(PanoramiXDepths[i].vids);
- xfree(PanoramiXDepths);
+ free(PanoramiXDepths[i].vids);
+ free(PanoramiXDepths);
/*
* OK, change some dimensions so it looks as if it were one big screen
@@ -747,12 +743,12 @@ Bool PanoramiXCreateConnectionBlock(void)
root->mmHeight *= height_mult;
while(ConnectionCallbackList) {
- pointer tmp;
+ void *tmp;
- tmp = (pointer)ConnectionCallbackList;
+ tmp = (void *)ConnectionCallbackList;
(*ConnectionCallbackList->func)();
ConnectionCallbackList = ConnectionCallbackList->next;
- xfree(tmp);
+ free(tmp);
}
return TRUE;
@@ -769,16 +765,16 @@ void PanoramiXConsolidate(void)
Bool foundDepth, missingDepth;
if(!PanoramiXVisualTable)
- PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID));
+ PanoramiXVisualTable = calloc(256 * MAXSCREENS, sizeof(XID));
pScreen = screenInfo.screens[0];
pVisual = pScreen->visuals;
pDepth = pScreen->allowedDepths;
PanoramiXNumDepths = 0;
- PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
+ PanoramiXDepths = calloc(pScreen->numDepths,sizeof(DepthRec));
PanoramiXNumVisuals = 0;
- PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
+ PanoramiXVisuals = calloc(pScreen->numVisuals,sizeof(VisualRec));
for (i = 0; i < pScreen->numDepths; i++, pDepth++) {
missingDepth = FALSE;
@@ -805,7 +801,7 @@ void PanoramiXConsolidate(void)
PanoramiXDepths[PanoramiXNumDepths].numVids = 0;
if(pDepth->numVids)
PanoramiXDepths[PanoramiXNumDepths].vids =
- xalloc(sizeof(VisualID) * pDepth->numVids);
+ malloc(sizeof(VisualID) * pDepth->numVids);
else
PanoramiXDepths[PanoramiXNumDepths].vids = NULL;
PanoramiXNumDepths++;
@@ -887,16 +883,16 @@ void PanoramiXConsolidate(void)
}
- root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ root = (PanoramiXRes *) malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
- defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ defmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
- saver = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ saver = (PanoramiXRes *) malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
for (i = 0; i < PanoramiXNumScreens; i++) {
- root->info[i].id = WindowTable[i]->drawable.id;
+ root->info[i].id = screenInfo.screens[i]->root->drawable.id;
root->u.win.class = InputOutput;
root->u.win.root = TRUE;
saver->info[i].id = savedScreenInfo[i].wid;
@@ -927,7 +923,7 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
- Xfree(panoramiXdataPtr);
+ free(panoramiXdataPtr);
}
@@ -936,21 +932,20 @@ ProcPanoramiXQueryVersion (ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
xPanoramiXQueryVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = PANORAMIX_MAJOR_VERSION;
- rep.minorVersion = PANORAMIX_MINOR_VERSION;
+ rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
+ rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), &rep);
return (client->noClientException);
}
@@ -960,7 +955,6 @@ ProcPanoramiXGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
- register int n;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow (stuff->window, client);
@@ -971,11 +965,11 @@ ProcPanoramiXGetState(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.state = !noPanoramiXExtension;
if (client->swapped) {
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swaps (&rep.state, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl ((int* )&rep.state);
}
- WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
+ WriteToClient (client, sizeof (xPanoramiXGetStateReply), &rep);
return client->noClientException;
}
@@ -986,7 +980,6 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
- register int n;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow (stuff->window, client);
@@ -997,11 +990,11 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.ScreenCount = PanoramiXNumScreens;
if (client->swapped) {
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swaps (&rep.ScreenCount, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl ((int* )&rep.ScreenCount);
}
- WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), (char *) &rep);
+ WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), &rep);
return client->noClientException;
}
@@ -1011,7 +1004,6 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
- register int n;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
@@ -1024,12 +1016,12 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
rep.width = panoramiXdataPtr[stuff->screen].width;
rep.height = panoramiXdataPtr[stuff->screen].height;
if (client->swapped) {
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swaps (&rep.width, n);
- swaps (&rep.height, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.width);
+ swapl (&rep.height);
}
- WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
+ WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), &rep);
return client->noClientException;
}
@@ -1045,23 +1037,13 @@ ProcXineramaIsActive(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
-#if 1
- {
- /* The following hack fools clients into thinking that Xinerama
- * is disabled even though it is not. */
- extern Bool PanoramiXExtensionDisabledHack;
- rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
- }
-#else
rep.state = !noPanoramiXExtension;
-#endif
if (client->swapped) {
- register int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.state, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.state);
}
- WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ WriteToClient (client, sizeof (xXineramaIsActiveReply), &rep);
return client->noClientException;
}
@@ -1079,12 +1061,11 @@ ProcXineramaQueryScreens(ClientPtr client)
rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
rep.length = rep.number * sz_XineramaScreenInfo >> 2;
if (client->swapped) {
- register int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.number, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.number);
}
- WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
+ WriteToClient (client, sizeof (xXineramaQueryScreensReply), &rep);
if(!noPanoramiXExtension) {
xXineramaScreenInfo scratch;
@@ -1097,13 +1078,12 @@ ProcXineramaQueryScreens(ClientPtr client)
scratch.height = panoramiXdataPtr[i].height;
if(client->swapped) {
- register int n;
- swaps (&scratch.x_org, n);
- swaps (&scratch.y_org, n);
- swaps (&scratch.width, n);
- swaps (&scratch.height, n);
+ swaps (&scratch.x_org);
+ swaps (&scratch.y_org);
+ swaps (&scratch.width);
+ swaps (&scratch.height);
}
- WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+ WriteToClient (client, sz_XineramaScreenInfo, &scratch);
}
}
@@ -1176,7 +1156,6 @@ XineramaGetImageData(
BoxRec SrcBox, *pbox;
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
DrawablePtr pDraw = pDrawables[0];
- ScreenPtr pScreen = pDraw->pScreen;
char *ScratchMem = NULL;
size = 0;
@@ -1191,15 +1170,15 @@ XineramaGetImageData(
SrcBox.x2 = SrcBox.x1 + width;
SrcBox.y2 = SrcBox.y1 + height;
- REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1);
- REGION_NULL(pScreen, &GrabRegion);
+ RegionInit(&SrcRegion, &SrcBox, 1);
+ RegionNull(&GrabRegion);
depth = (format == XYPixmap) ? 1 : pDraw->depth;
for(i = 0; i < PanoramiXNumScreens; i++) {
pDraw = pDrawables[i];
- inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox);
+ inOut = RegionContainsRect(&XineramaScreenRegions[i],&SrcBox);
if(inOut == rgnIN) {
(*pDraw->pScreen->GetImage)(pDraw,
@@ -1210,13 +1189,13 @@ XineramaGetImageData(
} else if (inOut == rgnOUT)
continue;
- REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion,
+ RegionIntersect(&GrabRegion, &SrcRegion,
&XineramaScreenRegions[i]);
- nbox = REGION_NUM_RECTS(&GrabRegion);
+ nbox = RegionNumRects(&GrabRegion);
if(nbox) {
- pbox = REGION_RECTS(&GrabRegion);
+ pbox = RegionRects(&GrabRegion);
while(nbox--) {
w = pbox->x2 - pbox->x1;
@@ -1226,7 +1205,7 @@ XineramaGetImageData(
if(sizeNeeded > size) {
char *tmpdata = ScratchMem;
- ScratchMem = xrealloc(ScratchMem, sizeNeeded);
+ ScratchMem = realloc(ScratchMem, sizeNeeded);
if(ScratchMem)
size = sizeNeeded;
else {
@@ -1293,16 +1272,16 @@ XineramaGetImageData(
pbox++;
}
- REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion);
- if(!REGION_NOTEMPTY(pScreen, &SrcRegion))
+ RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion);
+ if(!RegionNotEmpty(&SrcRegion))
break;
}
}
if(ScratchMem)
- xfree(ScratchMem);
+ free(ScratchMem);
- REGION_UNINIT(pScreen, &SrcRegion);
- REGION_UNINIT(pScreen, &GrabRegion);
+ RegionUninit(&SrcRegion);
+ RegionUninit(&GrabRegion);
}
diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.h b/nx-X11/programs/Xserver/Xext/panoramiX.h
index 5fa4ed35c..210ba2751 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiX.h
+++ b/nx-X11/programs/Xserver/Xext/panoramiX.h
@@ -1,5 +1,4 @@
/* $TOG: panoramiX.h /main/4 1998/03/17 06:51:02 kaleb $ */
-/* $XdotOrg: xc/programs/Xserver/Xext/panoramiX.h,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
@@ -28,7 +27,6 @@ Equipment Corporation.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/panoramiX.h,v 1.5 2001/01/03 02:54:17 keithp Exp $ */
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
@@ -43,8 +41,8 @@ Equipment Corporation.
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
-#include <X11/extensions/panoramiXext.h>
-#include "gcstruct.h"
+#include <nx-X11/extensions/panoramiXext.h>
+/*#include "gcstruct.h"*/
typedef struct _PanoramiXData {
@@ -89,11 +87,11 @@ typedef struct {
#define FORCE_ROOT(a) { \
int _j; \
for (_j = PanoramiXNumScreens - 1; _j; _j--) \
- if ((a).root == WindowTable[_j]->drawable.id) \
+ if ((a).root == screenInfo.screens[_j]->root->drawable.id) \
break; \
(a).rootX += panoramiXdataPtr[_j].x; \
(a).rootY += panoramiXdataPtr[_j].y; \
- (a).root = WindowTable[0]->drawable.id; \
+ (a).root = screenInfo.screens[0]->root->drawable.id; \
}
#define FORCE_WIN(a) { \
diff --git a/nx-X11/programs/Xserver/Xext/panoramiXSwap.c b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
index e0548df7b..218d83d72 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
@@ -1,4 +1,3 @@
-/* $Xorg: panoramiXSwap.c,v 1.4 2000/08/17 19:47:57 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +22,6 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.9 2003/07/16 01:38:29 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -45,10 +43,10 @@ Equipment Corporation.
#include "pixmapstr.h"
#if 0
#include <sys/workstation.h>
-#include <X11/Xserver/ws.h>
+#include <nx-X11/Xserver/ws.h>
#endif
#include "panoramiX.h"
-#include <X11/extensions/panoramiXproto.h>
+#include <nx-X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "panoramiXh.h"
@@ -57,9 +55,8 @@ static int
SProcPanoramiXQueryVersion (ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
- register int n;
- swaps(&stuff->length,n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
@@ -68,9 +65,8 @@ static int
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
- register int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
return ProcPanoramiXGetState(client);
}
@@ -79,9 +75,8 @@ static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
- register int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
return ProcPanoramiXGetScreenCount(client);
}
@@ -90,9 +85,8 @@ static int
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
- register int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
return ProcPanoramiXGetScreenSize(client);
}
@@ -102,9 +96,8 @@ static int
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
- register int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
@@ -114,9 +107,8 @@ static int
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
- register int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
diff --git a/nx-X11/programs/Xserver/Xext/panoramiXh.h b/nx-X11/programs/Xserver/Xext/panoramiXh.h
index 9da5876fd..6cee650ac 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXh.h
+++ b/nx-X11/programs/Xserver/Xext/panoramiXh.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXh.h,v 1.2 2003/09/13 21:33:03 dawes Exp $ */
/*
* Server dispatcher function replacements
diff --git a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
index 79a5a3290..93626bbeb 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
@@ -1,4 +1,3 @@
-/* $Xorg: panoramiXprocs.c,v 1.5 2000/08/17 19:47:57 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -26,7 +25,6 @@ Equipment Corporation.
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.36tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -34,8 +32,6 @@ Equipment Corporation.
#include <stdio.h>
#include <X11/X.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
#include <X11/Xproto.h>
#include "windowstr.h"
#include "dixfontstr.h"
@@ -93,7 +89,7 @@ int PanoramiXCreateWindow(ClientPtr client)
return BadLength;
if (!(parent = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->parent, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(stuff->class == CopyFromParent)
@@ -107,7 +103,7 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -116,7 +112,7 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -125,12 +121,12 @@ int PanoramiXCreateWindow(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
- if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newWin = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newWin->type = XRT_WINDOW;
@@ -146,7 +142,7 @@ int PanoramiXCreateWindow(ClientPtr client)
orig_visual = stuff->visual;
orig_x = stuff->x;
orig_y = stuff->y;
- parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) ||
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
(stuff->parent == savedScreenInfo[0].wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->wid = newWin->info[j].id;
@@ -170,7 +166,7 @@ int PanoramiXCreateWindow(ClientPtr client)
if (result == Success)
AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
else
- xfree(newWin);
+ free(newWin);
return (result);
}
@@ -194,7 +190,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
return BadLength;
if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if((win->u.win.class == InputOnly) &&
@@ -206,7 +202,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -215,7 +211,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -224,7 +220,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
@@ -253,7 +249,7 @@ int PanoramiXDestroyWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ client, stuff->id, XRT_WINDOW, DixDestroyAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@@ -278,7 +274,7 @@ int PanoramiXDestroySubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ client, stuff->id, XRT_WINDOW, DixDestroyAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@@ -303,7 +299,7 @@ int PanoramiXChangeSaveSet(ClientPtr client)
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_BACKWARD(j) {
@@ -327,16 +323,16 @@ int PanoramiXReparentWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xReparentWindowReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(!(parent = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->parent, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
x = stuff->x;
y = stuff->y;
- parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) ||
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
(stuff->parent == savedScreenInfo[0].wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id;
@@ -362,7 +358,7 @@ int PanoramiXMapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@@ -384,7 +380,7 @@ int PanoramiXMapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@@ -406,7 +402,7 @@ int PanoramiXUnmapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@@ -428,7 +424,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->id, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@@ -459,11 +455,11 @@ int PanoramiXConfigureWindow(ClientPtr client)
/* because we need the parent */
if (!(pWin = (WindowPtr)SecurityLookupIDByType(
- client, stuff->window, RT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, RT_WINDOW, DixWriteAccess)))
return BadWindow;
if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if ((Mask)stuff->mask & CWSibling) {
@@ -471,12 +467,12 @@ int PanoramiXConfigureWindow(ClientPtr client)
sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
if(!(sib = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_WINDOW, SecurityReadAccess)))
+ client, tmp, XRT_WINDOW, DixReadAccess)))
return BadWindow;
}
}
- if(pWin->parent && ((pWin->parent == WindowTable[0]) ||
+ if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
(pWin->parent->drawable.id == savedScreenInfo[0].wid)))
{
if ((Mask)stuff->mask & CWX) {
@@ -516,7 +512,7 @@ int PanoramiXCirculateWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xCirculateWindowReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS_FORWARD(j) {
@@ -540,7 +536,7 @@ int PanoramiXGetGeometry(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.root = WindowTable[0]->drawable.id;
+ rep.root = screenInfo.screens[0]->root->drawable.id;
rep.depth = pDraw->depth;
rep.width = pDraw->width;
rep.height = pDraw->height;
@@ -558,7 +554,7 @@ int PanoramiXGetGeometry(ClientPtr client)
WindowPtr pWin = (WindowPtr)pDraw;
rep.x = pWin->origin.x - wBorderWidth (pWin);
rep.y = pWin->origin.y - wBorderWidth (pWin);
- if((pWin->parent == WindowTable[0]) ||
+ if((pWin->parent == screenInfo.screens[0]->root) ||
(pWin->parent->drawable.id == savedScreenInfo[0].wid))
{
rep.x += panoramiXdataPtr[0].x;
@@ -581,11 +577,11 @@ int PanoramiXTranslateCoords(ClientPtr client)
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
- SecurityReadAccess);
+ DixReadAccess);
if (!pWin)
return(BadWindow);
pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
- SecurityReadAccess);
+ DixReadAccess);
if (!pDst)
return(BadWindow);
rep.type = X_Reply;
@@ -594,7 +590,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
rep.sameScreen = xTrue;
rep.child = None;
- if((pWin == WindowTable[0]) ||
+ if((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == savedScreenInfo[0].wid))
{
x = stuff->srcX - panoramiXdataPtr[0].x;
@@ -621,7 +617,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
* borderSize
*/
&& (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
+ RegionContainsPoint(
wBoundingShape(pWin),
x - pWin->drawable.x,
y - pWin->drawable.y, &box))
@@ -636,7 +632,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
}
rep.dstX = x - pDst->drawable.x;
rep.dstY = y - pDst->drawable.y;
- if((pDst == WindowTable[0]) ||
+ if((pDst == screenInfo.screens[0]->root) ||
(pDst->drawable.id == savedScreenInfo[0].wid))
{
rep.dstX += panoramiXdataPtr[0].x;
@@ -657,10 +653,10 @@ int PanoramiXCreatePixmap(ClientPtr client)
client->errorValue = stuff->pid;
if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
- if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newPix = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@@ -679,7 +675,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
if (result == Success)
AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
else
- xfree(newPix);
+ free(newPix);
return (result);
}
@@ -696,7 +692,7 @@ int PanoramiXFreePixmap(ClientPtr client)
client->errorValue = stuff->id;
if(!(pix = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess)))
+ client, stuff->id, XRT_PIXMAP, DixDestroyAccess)))
return BadPixmap;
FOR_NSCREENS_BACKWARD(j) {
@@ -732,14 +728,14 @@ int PanoramiXCreateGC(ClientPtr client)
return BadLength;
if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -747,7 +743,7 @@ int PanoramiXCreateGC(ClientPtr client)
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -755,12 +751,12 @@ int PanoramiXCreateGC(ClientPtr client)
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
- if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newGC = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newGC->type = XRT_GC;
@@ -784,7 +780,7 @@ int PanoramiXCreateGC(ClientPtr client)
if (result == Success)
AddResource(newGC->info[0].id, XRT_GC, newGC);
else
- xfree(newGC);
+ free(newGC);
return (result);
}
@@ -807,14 +803,14 @@ int PanoramiXChangeGC(ClientPtr client)
return BadLength;
if (!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -822,7 +818,7 @@ int PanoramiXChangeGC(ClientPtr client)
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -830,7 +826,7 @@ int PanoramiXChangeGC(ClientPtr client)
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -861,11 +857,11 @@ int PanoramiXCopyGC(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyGCReq);
if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->srcGC, XRT_GC, SecurityReadAccess)))
+ client, stuff->srcGC, XRT_GC, DixReadAccess)))
return BadGC;
if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->dstGC, XRT_GC, SecurityWriteAccess)))
+ client, stuff->dstGC, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS(j) {
@@ -888,7 +884,7 @@ int PanoramiXSetDashes(ClientPtr client)
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ client, stuff->gc, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@@ -910,7 +906,7 @@ int PanoramiXSetClipRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ client, stuff->gc, XRT_GC, DixWriteAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@@ -932,7 +928,7 @@ int PanoramiXFreeGC(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_GC, SecurityDestroyAccess)))
+ client, stuff->id, XRT_GC, DixDestroyAccess)))
return BadGC;
FOR_NSCREENS_BACKWARD(j) {
@@ -958,7 +954,7 @@ int PanoramiXClearToBackground(ClientPtr client)
REQUEST_SIZE_MATCH(xClearAreaReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->window, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
x = stuff->x;
@@ -1000,13 +996,13 @@ int PanoramiXCopyArea(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyAreaReq);
if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
srcShared = IS_SHARED_PIXMAP(src);
if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
dstShared = IS_SHARED_PIXMAP(dst);
@@ -1015,7 +1011,7 @@ int PanoramiXCopyArea(ClientPtr client)
return (* SavedProcVector[X_CopyArea])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if((dst->type == XRT_WINDOW) && dst->u.win.root)
@@ -1036,7 +1032,7 @@ int PanoramiXCopyArea(ClientPtr client)
VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
- if(!(data = xcalloc(1, stuff->height * pitch)))
+ if(!(data = calloc(1, stuff->height * pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy,
@@ -1049,7 +1045,7 @@ int PanoramiXCopyArea(ClientPtr client)
if(drawables[0]->depth != pDst->depth) {
client->errorValue = stuff->dstDrawable;
- xfree(data);
+ free(data);
return (BadMatch);
}
@@ -1060,7 +1056,7 @@ int PanoramiXCopyArea(ClientPtr client)
if(dstShared) break;
}
- xfree(data);
+ free(data);
result = Success;
} else {
@@ -1084,7 +1080,7 @@ int PanoramiXCopyArea(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) {
SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
- SecurityReadAccess);
+ DixReadAccess);
if ((pDst->pScreen != pSrc->pScreen) ||
(pDst->depth != pSrc->depth)) {
client->errorValue = stuff->dstDrawable;
@@ -1109,21 +1105,21 @@ int PanoramiXCopyArea(ClientPtr client)
RegionRec totalReg;
Bool overlap;
- REGION_NULL(pScreen, &totalReg);
+ RegionNull(&totalReg);
FOR_NSCREENS_BACKWARD(j) {
if(pRgn[j]) {
if(srcIsRoot) {
- REGION_TRANSLATE(pScreen, pRgn[j],
+ RegionTranslate(pRgn[j],
panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
}
- REGION_APPEND(pScreen, &totalReg, pRgn[j]);
- REGION_DESTROY(pScreen, pRgn[j]);
+ RegionAppend(&totalReg, pRgn[j]);
+ RegionDestroy(pRgn[j]);
}
}
- REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ RegionValidate(&totalReg, &overlap);
(*pScreen->SendGraphicsExpose)(
client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
- REGION_UNINIT(pScreen, &totalReg);
+ RegionUninit(&totalReg);
}
result = client->noClientException;
@@ -1148,13 +1144,13 @@ int PanoramiXCopyPlane(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyPlaneReq);
if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
srcShared = IS_SHARED_PIXMAP(src);
if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
dstShared = IS_SHARED_PIXMAP(dst);
@@ -1163,7 +1159,7 @@ int PanoramiXCopyPlane(ClientPtr client)
return (* SavedProcVector[X_CopyPlane])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if((dst->type == XRT_WINDOW) && dst->u.win.root)
@@ -1190,7 +1186,7 @@ int PanoramiXCopyPlane(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
if (stuff->dstDrawable != stuff->srcDrawable) {
SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
- SecurityReadAccess);
+ DixReadAccess);
if (pdstDraw->pScreen != psrcDraw->pScreen) {
client->errorValue = stuff->dstDrawable;
return (BadMatch);
@@ -1220,17 +1216,17 @@ int PanoramiXCopyPlane(ClientPtr client)
RegionRec totalReg;
Bool overlap;
- REGION_NULL(pScreen, &totalReg);
+ RegionNull(&totalReg);
FOR_NSCREENS_BACKWARD(j) {
if(pRgn[j]) {
- REGION_APPEND(pScreen, &totalReg, pRgn[j]);
- REGION_DESTROY(pScreen, pRgn[j]);
+ RegionAppend(&totalReg, pRgn[j]);
+ RegionDestroy(pRgn[j]);
}
}
- REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ RegionValidate(&totalReg, &overlap);
(*pScreen->SendGraphicsExpose)(
client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
- REGION_UNINIT(pScreen, &totalReg);
+ RegionUninit(&totalReg);
}
return (client->noClientException);
@@ -1248,20 +1244,20 @@ int PanoramiXPolyPoint(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyPoint])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) {
- origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+ origPts = (xPoint *) malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@@ -1288,7 +1284,7 @@ int PanoramiXPolyPoint(ClientPtr client)
result = (* SavedProcVector[X_PolyPoint])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origPts);
+ free(origPts);
return (result);
} else
return (client->noClientException);
@@ -1306,20 +1302,20 @@ int PanoramiXPolyLine(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyLine])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){
- origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+ origPts = (xPoint *) malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@@ -1346,7 +1342,7 @@ int PanoramiXPolyLine(ClientPtr client)
result = (* SavedProcVector[X_PolyLine])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origPts);
+ free(origPts);
return (result);
} else
return (client->noClientException);
@@ -1364,14 +1360,14 @@ int PanoramiXPolySegment(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolySegment])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1380,7 +1376,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(nsegs & 4) return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
- origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
+ origSegs = (xSegment *) malloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){
@@ -1407,7 +1403,7 @@ int PanoramiXPolySegment(ClientPtr client)
result = (* SavedProcVector[X_PolySegment])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origSegs);
+ free(origSegs);
return (result);
} else
return (client->noClientException);
@@ -1426,14 +1422,14 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyRectangle])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1442,7 +1438,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(nrects & 4) return BadLength;
nrects >>= 3;
if (nrects > 0){
- origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+ origRecs = (xRectangle *) malloc(nrects * sizeof(xRectangle));
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@@ -1468,7 +1464,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyRectangle])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origRecs);
+ free(origRecs);
return (result);
} else
return (client->noClientException);
@@ -1486,14 +1482,14 @@ int PanoramiXPolyArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyArc])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1502,7 +1498,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0){
- origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ origArcs = (xArc *) malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@@ -1526,7 +1522,7 @@ int PanoramiXPolyArc(ClientPtr client)
result = (* SavedProcVector[X_PolyArc])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origArcs);
+ free(origArcs);
return (result);
} else
return (client->noClientException);
@@ -1544,21 +1540,21 @@ int PanoramiXFillPoly(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_FillPoly])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){
- locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
+ locPts = (DDXPointPtr) malloc(count * sizeof(DDXPointRec));
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){
@@ -1585,7 +1581,7 @@ int PanoramiXFillPoly(ClientPtr client)
result = (* SavedProcVector[X_FillPoly])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(locPts);
+ free(locPts);
return (result);
} else
return (client->noClientException);
@@ -1603,14 +1599,14 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillRectangle])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1619,7 +1615,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(things & 4) return BadLength;
things >>= 3;
if (things > 0){
- origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
+ origRects = (xRectangle *) malloc(things * sizeof(xRectangle));
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@@ -1644,7 +1640,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyFillRectangle])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origRects);
+ free(origRects);
return (result);
} else
return (client->noClientException);
@@ -1662,14 +1658,14 @@ int PanoramiXPolyFillArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillArc])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1678,7 +1674,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
IF_RETURN((narcs % sizeof(xArc)), BadLength);
narcs /= sizeof(xArc);
if (narcs > 0) {
- origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ origArcs = (xArc *) malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@@ -1703,7 +1699,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
result = (* SavedProcVector[X_PolyFillArc])(client);
if(result != Success) break;
}
- DEALLOCATE_LOCAL(origArcs);
+ free(origArcs);
return (result);
} else
return (client->noClientException);
@@ -1720,14 +1716,14 @@ int PanoramiXPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PutImage])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1771,7 +1767,7 @@ int PanoramiXGetImage(ClientPtr client)
}
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(draw->type == XRT_PIXMAP)
@@ -1844,7 +1840,7 @@ int PanoramiXGetImage(ClientPtr client)
linesPerBuf = h;
}
length = linesPerBuf * widthBytesLine;
- if(!(pBuf = xalloc(length)))
+ if(!(pBuf = malloc(length)))
return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
@@ -1863,7 +1859,7 @@ int PanoramiXGetImage(ClientPtr client)
XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
format, planemask, pBuf, widthBytesLine, isRoot);
- (void)WriteToClient(client,
+ WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
linesDone += nlines;
@@ -1881,7 +1877,7 @@ int PanoramiXGetImage(ClientPtr client)
nlines, format, plane, pBuf,
widthBytesLine, isRoot);
- (void)WriteToClient(client,
+ WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
@@ -1890,7 +1886,7 @@ int PanoramiXGetImage(ClientPtr client)
}
}
}
- xfree(pBuf);
+ free(pBuf);
return (client->noClientException);
}
@@ -1911,14 +1907,14 @@ PanoramiXPolyText8(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText8])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1950,14 +1946,14 @@ PanoramiXPolyText16(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText16])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1989,14 +1985,14 @@ int PanoramiXImageText8(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText8])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -2028,14 +2024,14 @@ int PanoramiXImageText16(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText16])(client);
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -2066,13 +2062,13 @@ int PanoramiXCreateColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreateColormapReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow;
if(!stuff->visual || (stuff->visual > 255))
return BadValue;
- if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newCmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@@ -2092,7 +2088,7 @@ int PanoramiXCreateColormap(ClientPtr client)
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
else
- xfree(newCmap);
+ free(newCmap);
return (result);
}
@@ -2109,7 +2105,7 @@ int PanoramiXFreeColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess)))
+ client, stuff->id, XRT_COLORMAP, DixDestroyAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@@ -2138,10 +2134,10 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
client, stuff->srcCmap, XRT_COLORMAP,
- SecurityReadAccess | SecurityWriteAccess)))
+ DixReadAccess | DixWriteAccess)))
return BadColor;
- if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newCmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@@ -2159,7 +2155,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
else
- xfree(newCmap);
+ free(newCmap);
return (result);
}
@@ -2176,7 +2172,7 @@ int PanoramiXInstallColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ client, stuff->id, XRT_COLORMAP, DixReadAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2199,7 +2195,7 @@ int PanoramiXUninstallColormap(ClientPtr client)
client->errorValue = stuff->id;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ client, stuff->id, XRT_COLORMAP, DixReadAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@@ -2222,7 +2218,7 @@ int PanoramiXAllocColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2245,7 +2241,7 @@ int PanoramiXAllocNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2268,7 +2264,7 @@ int PanoramiXAllocColorCells(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2291,7 +2287,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2315,7 +2311,7 @@ int PanoramiXFreeColors(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j) {
@@ -2337,7 +2333,7 @@ int PanoramiXStoreColors(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
@@ -2360,7 +2356,7 @@ int PanoramiXStoreNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ client, stuff->cmap, XRT_COLORMAP, DixWriteAccess)))
return BadColor;
FOR_NSCREENS_BACKWARD(j){
diff --git a/nx-X11/programs/Xserver/Xext/panoramiXsrv.h b/nx-X11/programs/Xserver/Xext/panoramiXsrv.h
index dc3b3d805..91c41b4e3 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXsrv.h
+++ b/nx-X11/programs/Xserver/Xext/panoramiXsrv.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.8 2001/08/01 00:44:44 tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -22,7 +21,7 @@ extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID);
extern WindowPtr PanoramiXChangeWindow(int, WindowPtr);
extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
-extern int XineramaDeleteResource(pointer, XID);
+extern int XineramaDeleteResource(void *, XID);
extern void XineramaReinitData(ScreenPtr);
diff --git a/nx-X11/programs/Xserver/Xext/sampleEVI.c b/nx-X11/programs/Xserver/Xext/sampleEVI.c
deleted file mode 100644
index 500a585c9..000000000
--- a/nx-X11/programs/Xserver/Xext/sampleEVI.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Xorg: sampleEVI.c,v 1.3 2000/08/17 19:47:58 cpqbld Exp $ */
-/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-/* $XFree86$ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#include "EVIstruct.h"
-#include "scrnintstr.h"
-
-#if HAVE_STDINT_H
-#include <stdint.h>
-#elif !defined(UINT32_MAX)
-#define UINT32_MAX 0xffffffffU
-#endif
-
-static int sampleGetVisualInfo(
- VisualID32 *visual,
- int n_visual,
- xExtendedVisualInfo **evi_rn,
- int *n_info_rn,
- VisualID32 **conflict_rn,
- int *n_conflict_rn)
-{
- unsigned int max_sz_evi;
- VisualID32 *temp_conflict;
- xExtendedVisualInfo *evi;
- unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
- register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
-
- if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
- return BadAlloc;
- max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
-
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- if (screenInfo.screens[scrI]->numVisuals > max_visuals)
- max_visuals = screenInfo.screens[scrI]->numVisuals;
- }
-
- if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
- * max_visuals))
- return BadAlloc;
- max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
-
- *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
- if (!*evi_rn)
- return BadAlloc;
-
- temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
- if (!temp_conflict) {
- xfree(*evi_rn);
- return BadAlloc;
- }
-
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- for (visualI = 0; visualI < n_visual; visualI++) {
- evi[sz_evi].core_visual_id = visual[visualI];
- evi[sz_evi].screen = scrI;
- evi[sz_evi].level = 0;
- evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
- evi[sz_evi].transparency_value = 0;
- evi[sz_evi].min_hw_colormaps = 1;
- evi[sz_evi].max_hw_colormaps = 1;
- evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
- for (conflictI = 0; conflictI < n_conflict; conflictI++)
- temp_conflict[sz_conflict++] = visual[visualI];
- sz_evi++;
- }
- }
- *conflict_rn = temp_conflict;
- *n_conflict_rn = sz_conflict;
- *n_info_rn = sz_evi;
- return Success;
-}
-
-static void sampleFreeVisualInfo(
- xExtendedVisualInfo *evi,
- VisualID32 *conflict)
-{
- if (evi)
- xfree(evi);
- if (conflict)
- xfree(conflict);
-}
-
-EviPrivPtr eviDDXInit(void)
-{
- static EviPrivRec eviPriv;
- eviPriv.getVisualInfo = sampleGetVisualInfo;
- eviPriv.freeVisualInfo = sampleFreeVisualInfo;
- return &eviPriv;
-}
-
-void eviDDXReset(void)
-{
-}
diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c
index 14b0d2751..066dffed0 100644
--- a/nx-X11/programs/Xserver/Xext/saver.c
+++ b/nx-X11/programs/Xserver/Xext/saver.c
@@ -1,4 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/saver.c,v 1.10 2005/07/03 08:53:36 daniels Exp $ */
/*
* $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $
*
@@ -28,16 +27,13 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
-/* $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.7 2003/10/28 23:08:43 tsi Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@@ -47,7 +43,7 @@ in this Software without prior written authorization from the X Consortium.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
-#include <X11/extensions/saverproto.h>
+#include <nx-X11/extensions/saverproto.h>
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
@@ -57,13 +53,9 @@ in this Software without prior written authorization from the X Consortium.
#endif
-#ifdef IN_MODULE
-#include <xf86_ansic.h>
-#else
#include <stdio.h>
-#endif
-#include "modinit.h"
+#include "protocol-versions.h"
#if 0
static unsigned char ScreenSaverReqCode = 0;
@@ -139,7 +131,7 @@ typedef struct _ScreenSaverEvent {
} ScreenSaverEventRec;
static int ScreenSaverFreeEvents(
- pointer /* value */,
+ void * /* value */,
XID /* id */
);
@@ -179,7 +171,7 @@ typedef struct _ScreenSaverAttr {
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
static int ScreenSaverFreeAttr (
- pointer /* value */,
+ void * /* value */,
XID /* id */
);
@@ -213,10 +205,10 @@ MakeScreenPrivate (
static int ScreenPrivateIndex;
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
-#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
+#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (void *) v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
-#define New(t) ((t *) xalloc (sizeof (t)))
+#define New(t) ((t *) malloc (sizeof (t)))
/****************
* ScreenSaverExtensionInit
@@ -227,7 +219,7 @@ static int ScreenPrivateIndex;
****************/
void
-ScreenSaverExtensionInit(INITARGS)
+ScreenSaverExtensionInit(void)
{
ExtensionEntry *extEntry;
int i;
@@ -272,7 +264,7 @@ CheckScreenPrivate (pScreen)
if (!pPriv->attr && !pPriv->events &&
!pPriv->hasWindow && pPriv->installedMap == None)
{
- xfree (pPriv);
+ free (pPriv);
SetScreenPrivate (pScreen, NULL);
savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
}
@@ -338,7 +330,7 @@ setEventMask (pScreen, client, mask)
{
FreeResource (pEv->resource, EventType);
*pPrev = pEv->next;
- xfree (pEv);
+ free (pEv);
CheckScreenPrivate (pScreen);
}
else
@@ -356,7 +348,7 @@ setEventMask (pScreen, client, mask)
pEv->client = client;
pEv->screen = pScreen;
pEv->resource = FakeClientID (client->index);
- if (!AddResource (pEv->resource, EventType, (pointer) pEv))
+ if (!AddResource (pEv->resource, EventType, (void *) pEv))
return FALSE;
}
pEv->mask = mask;
@@ -384,13 +376,13 @@ FreeScreenAttr (pAttr)
ScreenSaverAttrPtr pAttr;
{
FreeAttrs (pAttr);
- xfree (pAttr->values);
- xfree (pAttr);
+ free (pAttr->values);
+ free (pAttr);
}
static int
ScreenSaverFreeEvents (value, id)
- pointer value;
+ void * value;
XID id;
{
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr)value;
@@ -406,14 +398,14 @@ ScreenSaverFreeEvents (value, id)
if (!pEv)
return TRUE;
*pPrev = pEv->next;
- xfree (pEv);
+ free (pEv);
CheckScreenPrivate (pScreen);
return TRUE;
}
static int
ScreenSaverFreeAttr (value, id)
- pointer value;
+ void * value;
XID id;
{
ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr)value;
@@ -445,7 +437,6 @@ SendScreenSaverNotify (pScreen, state, forced)
ScreenSaverEventPtr pEv;
unsigned long mask;
xScreenSaverNotifyEvent ev;
- ClientPtr client;
int kind;
UpdateCurrentTimeIf ();
@@ -464,20 +455,16 @@ SendScreenSaverNotify (pScreen, state, forced)
kind = ScreenSaverInternal;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
{
- client = pEv->client;
- if (client->clientGone)
- continue;
if (!(pEv->mask & mask))
continue;
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
ev.state = state;
- ev.sequenceNumber = client->sequence;
ev.timestamp = currentTime.milliseconds;
- ev.root = WindowTable[pScreen->myNum]->drawable.id;
+ ev.root = pScreen->root->drawable.id;
ev.window = savedScreenInfo[pScreen->myNum].wid;
ev.kind = kind;
ev.forced = forced;
- WriteEventsToClient (client, 1, (xEvent *) &ev);
+ WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
}
}
@@ -488,9 +475,9 @@ SScreenSaverNotifyEvent (from, to)
to->type = from->type;
to->state = from->state;
cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->root, to->root);
- cpswapl (from->window, to->window);
+ cpswapl (from->timestamp, to->timestamp);
+ cpswapl (from->root, to->root);
+ cpswapl (from->window, to->window);
to->kind = from->kind;
to->forced = from->forced;
}
@@ -549,7 +536,7 @@ CreateSaverWindow (pScreen)
if (GrabInProgress && GrabInProgress != pAttr->client->index)
return FALSE;
- pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum],
+ pWin = CreateWindow (pSaver->wid, pScreen->root,
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
pAttr->borderWidth, pAttr->class,
pAttr->mask, (XID *)pAttr->values,
@@ -608,7 +595,7 @@ CreateSaverWindow (pScreen)
wantMap = wColormap (pWin);
if (wantMap == None)
return TRUE;
- installedMaps = (Colormap *) ALLOCATE_LOCAL (pScreen->maxInstalledCmaps *
+ installedMaps = (Colormap *) malloc (pScreen->maxInstalledCmaps *
sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps);
@@ -616,7 +603,7 @@ CreateSaverWindow (pScreen)
if (installedMaps[i] == wantMap)
break;
- DEALLOCATE_LOCAL ((char *) installedMaps);
+ free ((char *) installedMaps);
if (i < numInstalled)
return TRUE;
@@ -693,19 +680,18 @@ ProcScreenSaverQueryVersion (client)
register ClientPtr client;
{
xScreenSaverQueryVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = ScreenSaverMajorVersion;
- rep.minorVersion = ScreenSaverMinorVersion;
+ rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), &rep);
return (client->noClientException);
}
@@ -715,7 +701,6 @@ ProcScreenSaverQueryInfo (client)
{
REQUEST(xScreenSaverQueryInfoReq);
xScreenSaverQueryInfoReply rep;
- register int n;
ScreenSaverStuffPtr pSaver;
DrawablePtr pDraw;
CARD32 lastInput;
@@ -770,14 +755,14 @@ ProcScreenSaverQueryInfo (client)
rep.kind = ScreenSaverInternal;
if (client->swapped)
{
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.window, n);
- swapl (&rep.tilOrSince, n);
- swapl (&rep.idle, n);
- swapl (&rep.eventMask, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.window);
+ swapl (&rep.tilOrSince);
+ swapl (&rep.idle);
+ swapl (&rep.eventMask);
}
- WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), &rep);
return (client->noClientException);
}
@@ -830,7 +815,7 @@ ScreenSaverSetAttributes (ClientPtr client)
if (!pDraw)
return BadDrawable;
pScreen = pDraw->pScreen;
- pParent = WindowTable[pScreen->myNum];
+ pParent = pScreen->root;
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
if (Ones(stuff->mask) != len)
@@ -937,7 +922,7 @@ ScreenSaverSetAttributes (ClientPtr client)
goto bail;
}
/* over allocate for override redirect */
- values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long));
+ values = (unsigned long *) malloc ((len + 1) * sizeof (unsigned long));
if (!values)
{
ret = BadAlloc;
@@ -1163,15 +1148,15 @@ ScreenSaverSetAttributes (ClientPtr client)
FreeScreenAttr (pPriv->attr);
pPriv->attr = pAttr;
pAttr->resource = FakeClientID (client->index);
- if (!AddResource (pAttr->resource, AttrType, (pointer) pAttr))
+ if (!AddResource (pAttr->resource, AttrType, (void *) pAttr))
return BadAlloc;
return Success;
PatchUp:
FreeAttrs (pAttr);
bail:
CheckScreenPrivate (pScreen);
- if (pAttr) xfree (pAttr->values);
- xfree (pAttr);
+ if (pAttr) free (pAttr->values);
+ free (pAttr);
return ret;
}
@@ -1214,7 +1199,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
@@ -1226,7 +1211,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -1236,7 +1221,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ client, tmp, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
}
}
@@ -1246,7 +1231,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
- client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ client, tmp, XRT_COLORMAP, DixReadAccess)))
return BadColor;
}
}
@@ -1286,7 +1271,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
int i;
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
for(i = PanoramiXNumScreens - 1; i > 0; i--) {
@@ -1327,9 +1312,8 @@ SProcScreenSaverQueryVersion (client)
ClientPtr client;
{
REQUEST(xScreenSaverQueryVersionReq);
- int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
return ProcScreenSaverQueryVersion (client);
}
@@ -1339,11 +1323,10 @@ SProcScreenSaverQueryInfo (client)
ClientPtr client;
{
REQUEST(xScreenSaverQueryInfoReq);
- int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
- swapl (&stuff->drawable, n);
+ swapl (&stuff->drawable);
return ProcScreenSaverQueryInfo (client);
}
@@ -1352,12 +1335,11 @@ SProcScreenSaverSelectInput (client)
ClientPtr client;
{
REQUEST(xScreenSaverSelectInputReq);
- int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
- swapl (&stuff->drawable, n);
- swapl (&stuff->eventMask, n);
+ swapl (&stuff->drawable);
+ swapl (&stuff->eventMask);
return ProcScreenSaverSelectInput (client);
}
@@ -1366,18 +1348,17 @@ SProcScreenSaverSetAttributes (client)
ClientPtr client;
{
REQUEST(xScreenSaverSetAttributesReq);
- int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
- swapl (&stuff->drawable, n);
- swaps (&stuff->x, n);
- swaps (&stuff->y, n);
- swaps (&stuff->width, n);
- swaps (&stuff->height, n);
- swaps (&stuff->borderWidth, n);
- swapl (&stuff->visualID, n);
- swapl (&stuff->mask, n);
+ swapl (&stuff->drawable);
+ swaps (&stuff->x);
+ swaps (&stuff->y);
+ swaps (&stuff->width);
+ swaps (&stuff->height);
+ swaps (&stuff->borderWidth);
+ swapl (&stuff->visualID);
+ swapl (&stuff->mask);
SwapRestL(stuff);
return ProcScreenSaverSetAttributes (client);
}
@@ -1387,11 +1368,10 @@ SProcScreenSaverUnsetAttributes (client)
ClientPtr client;
{
REQUEST(xScreenSaverUnsetAttributesReq);
- int n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
- swapl (&stuff->drawable, n);
+ swapl (&stuff->drawable);
return ProcScreenSaverUnsetAttributes (client);
}
diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c
index 2139425b4..2a7d5628f 100644
--- a/nx-X11/programs/Xserver/Xext/security.c
+++ b/nx-X11/programs/Xserver/Xext/security.c
@@ -1,5 +1,28 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/security.c,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
-/* $Xorg: security.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* nx-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE which comes in the source */
+/* distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
/*
Copyright 1996, 1998 The Open Group
@@ -25,24 +48,6 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.16tsi Exp $ */
-
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NX-X11, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -56,20 +61,13 @@ in this Software without prior written authorization from The Open Group.
#include "gcstruct.h"
#include "colormapst.h"
#include "propertyst.h"
+#include "protocol-versions.h"
#define _SECURITY_SERVER
-#include <X11/extensions/securstr.h>
+#include <nx-X11/extensions/securstr.h>
#include <assert.h>
#include <stdarg.h>
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <X11/extensions/XLbx.h>
-extern unsigned char LbxReqCode;
-#endif
-#ifdef XAPPGROUP
-#include <X11/extensions/Xagsrv.h>
-#endif
#include <stdio.h> /* for file reading operations */
-#include <X11/Xatom.h> /* for XA_STRING */
+#include <nx-X11/Xatom.h> /* for XA_STRING */
#ifdef NXAGENT_SERVER
@@ -86,12 +84,12 @@ extern unsigned char LbxReqCode;
#ifdef NXAGENT_SERVER
-#define NX_ALTERNATIVEPOLICYFILE "/usr/lib/xserver/SecurityPolicy"
+#define NX_ALTERNATIVEPOLICYFILE "/usr/local/share/nx/SecurityPolicy"
#endif
#if defined(WIN32) || defined(__CYGWIN__)
-#include <X11/Xos.h>
+#include <nx-X11/Xos.h>
#undef index
#endif
@@ -114,8 +112,6 @@ static char _NXPolicyFilePath[1024];
#endif
-#include "modinit.h"
-
static int SecurityErrorBase; /* first Security error number */
static int SecurityEventBase; /* first Security event number */
@@ -150,7 +146,7 @@ int (*SwappedUntrustedProcVector[256])(
* try a set of well known paths.
*/
-const char *_NXGetPolicyFilePath(const char *path)
+char *_NXGetPolicyFilePath(const char *path)
{
struct stat SecurityPolicyStat;
@@ -288,7 +284,7 @@ SecurityAudit(char *format, ...)
static int
SecurityDeleteAuthorization(
- pointer value,
+ void * value,
XID id)
{
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
@@ -316,16 +312,10 @@ SecurityDeleteAuthorization(
while ((pEventClient = pAuth->eventClients))
{
/* send revocation event event */
- ClientPtr client = rClient(pEventClient);
-
- if (!client->clientGone)
- {
- xSecurityAuthorizationRevokedEvent are;
- are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.sequenceNumber = client->sequence;
- are.authId = pAuth->id;
- WriteEventsToClient(client, 1, (xEvent *)&are);
- }
+ xSecurityAuthorizationRevokedEvent are;
+ are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
+ are.authId = pAuth->id;
+ WriteEventsToClient(rClient(pEventClient), 1, (xEvent *)&are);
FreeResource(pEventClient->resource, RT_NONE);
}
@@ -338,7 +328,7 @@ SecurityDeleteAuthorization(
}
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
- xfree(pAuth);
+ free(pAuth);
return Success;
} /* SecurityDeleteAuthorization */
@@ -347,7 +337,7 @@ SecurityDeleteAuthorization(
/* resource delete function for RTEventClient */
static int
SecurityDeleteAuthorizationEventClient(
- pointer value,
+ void * value,
XID id)
{
OtherClientsPtr pEventClient, prev = NULL;
@@ -363,7 +353,7 @@ SecurityDeleteAuthorizationEventClient(
prev->next = pEventClient->next;
else
pAuth->eventClients = pEventClient->next;
- xfree(pEventClient);
+ free(pEventClient);
return(Success);
}
prev = pEventClient;
@@ -432,7 +422,7 @@ static CARD32
SecurityAuthorizationExpired(
OsTimerPtr timer,
CARD32 time,
- pointer pval)
+ void * pval)
{
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval;
@@ -494,17 +484,16 @@ ProcSecurityQueryVersion(
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
- rep.majorVersion = SECURITY_MAJOR_VERSION;
- rep.minorVersion = SECURITY_MINOR_VERSION;
+ rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
if(client->swapped)
{
- register char n;
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
- (char *)&rep);
+ WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
+ &rep);
return (client->noClientException);
} /* ProcSecurityQueryVersion */
@@ -531,16 +520,16 @@ SecurityEventSelectForAuthorization(
}
}
- pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
+ pEventClient = (OtherClients *) malloc(sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
pEventClient->resource = FakeClientID(client->index);
pEventClient->next = pAuth->eventClients;
if (!AddResource(pEventClient->resource, RTEventClient,
- (pointer)pAuth))
+ (void *)pAuth))
{
- xfree(pEventClient);
+ free(pEventClient);
return BadAlloc;
}
pAuth->eventClients = pEventClient;
@@ -624,7 +613,7 @@ ProcSecurityGenerateAuthorization(
SecurityValidateGroupInfoRec vgi;
vgi.group = group;
vgi.valid = FALSE;
- CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi);
+ CallCallbacks(&SecurityValidateGroupCallback, (void *)&vgi);
/* if nobody said they recognized it, it's an error */
@@ -669,7 +658,7 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */
- pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
+ pAuth = (SecurityAuthorizationPtr)malloc(sizeof(SecurityAuthorizationRec));
if (!pAuth)
{
err = BadAlloc;
@@ -716,15 +705,14 @@ ProcSecurityGenerateAuthorization(
if (client->swapped)
{
- register char n;
- swapl(&rep.length, n);
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.authId, n);
- swaps(&rep.dataLength, n);
+ swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.authId);
+ swaps(&rep.dataLength);
}
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
- (char *)&rep);
+ &rep);
WriteToClient(client, authdata_len, pAuthdata);
SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
@@ -741,7 +729,7 @@ bailout:
if (removeAuth)
RemoveAuthorization(stuff->nbytesAuthProto, protoname,
authdata_len, pAuthdata);
- if (pAuth) xfree(pAuth);
+ if (pAuth) free(pAuth);
return err;
} /* ProcSecurityGenerateAuthorization */
@@ -762,7 +750,7 @@ ProcSecurityRevokeAuthorization(
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
- stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess);
+ stuff->authId, SecurityAuthorizationResType, DixDestroyAccess);
if (!pAuth)
return SecurityErrorBase + XSecurityBadAuthorization;
@@ -795,12 +783,11 @@ SProcSecurityQueryVersion(
ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion,n);
+ swaps(&stuff->majorVersion);
+ swaps(&stuff->minorVersion);
return ProcSecurityQueryVersion(client);
} /* SProcSecurityQueryVersion */
@@ -810,16 +797,15 @@ SProcSecurityGenerateAuthorization(
ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
- register char n;
CARD32 *values;
unsigned long nvalues;
int values_offset;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- swaps(&stuff->nbytesAuthProto, n);
- swaps(&stuff->nbytesAuthData, n);
- swapl(&stuff->valueMask, n);
+ swaps(&stuff->nbytesAuthProto);
+ swaps(&stuff->nbytesAuthData);
+ swapl(&stuff->valueMask);
values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
((stuff->nbytesAuthData + (unsigned)3) >> 2);
if (values_offset >
@@ -837,11 +823,10 @@ SProcSecurityRevokeAuthorization(
ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
- swapl(&stuff->authId, n);
+ swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
} /* SProcSecurityRevokeAuthorization */
@@ -1065,7 +1050,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
* resource access.
*/
-static pointer
+static void *
SecurityAuditResourceIDAccess(
ClientPtr client,
XID id)
@@ -1081,7 +1066,7 @@ SecurityAuditResourceIDAccess(
xChangePropertyReq *req =
(xChangePropertyReq *)client->requestBuffer;
int propertyatom = req->property;
- char *propertyname = NameForAtom(propertyatom);
+ const char *propertyname = NameForAtom(propertyatom);
SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n",
client->index, reqtype, id, propertyname, cid);
@@ -1119,18 +1104,18 @@ SecurityAuditResourceIDAccess(
* Disallowed resource accesses are audited.
*/
-static pointer
+static void *
SecurityCheckResourceIDAccess(
ClientPtr client,
XID id,
RESTYPE rtype,
Mask access_mode,
- pointer rval)
+ void * rval)
{
int cid = CLIENT_ID(id);
int reqtype = ((xReq *)client->requestBuffer)->reqType;
- if (SecurityUnknownAccess == access_mode)
+ if (DixUnknownAccess == access_mode)
return rval; /* for compatibility, we have to allow access */
switch (reqtype)
@@ -1165,10 +1150,6 @@ SecurityCheckResourceIDAccess(
* use app groups. dpw
*/
if (client->trustLevel == clients[cid]->trustLevel
-#ifdef XAPPGROUP
- || (RT_COLORMAP == rtype &&
- XagDefaultColormap (client) == (Colormap) id)
-#endif
)
return rval;
else
@@ -1231,18 +1212,6 @@ SecurityCheckResourceIDAccess(
default:
{
-#ifdef LBX
- /* XXX really need per extension dispatching */
- if (reqtype == LbxReqCode) {
- switch (((xReq *)client->requestBuffer)->data) {
- case X_LbxGetProperty:
- case X_LbxChangeProperty:
- return rval;
- default:
- break;
- }
- }
-#endif
/* others not allowed */
return SecurityAuditResourceIDAccess(client, id);
}
@@ -1288,8 +1257,8 @@ SecurityCheckResourceIDAccess(
static void
SecurityClientStateCallback(
CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata)
+ void * nulldata,
+ void * calldata)
{
NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
ClientPtr client = pci->client;
@@ -1343,22 +1312,6 @@ SecurityClientStateCallback(
}
} /* SecurityClientStateCallback */
-#ifdef LBX
-Bool
-SecuritySameLevel(client, authId)
- ClientPtr client;
- XID authId;
-{
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- return client->trustLevel == pAuth->trustLevel;
- return client->trustLevel == XSecurityClientTrusted;
-}
-#endif
-
/* SecurityCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
@@ -1390,7 +1343,6 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
unsigned int format;
char * pBuf;
{
- ScreenPtr pScreen = pDraw->pScreen;
RegionRec imageRegion; /* region representing x,y,w,h */
RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
@@ -1400,12 +1352,12 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
imageBox.y1 = y;
imageBox.x2 = x + w;
imageBox.y2 = y + h;
- REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
- REGION_NULL(pScreen, &censorRegion);
+ RegionInit(&imageRegion, &imageBox, 1);
+ RegionNull(&censorRegion);
/* censorRegion = imageRegion - visibleRegion */
- REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
- nRects = REGION_NUM_RECTS(&censorRegion);
+ RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
+ nRects = RegionNumRects(&censorRegion);
if (nRects > 0)
{ /* we have something to censor */
GCPtr pScratchGC = NULL;
@@ -1419,13 +1371,13 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
/* convert region to list-of-rectangles for PolyFillRect */
- pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
+ pRects = (xRectangle *)malloc(nRects * sizeof(xRectangle *));
if (!pRects)
{
failed = TRUE;
goto failSafe;
}
- for (pBox = REGION_RECTS(&censorRegion), i = 0;
+ for (pBox = RegionRects(&censorRegion), i = 0;
i < nRects;
i++, pBox++)
{
@@ -1445,7 +1397,7 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
- widthBytesLine, (pointer)pBuf);
+ widthBytesLine, (void *)pBuf);
if (!pPix)
{
failed = TRUE;
@@ -1471,12 +1423,12 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
*/
bzero(pBuf, (int)(widthBytesLine * h));
}
- if (pRects) DEALLOCATE_LOCAL(pRects);
+ if (pRects) free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}
- REGION_UNINIT(pScreen, &imageRegion);
- REGION_UNINIT(pScreen, &censorRegion);
+ RegionUninit(&imageRegion);
+ RegionUninit(&censorRegion);
} /* SecurityCensorImage */
/**********************************************************************/
@@ -1525,15 +1477,11 @@ SecurityFreePropertyAccessList(void)
{
PropertyAccessPtr freeit = PropertyAccessList;
PropertyAccessList = PropertyAccessList->next;
- xfree(freeit);
+ free(freeit);
}
} /* SecurityFreePropertyAccessList */
-#ifndef __UNIXOS2__
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
-#else
-#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
-#endif
static char *
SecuritySkipWhitespace(
@@ -1682,14 +1630,14 @@ SecurityParsePropertyAccessRule(
*/
if (mustHaveValue)
size += strlen(mustHaveValue) + 1;
- pacl = (PropertyAccessPtr)Xalloc(size);
+ pacl = (PropertyAccessPtr)malloc(size);
if (!pacl)
return FALSE;
pacl->name = MakeAtom(propname, strlen(propname), TRUE);
if (pacl->name == BAD_RESOURCE)
{
- Xfree(pacl);
+ free(pacl);
return FALSE;
}
if (mustHaveProperty)
@@ -1698,7 +1646,7 @@ SecurityParsePropertyAccessRule(
strlen(mustHaveProperty), TRUE);
if (pacl->mustHaveProperty == BAD_RESOURCE)
{
- Xfree(pacl);
+ free(pacl);
return FALSE;
}
}
@@ -1755,15 +1703,15 @@ SecurityParseSitePolicy(
if (!policyStr)
return FALSE;
- copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1);
+ copyPolicyStr = (char *)malloc(strlen(policyStr) + 1);
if (!copyPolicyStr)
return TRUE;
strcpy(copyPolicyStr, policyStr);
- newStrings = (char **)Xrealloc(SecurityPolicyStrings,
+ newStrings = (char **)realloc(SecurityPolicyStrings,
sizeof (char *) * (nSecurityPolicyStrings + 1));
if (!newStrings)
{
- Xfree(copyPolicyStr);
+ free(copyPolicyStr);
return TRUE;
}
@@ -1791,9 +1739,9 @@ SecurityFreeSitePolicyStrings(void)
assert(nSecurityPolicyStrings);
while (nSecurityPolicyStrings--)
{
- Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]);
+ free(SecurityPolicyStrings[nSecurityPolicyStrings]);
}
- Xfree(SecurityPolicyStrings);
+ free(SecurityPolicyStrings);
SecurityPolicyStrings = NULL;
nSecurityPolicyStrings = 0;
}
@@ -1822,8 +1770,6 @@ SecurityLoadPropertyAccessList(void)
#endif
-#ifndef __UNIXOS2__
-
#ifdef NXAGENT_SERVER
f = Fopen(_NXGetPolicyFilePath(SecurityPolicyFile), "r");
@@ -1834,20 +1780,6 @@ SecurityLoadPropertyAccessList(void)
#endif
-#else
-
-#ifdef NXAGENT_SERVER
-
- f = Fopen((char*)__XOS2RedirRoot( _NXGetPolicyFilePath(SecurityPolicyFile)), "r");
-
-#else
-
- f = Fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
-
-#endif
-
-#endif
-
if (!f)
{
#ifdef NXAGENT_SERVER
@@ -2119,11 +2051,11 @@ SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
* executed a continue, which will skip the follwing code.
*/
action = SecurityAllowOperation;
- if (access_mode & SecurityReadAccess)
+ if (access_mode & DixReadAccess)
action = max(action, pacl->readAction);
- if (access_mode & SecurityWriteAccess)
+ if (access_mode & DixWriteAccess)
action = max(action, pacl->writeAction);
- if (access_mode & SecurityDestroyAccess)
+ if (access_mode & DixDestroyAccess)
action = max(action, pacl->destroyAction);
break;
} /* end for each pacl */
@@ -2191,7 +2123,7 @@ XSecurityOptions(argc, argv, i)
*/
void
-SecurityExtensionInit(INITARGS)
+SecurityExtensionInit(void)
{
ExtensionEntry *extEntry;
int i;
diff --git a/nx-X11/programs/Xserver/Xext/security.c.NX.original b/nx-X11/programs/Xserver/Xext/security.c.NX.original
deleted file mode 100644
index 2139425b4..000000000
--- a/nx-X11/programs/Xserver/Xext/security.c.NX.original
+++ /dev/null
@@ -1,2245 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/security.c,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
-/* $Xorg: security.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.16tsi Exp $ */
-
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NX-X11, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "windowstr.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#define _SECURITY_SERVER
-#include <X11/extensions/securstr.h>
-#include <assert.h>
-#include <stdarg.h>
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <X11/extensions/XLbx.h>
-extern unsigned char LbxReqCode;
-#endif
-#ifdef XAPPGROUP
-#include <X11/extensions/Xagsrv.h>
-#endif
-#include <stdio.h> /* for file reading operations */
-#include <X11/Xatom.h> /* for XA_STRING */
-
-#ifdef NXAGENT_SERVER
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#endif
-
-#ifndef DEFAULTPOLICYFILE
-# define DEFAULTPOLICYFILE NULL
-#endif
-
-#ifdef NXAGENT_SERVER
-
-#define NX_ALTERNATIVEPOLICYFILE "/usr/lib/xserver/SecurityPolicy"
-
-#endif
-
-#if defined(WIN32) || defined(__CYGWIN__)
-#include <X11/Xos.h>
-#undef index
-#endif
-
-/*
- * Set here the required NX log level.
- */
-
-#ifdef NXAGENT_SERVER
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#endif
-
-#ifdef NXAGENT_SERVER
-
-static char _NXPolicyFilePath[1024];
-
-#endif
-
-#include "modinit.h"
-
-static int SecurityErrorBase; /* first Security error number */
-static int SecurityEventBase; /* first Security event number */
-
-CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */
-
-RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
-
-static RESTYPE RTEventClient;
-
-/* Proc vectors for untrusted clients, swapped and unswapped versions.
- * These are the same as the normal proc vectors except that extensions
- * that haven't declared themselves secure will have ProcBadRequest plugged
- * in for their major opcode dispatcher. This prevents untrusted clients
- * from guessing extension major opcodes and using the extension even though
- * the extension can't be listed or queried.
- */
-int (*UntrustedProcVector[256])(
- ClientPtr /*client*/
-);
-int (*SwappedUntrustedProcVector[256])(
- ClientPtr /*client*/
-);
-
-#ifdef NXAGENT_SERVER
-
-/*
- * This function returns the SecurityPolicy
- * file full path. This path is referred by
- * SecurityPolicyFile variable (generally it
- * contains the hardcoded path at compile time).
- * If the path does not exist, the function will
- * try a set of well known paths.
- */
-
-const char *_NXGetPolicyFilePath(const char *path)
-{
-
- struct stat SecurityPolicyStat;
-
- /*
- * Check the policy file path only once.
- */
-
- if (*_NXPolicyFilePath != '\0')
- {
- return _NXPolicyFilePath;
- }
-
- if (stat(path, &SecurityPolicyStat) == 0)
- {
- if (strlen(path) + 1 > 1024)
- {
- #ifdef WARNING
- fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
- #endif
-
- goto _NXGetPolicyFilePathError;
- }
-
- strcpy(_NXPolicyFilePath, path);
-
- #ifdef TEST
- fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
- _NXPolicyFilePath);
- #endif
-
- return _NXPolicyFilePath;
- }
-
- if (stat(DEFAULTPOLICYFILE, &SecurityPolicyStat) == 0)
- {
- if (strlen(DEFAULTPOLICYFILE) + 1 > 1024)
- {
- #ifdef WARNING
- fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
- #endif
-
- goto _NXGetPolicyFilePathError;
- }
-
- strcpy(_NXPolicyFilePath, DEFAULTPOLICYFILE);
-
- #ifdef TEST
- fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
- _NXPolicyFilePath);
- #endif
-
- return _NXPolicyFilePath;
- }
-
- if (stat(NX_ALTERNATIVEPOLICYFILE, &SecurityPolicyStat) == 0)
- {
- if (strlen(NX_ALTERNATIVEPOLICYFILE) + 1 > 1024)
- {
- #ifdef WARNING
- fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
- #endif
-
- goto _NXGetPolicyFilePathError;
- }
-
- strcpy(_NXPolicyFilePath, NX_ALTERNATIVEPOLICYFILE);
-
- #ifdef TEST
- fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
- _NXPolicyFilePath);
- #endif
-
- return _NXPolicyFilePath;
- }
-
-_NXGetPolicyFilePathError:
-
- if (strlen(path) + 1 > 1024)
- {
- #ifdef WARNING
- fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file exceeded.\n");
- #endif
- }
-
- strcpy(_NXPolicyFilePath, path);
-
- #ifdef TEST
- fprintf(stderr, "_NXGetPolicyFilePath: Using default SecurityPolicy file path [%s].\n",
- _NXPolicyFilePath);
- #endif
-
- return _NXPolicyFilePath;
-}
-
-#endif
-
-/* SecurityAudit
- *
- * Arguments:
- * format is the formatting string to be used to interpret the
- * remaining arguments.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Writes the message to the log file if security logging is on.
- */
-
-void
-SecurityAudit(char *format, ...)
-{
- va_list args;
-
- if (auditTrailLevel < SECURITY_AUDIT_LEVEL)
- return;
- va_start(args, format);
- VAuditF(format, args);
- va_end(args);
-} /* SecurityAudit */
-
-#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-
-/* SecurityDeleteAuthorization
- *
- * Arguments:
- * value is the authorization to delete.
- * id is its resource ID.
- *
- * Returns: Success.
- *
- * Side Effects:
- * Frees everything associated with the authorization.
- */
-
-static int
-SecurityDeleteAuthorization(
- pointer value,
- XID id)
-{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
- unsigned short name_len, data_len;
- char *name, *data;
- int status;
- int i;
- OtherClientsPtr pEventClient;
-
- /* Remove the auth using the os layer auth manager */
-
- status = AuthorizationFromID(pAuth->id, &name_len, &name,
- &data_len, &data);
- assert(status);
- status = RemoveAuthorization(name_len, name, data_len, data);
- assert(status);
- (void)status;
-
- /* free the auth timer if there is one */
-
- if (pAuth->timer) TimerFree(pAuth->timer);
-
- /* send revoke events */
-
- while ((pEventClient = pAuth->eventClients))
- {
- /* send revocation event event */
- ClientPtr client = rClient(pEventClient);
-
- if (!client->clientGone)
- {
- xSecurityAuthorizationRevokedEvent are;
- are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.sequenceNumber = client->sequence;
- are.authId = pAuth->id;
- WriteEventsToClient(client, 1, (xEvent *)&are);
- }
- FreeResource(pEventClient->resource, RT_NONE);
- }
-
- /* kill all clients using this auth */
-
- for (i = 1; i<currentMaxClients; i++)
- {
- if (clients[i] && (clients[i]->authId == pAuth->id))
- CloseDownClient(clients[i]);
- }
-
- SecurityAudit("revoked authorization ID %d\n", pAuth->id);
- xfree(pAuth);
- return Success;
-
-} /* SecurityDeleteAuthorization */
-
-
-/* resource delete function for RTEventClient */
-static int
-SecurityDeleteAuthorizationEventClient(
- pointer value,
- XID id)
-{
- OtherClientsPtr pEventClient, prev = NULL;
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
-
- for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (pEventClient->resource == id)
- {
- if (prev)
- prev->next = pEventClient->next;
- else
- pAuth->eventClients = pEventClient->next;
- xfree(pEventClient);
- return(Success);
- }
- prev = pEventClient;
- }
- /*NOTREACHED*/
- return -1; /* make compiler happy */
-} /* SecurityDeleteAuthorizationEventClient */
-
-
-/* SecurityComputeAuthorizationTimeout
- *
- * Arguments:
- * pAuth is the authorization for which we are computing the timeout
- * seconds is the number of seconds we want to wait
- *
- * Returns:
- * the number of milliseconds that the auth timer should be set to
- *
- * Side Effects:
- * Sets pAuth->secondsRemaining to any "overflow" amount of time
- * that didn't fit in 32 bits worth of milliseconds
- */
-
-static CARD32
-SecurityComputeAuthorizationTimeout(
- SecurityAuthorizationPtr pAuth,
- unsigned int seconds)
-{
- /* maxSecs is the number of full seconds that can be expressed in
- * 32 bits worth of milliseconds
- */
- CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND;
-
- if (seconds > maxSecs)
- { /* only come here if we want to wait more than 49 days */
- pAuth->secondsRemaining = seconds - maxSecs;
- return maxSecs * MILLI_PER_SECOND;
- }
- else
- { /* by far the common case */
- pAuth->secondsRemaining = 0;
- return seconds * MILLI_PER_SECOND;
- }
-} /* SecurityStartAuthorizationTimer */
-
-/* SecurityAuthorizationExpired
- *
- * This function is passed as an argument to TimerSet and gets called from
- * the timer manager in the os layer when its time is up.
- *
- * Arguments:
- * timer is the timer for this authorization.
- * time is the current time.
- * pval is the authorization whose time is up.
- *
- * Returns:
- * A new time delay in milliseconds if the timer should wait some
- * more, else zero.
- *
- * Side Effects:
- * Frees the authorization resource if the timeout period is really
- * over, otherwise recomputes pAuth->secondsRemaining.
- */
-
-static CARD32
-SecurityAuthorizationExpired(
- OsTimerPtr timer,
- CARD32 time,
- pointer pval)
-{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval;
-
- assert(pAuth->timer == timer);
-
- if (pAuth->secondsRemaining)
- {
- return SecurityComputeAuthorizationTimeout(pAuth,
- pAuth->secondsRemaining);
- }
- else
- {
- FreeResource(pAuth->id, RT_NONE);
- return 0;
- }
-} /* SecurityAuthorizationExpired */
-
-/* SecurityStartAuthorizationTimer
- *
- * Arguments:
- * pAuth is the authorization whose timer should be started.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * A timer is started, set to expire after the timeout period for
- * this authorization. When it expires, the function
- * SecurityAuthorizationExpired will be called.
- */
-
-static void
-SecurityStartAuthorizationTimer(
- SecurityAuthorizationPtr pAuth)
-{
- pAuth->timer = TimerSet(pAuth->timer, 0,
- SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
- SecurityAuthorizationExpired, pAuth);
-} /* SecurityStartAuthorizationTimer */
-
-
-/* Proc functions all take a client argument, execute the request in
- * client->requestBuffer, and return a protocol error status.
- */
-
-static int
-ProcSecurityQueryVersion(
- ClientPtr client)
-{
- /* REQUEST(xSecurityQueryVersionReq); */
- xSecurityQueryVersionReply rep;
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SECURITY_MAJOR_VERSION;
- rep.minorVersion = SECURITY_MINOR_VERSION;
- if(client->swapped)
- {
- register char n;
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
- (char *)&rep);
- return (client->noClientException);
-} /* ProcSecurityQueryVersion */
-
-
-static int
-SecurityEventSelectForAuthorization(
- SecurityAuthorizationPtr pAuth,
- ClientPtr client,
- Mask mask)
-{
- OtherClients *pEventClient;
-
- for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (SameClient(pEventClient, client))
- {
- if (mask == 0)
- FreeResource(pEventClient->resource, RT_NONE);
- else
- pEventClient->mask = mask;
- return Success;
- }
- }
-
- pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
- if (!pEventClient)
- return BadAlloc;
- pEventClient->mask = mask;
- pEventClient->resource = FakeClientID(client->index);
- pEventClient->next = pAuth->eventClients;
- if (!AddResource(pEventClient->resource, RTEventClient,
- (pointer)pAuth))
- {
- xfree(pEventClient);
- return BadAlloc;
- }
- pAuth->eventClients = pEventClient;
-
- return Success;
-} /* SecurityEventSelectForAuthorization */
-
-
-static int
-ProcSecurityGenerateAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityGenerateAuthorizationReq);
- int len; /* request length in CARD32s*/
- Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
- SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
- int err; /* error to return from this function */
- XID authId; /* authorization ID assigned by os layer */
- xSecurityGenerateAuthorizationReply rep; /* reply struct */
- unsigned int trustLevel; /* trust level of new auth */
- XID group; /* group of new auth */
- CARD32 timeout; /* timeout of new auth */
- CARD32 *values; /* list of supplied attributes */
- char *protoname; /* auth proto name sent in request */
- char *protodata; /* auth proto data sent in request */
- unsigned int authdata_len; /* # bytes of generated auth data */
- char *pAuthdata; /* generated auth data */
- Mask eventMask; /* what events on this auth does client want */
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- /* check request length */
-
- REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2;
- len += (stuff->nbytesAuthProto + (unsigned)3) >> 2;
- len += (stuff->nbytesAuthData + (unsigned)3) >> 2;
- values = ((CARD32 *)stuff) + len;
- len += Ones(stuff->valueMask);
- if (client->req_len != len)
- return BadLength;
-
- /* check valuemask */
- if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
- {
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
-
- /* check timeout */
- timeout = 60;
- if (stuff->valueMask & XSecurityTimeout)
- {
- timeout = *values++;
- }
-
- /* check trustLevel */
- trustLevel = XSecurityClientUntrusted;
- if (stuff->valueMask & XSecurityTrustLevel)
- {
- trustLevel = *values++;
- if (trustLevel != XSecurityClientTrusted &&
- trustLevel != XSecurityClientUntrusted)
- {
- client->errorValue = trustLevel;
- return BadValue;
- }
- }
-
- /* check group */
- group = None;
- if (stuff->valueMask & XSecurityGroup)
- {
- group = *values++;
- if (SecurityValidateGroupCallback)
- {
- SecurityValidateGroupInfoRec vgi;
- vgi.group = group;
- vgi.valid = FALSE;
- CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi);
-
- /* if nobody said they recognized it, it's an error */
-
- if (!vgi.valid)
- {
- client->errorValue = group;
- return BadValue;
- }
- }
- }
-
- /* check event mask */
- eventMask = 0;
- if (stuff->valueMask & XSecurityEventMask)
- {
- eventMask = *values++;
- if (eventMask & ~XSecurityAllEventMasks)
- {
- client->errorValue = eventMask;
- return BadValue;
- }
- }
-
- protoname = (char *)&stuff[1];
- protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2);
-
- /* call os layer to generate the authorization */
-
- authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
- stuff->nbytesAuthData, protodata,
- &authdata_len, &pAuthdata);
- if ((XID) ~0L == authId)
- {
- err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
- goto bailout;
- }
-
- /* now that we've added the auth, remember to remove it if we have to
- * abort the request for some reason (like allocation failure)
- */
- removeAuth = TRUE;
-
- /* associate additional information with this auth ID */
-
- pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
- if (!pAuth)
- {
- err = BadAlloc;
- goto bailout;
- }
-
- /* fill in the auth fields */
-
- pAuth->id = authId;
- pAuth->timeout = timeout;
- pAuth->group = group;
- pAuth->trustLevel = trustLevel;
- pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */
- pAuth->secondsRemaining = 0;
- pAuth->timer = NULL;
- pAuth->eventClients = NULL;
-
- /* handle event selection */
- if (eventMask)
- {
- err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
- if (err != Success)
- goto bailout;
- }
-
- if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
- {
- err = BadAlloc;
- goto bailout;
- }
-
- /* start the timer ticking */
-
- if (pAuth->timeout != 0)
- SecurityStartAuthorizationTimer(pAuth);
-
- /* tell client the auth id and data */
-
- rep.type = X_Reply;
- rep.length = (authdata_len + 3) >> 2;
- rep.sequenceNumber = client->sequence;
- rep.authId = authId;
- rep.dataLength = authdata_len;
-
- if (client->swapped)
- {
- register char n;
- swapl(&rep.length, n);
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.authId, n);
- swaps(&rep.dataLength, n);
- }
-
- WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
- (char *)&rep);
- WriteToClient(client, authdata_len, pAuthdata);
-
- SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
- client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
- pAuth->group, eventMask);
-
- /* the request succeeded; don't call RemoveAuthorization or free pAuth */
-
- removeAuth = FALSE;
- pAuth = NULL;
- err = client->noClientException;
-
-bailout:
- if (removeAuth)
- RemoveAuthorization(stuff->nbytesAuthProto, protoname,
- authdata_len, pAuthdata);
- if (pAuth) xfree(pAuth);
- return err;
-
-} /* ProcSecurityGenerateAuthorization */
-
-static int
-ProcSecurityRevokeAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityRevokeAuthorizationReq);
- SecurityAuthorizationPtr pAuth;
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
-
- pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
- stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess);
- if (!pAuth)
- return SecurityErrorBase + XSecurityBadAuthorization;
-
- FreeResource(stuff->authId, RT_NONE);
- return Success;
-} /* ProcSecurityRevokeAuthorization */
-
-
-static int
-ProcSecurityDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return ProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return ProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return ProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
- }
-} /* ProcSecurityDispatch */
-
-static int
-SProcSecurityQueryVersion(
- ClientPtr client)
-{
- REQUEST(xSecurityQueryVersionReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion,n);
- return ProcSecurityQueryVersion(client);
-} /* SProcSecurityQueryVersion */
-
-
-static int
-SProcSecurityGenerateAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityGenerateAuthorizationReq);
- register char n;
- CARD32 *values;
- unsigned long nvalues;
- int values_offset;
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- swaps(&stuff->nbytesAuthProto, n);
- swaps(&stuff->nbytesAuthData, n);
- swapl(&stuff->valueMask, n);
- values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
- ((stuff->nbytesAuthData + (unsigned)3) >> 2);
- if (values_offset >
- stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
- return BadLength;
- values = (CARD32 *)(&stuff[1]) + values_offset;
- nvalues = (((CARD32 *)stuff) + stuff->length) - values;
- SwapLongs(values, nvalues);
- return ProcSecurityGenerateAuthorization(client);
-} /* SProcSecurityGenerateAuthorization */
-
-
-static int
-SProcSecurityRevokeAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityRevokeAuthorizationReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
- swapl(&stuff->authId, n);
- return ProcSecurityRevokeAuthorization(client);
-} /* SProcSecurityRevokeAuthorization */
-
-
-static int
-SProcSecurityDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return SProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return SProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return SProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
- }
-} /* SProcSecurityDispatch */
-
-static void
-SwapSecurityAuthorizationRevokedEvent(
- xSecurityAuthorizationRevokedEvent *from,
- xSecurityAuthorizationRevokedEvent *to)
-{
- to->type = from->type;
- to->detail = from->detail;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->authId, to->authId);
-}
-
-/* SecurityDetermineEventPropogationLimits
- *
- * This is a helper function for SecurityCheckDeviceAccess.
- *
- * Arguments:
- * dev is the device for which the starting and stopping windows for
- * event propogation should be determined.
- * The values pointed to by ppWin and ppStopWin are not used.
- *
- * Returns:
- * ppWin is filled in with a pointer to the window at which event
- * propogation for the given device should start given the current
- * state of the server (pointer position, window layout, etc.)
- * ppStopWin is filled in with the window at which event propogation
- * should stop; events should not go to ppStopWin.
- *
- * Side Effects: none.
- */
-
-static void
-SecurityDetermineEventPropogationLimits(
- DeviceIntPtr dev,
- WindowPtr *ppWin,
- WindowPtr *ppStopWin)
-{
- WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin;
-
- if (pFocusWin == NoneWin)
- { /* no focus -- events don't go anywhere */
- *ppWin = *ppStopWin = NULL;
- return;
- }
-
- if (pFocusWin == PointerRootWin)
- { /* focus follows the pointer */
- *ppWin = GetSpriteWindow();
- *ppStopWin = NULL; /* propogate all the way to the root */
- }
- else
- { /* a real window is set for the focus */
- WindowPtr pSpriteWin = GetSpriteWindow();
- *ppStopWin = pFocusWin->parent; /* don't go past the focus window */
-
- /* if the pointer is in a subwindow of the focus window, start
- * at that subwindow, else start at the focus window itself
- */
- if (IsParent(pFocusWin, pSpriteWin))
- *ppWin = pSpriteWin;
- else *ppWin = pFocusWin;
- }
-} /* SecurityDetermineEventPropogationLimits */
-
-
-/* SecurityCheckDeviceAccess
- *
- * Arguments:
- * client is the client attempting to access a device.
- * dev is the device being accessed.
- * fromRequest is TRUE if the device access is a direct result of
- * the client executing some request and FALSE if it is a
- * result of the server trying to send an event (e.g. KeymapNotify)
- * to the client.
- * Returns:
- * TRUE if the device access should be allowed, else FALSE.
- *
- * Side Effects:
- * An audit message is generated if access is denied.
- */
-
-Bool
-SecurityCheckDeviceAccess(client, dev, fromRequest)
- ClientPtr client;
- DeviceIntPtr dev;
- Bool fromRequest;
-{
- WindowPtr pWin, pStopWin;
- Bool untrusted_got_event;
- Bool found_event_window;
- Mask eventmask;
- int reqtype = 0;
-
- /* trusted clients always allowed to do anything */
- if (client->trustLevel == XSecurityClientTrusted)
- return TRUE;
-
- /* device security other than keyboard is not implemented yet */
- if (dev != inputInfo.keyboard)
- return TRUE;
-
- /* some untrusted client wants access */
-
- if (fromRequest)
- {
- reqtype = ((xReq *)client->requestBuffer)->reqType;
- switch (reqtype)
- {
- /* never allow these */
- case X_ChangeKeyboardMapping:
- case X_ChangeKeyboardControl:
- case X_SetModifierMapping:
- SecurityAudit("client %d attempted request %d\n",
- client->index, reqtype);
- return FALSE;
- default:
- break;
- }
- }
-
- untrusted_got_event = FALSE;
- found_event_window = FALSE;
-
- if (dev->grab)
- {
- untrusted_got_event =
- ((rClient(dev->grab))->trustLevel != XSecurityClientTrusted);
- }
- else
- {
- SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin);
-
- eventmask = KeyPressMask | KeyReleaseMask;
- while ( (pWin != pStopWin) && !found_event_window)
- {
- OtherClients *other;
-
- if (pWin->eventMask & eventmask)
- {
- found_event_window = TRUE;
- client = wClient(pWin);
- if (client->trustLevel != XSecurityClientTrusted)
- {
- untrusted_got_event = TRUE;
- }
- }
- if (wOtherEventMasks(pWin) & eventmask)
- {
- found_event_window = TRUE;
- for (other = wOtherClients(pWin); other; other = other->next)
- {
- if (other->mask & eventmask)
- {
- client = rClient(other);
- if (client->trustLevel != XSecurityClientTrusted)
- {
- untrusted_got_event = TRUE;
- break;
- }
- }
- }
- }
- if (wDontPropagateMask(pWin) & eventmask)
- break;
- pWin = pWin->parent;
- } /* while propogating the event */
- }
-
- /* allow access by untrusted clients only if an event would have gone
- * to an untrusted client
- */
-
- if (!untrusted_got_event)
- {
- char *devname = dev->name;
- if (!devname) devname = "unnamed";
- if (fromRequest)
- SecurityAudit("client %d attempted request %d device %d (%s)\n",
- client->index, reqtype, dev->id, devname);
- else
- SecurityAudit("client %d attempted to access device %d (%s)\n",
- client->index, dev->id, devname);
- }
- return untrusted_got_event;
-} /* SecurityCheckDeviceAccess */
-
-
-
-/* SecurityAuditResourceIDAccess
- *
- * Arguments:
- * client is the client doing the resource access.
- * id is the resource id.
- *
- * Returns: NULL
- *
- * Side Effects:
- * An audit message is generated with details of the denied
- * resource access.
- */
-
-static pointer
-SecurityAuditResourceIDAccess(
- ClientPtr client,
- XID id)
-{
- int cid = CLIENT_ID(id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
- switch (reqtype)
- {
- case X_ChangeProperty:
- case X_DeleteProperty:
- case X_GetProperty:
- {
- xChangePropertyReq *req =
- (xChangePropertyReq *)client->requestBuffer;
- int propertyatom = req->property;
- char *propertyname = NameForAtom(propertyatom);
-
- SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n",
- client->index, reqtype, id, propertyname, cid);
- break;
- }
- default:
- {
- SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n",
- client->index, reqtype, id, cid);
- break;
- }
- }
- return NULL;
-} /* SecurityAuditResourceIDAccess */
-
-
-/* SecurityCheckResourceIDAccess
- *
- * This function gets plugged into client->CheckAccess and is called from
- * SecurityLookupIDByType/Class to determine if the client can access the
- * resource.
- *
- * Arguments:
- * client is the client doing the resource access.
- * id is the resource id.
- * rtype is its type or class.
- * access_mode represents the intended use of the resource; see
- * resource.h.
- * rval is a pointer to the resource structure for this resource.
- *
- * Returns:
- * If access is granted, the value of rval that was passed in, else NULL.
- *
- * Side Effects:
- * Disallowed resource accesses are audited.
- */
-
-static pointer
-SecurityCheckResourceIDAccess(
- ClientPtr client,
- XID id,
- RESTYPE rtype,
- Mask access_mode,
- pointer rval)
-{
- int cid = CLIENT_ID(id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
-
- if (SecurityUnknownAccess == access_mode)
- return rval; /* for compatibility, we have to allow access */
-
- switch (reqtype)
- { /* these are always allowed */
- case X_QueryTree:
- case X_TranslateCoords:
- case X_GetGeometry:
- /* property access is controlled in SecurityCheckPropertyAccess */
- case X_GetProperty:
- case X_ChangeProperty:
- case X_DeleteProperty:
- case X_RotateProperties:
- case X_ListProperties:
- return rval;
- default:
- break;
- }
-
- if (cid != 0)
- { /* not a server-owned resource */
- /*
- * The following 'if' restricts clients to only access resources at
- * the same trustLevel. Since there are currently only two trust levels,
- * and trusted clients never call this function, this degenerates into
- * saying that untrusted clients can only access resources of other
- * untrusted clients. One way to add the notion of groups would be to
- * allow values other than Trusted (0) and Untrusted (1) for this field.
- * Clients at the same trust level would be able to use each other's
- * resources, but not those of clients at other trust levels. I haven't
- * tried it, but this probably mostly works already. The obvious
- * competing alternative for grouping clients for security purposes is to
- * use app groups. dpw
- */
- if (client->trustLevel == clients[cid]->trustLevel
-#ifdef XAPPGROUP
- || (RT_COLORMAP == rtype &&
- XagDefaultColormap (client) == (Colormap) id)
-#endif
- )
- return rval;
- else
- return SecurityAuditResourceIDAccess(client, id);
- }
- else /* server-owned resource - probably a default colormap or root window */
- {
- if (RT_WINDOW == rtype || RC_DRAWABLE == rtype)
- {
- switch (reqtype)
- { /* the following operations are allowed on root windows */
- case X_CreatePixmap:
- case X_CreateGC:
- case X_CreateWindow:
- case X_CreateColormap:
- case X_ListProperties:
- case X_GrabPointer:
- case X_UngrabButton:
- case X_QueryBestSize:
- case X_GetWindowAttributes:
- break;
- case X_SendEvent:
- { /* see if it is an event specified by the ICCCM */
- xSendEventReq *req = (xSendEventReq *)
- (client->requestBuffer);
- if (req->propagate == xTrue
- ||
- (req->eventMask != ColormapChangeMask &&
- req->eventMask != StructureNotifyMask &&
- req->eventMask !=
- (SubstructureRedirectMask|SubstructureNotifyMask)
- )
- ||
- (req->event.u.u.type != UnmapNotify &&
- req->event.u.u.type != ConfigureRequest &&
- req->event.u.u.type != ClientMessage
- )
- )
- { /* not an ICCCM event */
- return SecurityAuditResourceIDAccess(client, id);
- }
- break;
- } /* case X_SendEvent on root */
-
- case X_ChangeWindowAttributes:
- { /* Allow selection of PropertyNotify and StructureNotify
- * events on the root.
- */
- xChangeWindowAttributesReq *req =
- (xChangeWindowAttributesReq *)(client->requestBuffer);
- if (req->valueMask == CWEventMask)
- {
- CARD32 value = *((CARD32 *)(req + 1));
- if ( (value &
- ~(PropertyChangeMask|StructureNotifyMask)) == 0)
- break;
- }
- return SecurityAuditResourceIDAccess(client, id);
- } /* case X_ChangeWindowAttributes on root */
-
- default:
- {
-#ifdef LBX
- /* XXX really need per extension dispatching */
- if (reqtype == LbxReqCode) {
- switch (((xReq *)client->requestBuffer)->data) {
- case X_LbxGetProperty:
- case X_LbxChangeProperty:
- return rval;
- default:
- break;
- }
- }
-#endif
- /* others not allowed */
- return SecurityAuditResourceIDAccess(client, id);
- }
- }
- } /* end server-owned window or drawable */
- else if (SecurityAuthorizationResType == rtype)
- {
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval;
- if (pAuth->trustLevel != client->trustLevel)
- return SecurityAuditResourceIDAccess(client, id);
- }
- else if (RT_COLORMAP != rtype)
- { /* don't allow anything else besides colormaps */
- return SecurityAuditResourceIDAccess(client, id);
- }
- }
- return rval;
-} /* SecurityCheckResourceIDAccess */
-
-
-/* SecurityClientStateCallback
- *
- * Arguments:
- * pcbl is &ClientStateCallback.
- * nullata is NULL.
- * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
- * which contains information about client state changes.
- *
- * Returns: nothing.
- *
- * Side Effects:
- *
- * If a new client is connecting, its authorization ID is copied to
- * client->authID. If this is a generated authorization, its reference
- * count is bumped, its timer is cancelled if it was running, and its
- * trustlevel is copied to client->trustLevel.
- *
- * If a client is disconnecting and the client was using a generated
- * authorization, the authorization's reference count is decremented, and
- * if it is now zero, the timer for this authorization is started.
- */
-
-static void
-SecurityClientStateCallback(
- CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata)
-{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
- ClientPtr client = pci->client;
-
- switch (client->clientState)
- {
- case ClientStateRunning:
- {
- XID authId = AuthorizationIDOfClient(client);
- SecurityAuthorizationPtr pAuth;
-
- client->authId = authId;
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- { /* it is a generated authorization */
- pAuth->refcnt++;
- if (pAuth->refcnt == 1)
- {
- if (pAuth->timer) TimerCancel(pAuth->timer);
- }
- client->trustLevel = pAuth->trustLevel;
- if (client->trustLevel != XSecurityClientTrusted)
- {
- client->CheckAccess = SecurityCheckResourceIDAccess;
- client->requestVector = client->swapped ?
- SwappedUntrustedProcVector : UntrustedProcVector;
- }
- }
- break;
- }
- case ClientStateGone:
- case ClientStateRetained: /* client disconnected */
- {
- XID authId = client->authId;
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- { /* it is a generated authorization */
- pAuth->refcnt--;
- if (pAuth->refcnt == 0)
- {
- SecurityStartAuthorizationTimer(pAuth);
- }
- }
- break;
- }
- default: break;
- }
-} /* SecurityClientStateCallback */
-
-#ifdef LBX
-Bool
-SecuritySameLevel(client, authId)
- ClientPtr client;
- XID authId;
-{
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- return client->trustLevel == pAuth->trustLevel;
- return client->trustLevel == XSecurityClientTrusted;
-}
-#endif
-
-/* SecurityCensorImage
- *
- * Called after pScreen->GetImage to prevent pieces or trusted windows from
- * being returned in image data from an untrusted window.
- *
- * Arguments:
- * client is the client doing the GetImage.
- * pVisibleRegion is the visible region of the window.
- * widthBytesLine is the width in bytes of one horizontal line in pBuf.
- * pDraw is the source window.
- * x, y, w, h is the rectangle of image data from pDraw in pBuf.
- * format is the format of the image data in pBuf: ZPixmap or XYPixmap.
- * pBuf is the image data.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Any part of the rectangle (x, y, w, h) that is outside the visible
- * region of the window will be destroyed (overwritten) in pBuf.
- */
-void
-SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
- format, pBuf)
- ClientPtr client;
- RegionPtr pVisibleRegion;
- long widthBytesLine;
- DrawablePtr pDraw;
- int x, y, w, h;
- unsigned int format;
- char * pBuf;
-{
- ScreenPtr pScreen = pDraw->pScreen;
- RegionRec imageRegion; /* region representing x,y,w,h */
- RegionRec censorRegion; /* region to obliterate */
- BoxRec imageBox;
- int nRects;
-
- imageBox.x1 = x;
- imageBox.y1 = y;
- imageBox.x2 = x + w;
- imageBox.y2 = y + h;
- REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
- REGION_NULL(pScreen, &censorRegion);
-
- /* censorRegion = imageRegion - visibleRegion */
- REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
- nRects = REGION_NUM_RECTS(&censorRegion);
- if (nRects > 0)
- { /* we have something to censor */
- GCPtr pScratchGC = NULL;
- PixmapPtr pPix = NULL;
- xRectangle *pRects = NULL;
- Bool failed = FALSE;
- int depth = 1;
- int bitsPerPixel = 1;
- int i;
- BoxPtr pBox;
-
- /* convert region to list-of-rectangles for PolyFillRect */
-
- pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
- if (!pRects)
- {
- failed = TRUE;
- goto failSafe;
- }
- for (pBox = REGION_RECTS(&censorRegion), i = 0;
- i < nRects;
- i++, pBox++)
- {
- pRects[i].x = pBox->x1;
- pRects[i].y = pBox->y1 - imageBox.y1;
- pRects[i].width = pBox->x2 - pBox->x1;
- pRects[i].height = pBox->y2 - pBox->y1;
- }
-
- /* use pBuf as a fake pixmap */
-
- if (format == ZPixmap)
- {
- depth = pDraw->depth;
- bitsPerPixel = pDraw->bitsPerPixel;
- }
-
- pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
- depth, bitsPerPixel,
- widthBytesLine, (pointer)pBuf);
- if (!pPix)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
- if (!pScratchGC)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- ValidateGC(&pPix->drawable, pScratchGC);
- (* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
- pScratchGC, nRects, pRects);
-
- failSafe:
- if (failed)
- {
- /* Censoring was not completed above. To be safe, wipe out
- * all the image data so that nothing trusted gets out.
- */
- bzero(pBuf, (int)(widthBytesLine * h));
- }
- if (pRects) DEALLOCATE_LOCAL(pRects);
- if (pScratchGC) FreeScratchGC(pScratchGC);
- if (pPix) FreeScratchPixmapHeader(pPix);
- }
- REGION_UNINIT(pScreen, &imageRegion);
- REGION_UNINIT(pScreen, &censorRegion);
-} /* SecurityCensorImage */
-
-/**********************************************************************/
-
-typedef struct _PropertyAccessRec {
- ATOM name;
- ATOM mustHaveProperty;
- char *mustHaveValue;
- char windowRestriction;
-#define SecurityAnyWindow 0
-#define SecurityRootWindow 1
-#define SecurityWindowWithProperty 2
- char readAction;
- char writeAction;
- char destroyAction;
- struct _PropertyAccessRec *next;
-} PropertyAccessRec, *PropertyAccessPtr;
-
-static PropertyAccessPtr PropertyAccessList = NULL;
-static char SecurityDefaultAction = SecurityErrorOperation;
-static char *SecurityPolicyFile = DEFAULTPOLICYFILE;
-static ATOM SecurityMaxPropertyName = 0;
-
-static char *SecurityKeywords[] = {
-#define SecurityKeywordComment 0
- "#",
-#define SecurityKeywordProperty 1
- "property",
-#define SecurityKeywordSitePolicy 2
- "sitepolicy",
-#define SecurityKeywordRoot 3
- "root",
-#define SecurityKeywordAny 4
- "any"
-};
-
-#define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *))
-
-#undef PROPDEBUG
-/*#define PROPDEBUG 1*/
-
-static void
-SecurityFreePropertyAccessList(void)
-{
- while (PropertyAccessList)
- {
- PropertyAccessPtr freeit = PropertyAccessList;
- PropertyAccessList = PropertyAccessList->next;
- xfree(freeit);
- }
-} /* SecurityFreePropertyAccessList */
-
-#ifndef __UNIXOS2__
-#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
-#else
-#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
-#endif
-
-static char *
-SecuritySkipWhitespace(
- char *p)
-{
- while (SecurityIsWhitespace(*p))
- p++;
- return p;
-} /* SecuritySkipWhitespace */
-
-
-static char *
-SecurityParseString(
- char **rest)
-{
- char *startOfString;
- char *s = *rest;
- char endChar = 0;
-
- s = SecuritySkipWhitespace(s);
-
- if (*s == '"' || *s == '\'')
- {
- endChar = *s++;
- startOfString = s;
- while (*s && (*s != endChar))
- s++;
- }
- else
- {
- startOfString = s;
- while (*s && !SecurityIsWhitespace(*s))
- s++;
- }
- if (*s)
- {
- *s = '\0';
- *rest = s + 1;
- return startOfString;
- }
- else
- {
- *rest = s;
- return (endChar) ? NULL : startOfString;
- }
-} /* SecurityParseString */
-
-
-static int
-SecurityParseKeyword(
- char **p)
-{
- int i;
- char *s = *p;
- s = SecuritySkipWhitespace(s);
- for (i = 0; i < NUMKEYWORDS; i++)
- {
- int len = strlen(SecurityKeywords[i]);
- if (strncmp(s, SecurityKeywords[i], len) == 0)
- {
- *p = s + len;
- return (i);
- }
- }
- *p = s;
- return -1;
-} /* SecurityParseKeyword */
-
-
-static Bool
-SecurityParsePropertyAccessRule(
- char *p)
-{
- char *propname;
- char c;
- char action = SecurityDefaultAction;
- char readAction, writeAction, destroyAction;
- PropertyAccessPtr pacl, prev, cur;
- char *mustHaveProperty = NULL;
- char *mustHaveValue = NULL;
- Bool invalid;
- char windowRestriction;
- int size;
- int keyword;
-
- /* get property name */
- propname = SecurityParseString(&p);
- if (!propname || (strlen(propname) == 0))
- return FALSE;
-
- /* get window on which property must reside for rule to apply */
-
- keyword = SecurityParseKeyword(&p);
- if (keyword == SecurityKeywordRoot)
- windowRestriction = SecurityRootWindow;
- else if (keyword == SecurityKeywordAny)
- windowRestriction = SecurityAnyWindow;
- else /* not root or any, must be a property name */
- {
- mustHaveProperty = SecurityParseString(&p);
- if (!mustHaveProperty || (strlen(mustHaveProperty) == 0))
- return FALSE;
- windowRestriction = SecurityWindowWithProperty;
- p = SecuritySkipWhitespace(p);
- if (*p == '=')
- { /* property value is specified too */
- p++; /* skip over '=' */
- mustHaveValue = SecurityParseString(&p);
- if (!mustHaveValue)
- return FALSE;
- }
- }
-
- /* get operations and actions */
-
- invalid = FALSE;
- readAction = writeAction = destroyAction = SecurityDefaultAction;
- while ( (c = *p++) && !invalid)
- {
- switch (c)
- {
- case 'i': action = SecurityIgnoreOperation; break;
- case 'a': action = SecurityAllowOperation; break;
- case 'e': action = SecurityErrorOperation; break;
-
- case 'r': readAction = action; break;
- case 'w': writeAction = action; break;
- case 'd': destroyAction = action; break;
-
- default :
- if (!SecurityIsWhitespace(c))
- invalid = TRUE;
- break;
- }
- }
- if (invalid)
- return FALSE;
-
- /* We've successfully collected all the information needed for this
- * property access rule. Now record it in a PropertyAccessRec.
- */
- size = sizeof(PropertyAccessRec);
-
- /* If there is a property value string, allocate space for it
- * right after the PropertyAccessRec.
- */
- if (mustHaveValue)
- size += strlen(mustHaveValue) + 1;
- pacl = (PropertyAccessPtr)Xalloc(size);
- if (!pacl)
- return FALSE;
-
- pacl->name = MakeAtom(propname, strlen(propname), TRUE);
- if (pacl->name == BAD_RESOURCE)
- {
- Xfree(pacl);
- return FALSE;
- }
- if (mustHaveProperty)
- {
- pacl->mustHaveProperty = MakeAtom(mustHaveProperty,
- strlen(mustHaveProperty), TRUE);
- if (pacl->mustHaveProperty == BAD_RESOURCE)
- {
- Xfree(pacl);
- return FALSE;
- }
- }
- else
- pacl->mustHaveProperty = 0;
-
- if (mustHaveValue)
- {
- pacl->mustHaveValue = (char *)(pacl + 1);
- strcpy(pacl->mustHaveValue, mustHaveValue);
- }
- else
- pacl->mustHaveValue = NULL;
-
- SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name);
-
- pacl->windowRestriction = windowRestriction;
- pacl->readAction = readAction;
- pacl->writeAction = writeAction;
- pacl->destroyAction = destroyAction;
-
- /* link the new rule into the list of rules in order of increasing
- * property name (atom) value to make searching easier
- */
-
- for (prev = NULL, cur = PropertyAccessList;
- cur && cur->name <= pacl->name;
- prev = cur, cur = cur->next)
- ;
- if (!prev)
- {
- pacl->next = cur;
- PropertyAccessList = pacl;
- }
- else
- {
- prev->next = pacl;
- pacl->next = cur;
- }
- return TRUE;
-} /* SecurityParsePropertyAccessRule */
-
-static char **SecurityPolicyStrings = NULL;
-static int nSecurityPolicyStrings = 0;
-
-static Bool
-SecurityParseSitePolicy(
- char *p)
-{
- char *policyStr = SecurityParseString(&p);
- char *copyPolicyStr;
- char **newStrings;
-
- if (!policyStr)
- return FALSE;
-
- copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1);
- if (!copyPolicyStr)
- return TRUE;
- strcpy(copyPolicyStr, policyStr);
- newStrings = (char **)Xrealloc(SecurityPolicyStrings,
- sizeof (char *) * (nSecurityPolicyStrings + 1));
- if (!newStrings)
- {
- Xfree(copyPolicyStr);
- return TRUE;
- }
-
- SecurityPolicyStrings = newStrings;
- SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr;
-
- return TRUE;
-
-} /* SecurityParseSitePolicy */
-
-
-char **
-SecurityGetSitePolicyStrings(n)
- int *n;
-{
- *n = nSecurityPolicyStrings;
- return SecurityPolicyStrings;
-} /* SecurityGetSitePolicyStrings */
-
-static void
-SecurityFreeSitePolicyStrings(void)
-{
- if (SecurityPolicyStrings)
- {
- assert(nSecurityPolicyStrings);
- while (nSecurityPolicyStrings--)
- {
- Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]);
- }
- Xfree(SecurityPolicyStrings);
- SecurityPolicyStrings = NULL;
- nSecurityPolicyStrings = 0;
- }
-} /* SecurityFreeSitePolicyStrings */
-
-
-static void
-SecurityLoadPropertyAccessList(void)
-{
- FILE *f;
- int lineNumber = 0;
-
- SecurityMaxPropertyName = 0;
-
-#ifdef NXAGENT_SERVER
-
- if (!_NXGetPolicyFilePath(SecurityPolicyFile))
- {
- return;
- }
-
-#else
-
- if (!SecurityPolicyFile)
- return;
-
-#endif
-
-#ifndef __UNIXOS2__
-
-#ifdef NXAGENT_SERVER
-
- f = Fopen(_NXGetPolicyFilePath(SecurityPolicyFile), "r");
-
-#else
-
- f = Fopen(SecurityPolicyFile, "r");
-
-#endif
-
-#else
-
-#ifdef NXAGENT_SERVER
-
- f = Fopen((char*)__XOS2RedirRoot( _NXGetPolicyFilePath(SecurityPolicyFile)), "r");
-
-#else
-
- f = Fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
-
-#endif
-
-#endif
-
- if (!f)
- {
-#ifdef NXAGENT_SERVER
-
- ErrorF("error opening security policy file %s\n",
- _NXGetPolicyFilePath(SecurityPolicyFile));
-
-#else
-
- ErrorF("error opening security policy file %s\n",
- SecurityPolicyFile);
-
-#endif
-
- return;
- }
-
- while (!feof(f))
- {
- char buf[200];
- Bool validLine;
- char *p;
-
- if (!(p = fgets(buf, sizeof(buf), f)))
- break;
- lineNumber++;
-
- /* if first line, check version number */
- if (lineNumber == 1)
- {
- char *v = SecurityParseString(&p);
- if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0)
- {
-
-#ifdef NXAGENT_SERVER
-
- ErrorF("%s: invalid security policy file version, ignoring file\n",
- _NXGetPolicyFilePath(SecurityPolicyFile));
-
-#else
-
- ErrorF("%s: invalid security policy file version, ignoring file\n",
- SecurityPolicyFile);
-
-#endif
-
- break;
- }
- validLine = TRUE;
- }
- else
- {
- switch (SecurityParseKeyword(&p))
- {
- case SecurityKeywordComment:
- validLine = TRUE;
- break;
-
- case SecurityKeywordProperty:
- validLine = SecurityParsePropertyAccessRule(p);
- break;
-
- case SecurityKeywordSitePolicy:
- validLine = SecurityParseSitePolicy(p);
- break;
-
- default:
- validLine = (*p == '\0'); /* blank lines OK, others not */
- break;
- }
- }
-
-#ifdef NXAGENT_SERVER
-
- if (!validLine)
- {
- ErrorF("Line %d of %s invalid, ignoring\n",
- lineNumber, _NXGetPolicyFilePath(SecurityPolicyFile));
- }
-
-#else
-
- if (!validLine)
- ErrorF("Line %d of %s invalid, ignoring\n",
- lineNumber, SecurityPolicyFile);
-
-#endif
-
- } /* end while more input */
-
-#ifdef PROPDEBUG
- {
- PropertyAccessPtr pacl;
- char *op = "aie";
- for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
- {
- ErrorF("property %s ", NameForAtom(pacl->name));
- switch (pacl->windowRestriction)
- {
- case SecurityAnyWindow: ErrorF("any "); break;
- case SecurityRootWindow: ErrorF("root "); break;
- case SecurityWindowWithProperty:
- {
- ErrorF("%s ", NameForAtom(pacl->mustHaveProperty));
- if (pacl->mustHaveValue)
- ErrorF(" = \"%s\" ", pacl->mustHaveValue);
-
- }
- break;
- }
- ErrorF("%cr %cw %cd\n", op[pacl->readAction],
- op[pacl->writeAction], op[pacl->destroyAction]);
- }
- }
-#endif /* PROPDEBUG */
-
- Fclose(f);
-} /* SecurityLoadPropertyAccessList */
-
-
-static Bool
-SecurityMatchString(
- char *ws,
- char *cs)
-{
- while (*ws && *cs)
- {
- if (*ws == '*')
- {
- Bool match = FALSE;
- ws++;
- while (!(match = SecurityMatchString(ws, cs)) && *cs)
- {
- cs++;
- }
- return match;
- }
- else if (*ws == *cs)
- {
- ws++;
- cs++;
- }
- else break;
- }
- return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') )
- && (*cs == '\0') );
-} /* SecurityMatchString */
-
-#ifdef PROPDEBUG
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-
-char
-SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
- ClientPtr client;
- WindowPtr pWin;
- ATOM propertyName;
- Mask access_mode;
-{
- PropertyAccessPtr pacl;
- char action = SecurityDefaultAction;
-
- /* if client trusted or window untrusted, allow operation */
-
- if ( (client->trustLevel == XSecurityClientTrusted) ||
- (wClient(pWin)->trustLevel != XSecurityClientTrusted) )
- return SecurityAllowOperation;
-
-#ifdef PROPDEBUG
- /* For testing, it's more convenient if the property rules file gets
- * reloaded whenever it changes, so we can rapidly try things without
- * having to reset the server.
- */
- {
- struct stat buf;
- static time_t lastmod = 0;
-
-#ifdef NXAGENT_SERVER
-
- int ret = stat(_NXGetPolicyFilePath(SecurityPolicyFile), &buf);
-
-#else
-
- int ret = stat(SecurityPolicyFile , &buf);
-
-#endif
-
- if ( (ret == 0) && (buf.st_mtime > lastmod) )
- {
- ErrorF("reloading property rules\n");
- SecurityFreePropertyAccessList();
- SecurityLoadPropertyAccessList();
- lastmod = buf.st_mtime;
- }
- }
-#endif
-
- /* If the property atom is bigger than any atoms on the list,
- * we know we won't find it, so don't even bother looking.
- */
- if (propertyName <= SecurityMaxPropertyName)
- {
- /* untrusted client operating on trusted window; see if it's allowed */
-
- for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
- {
- if (pacl->name < propertyName)
- continue;
- if (pacl->name > propertyName)
- break;
-
- /* pacl->name == propertyName, so see if it applies to this window */
-
- switch (pacl->windowRestriction)
- {
- case SecurityAnyWindow: /* always applies */
- break;
-
- case SecurityRootWindow:
- {
- /* if not a root window, this rule doesn't apply */
- if (pWin->parent)
- continue;
- }
- break;
-
- case SecurityWindowWithProperty:
- {
- PropertyPtr pProp = wUserProps (pWin);
- Bool match = FALSE;
- char *p;
- char *pEndData;
-
- while (pProp)
- {
- if (pProp->propertyName == pacl->mustHaveProperty)
- break;
- pProp = pProp->next;
- }
- if (!pProp)
- continue;
- if (!pacl->mustHaveValue)
- break;
- if (pProp->type != XA_STRING || pProp->format != 8)
- continue;
-
- p = pProp->data;
- pEndData = ((char *)pProp->data) + pProp->size;
- while (!match && p < pEndData)
- {
- if (SecurityMatchString(pacl->mustHaveValue, p))
- match = TRUE;
- else
- { /* skip to the next string */
- while (*p++ && p < pEndData)
- ;
- }
- }
- if (!match)
- continue;
- }
- break; /* end case SecurityWindowWithProperty */
- } /* end switch on windowRestriction */
-
- /* If we get here, the property access rule pacl applies.
- * If pacl doesn't apply, something above should have
- * executed a continue, which will skip the follwing code.
- */
- action = SecurityAllowOperation;
- if (access_mode & SecurityReadAccess)
- action = max(action, pacl->readAction);
- if (access_mode & SecurityWriteAccess)
- action = max(action, pacl->writeAction);
- if (access_mode & SecurityDestroyAccess)
- action = max(action, pacl->destroyAction);
- break;
- } /* end for each pacl */
- } /* end if propertyName <= SecurityMaxPropertyName */
-
- if (SecurityAllowOperation != action)
- { /* audit the access violation */
- int cid = CLIENT_ID(pWin->drawable.id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
- char *actionstr = (SecurityIgnoreOperation == action) ?
- "ignored" : "error";
- SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n",
- client->index, reqtype, pWin->drawable.id,
- NameForAtom(propertyName), propertyName, cid, actionstr);
- }
- return action;
-} /* SecurityCheckPropertyAccess */
-
-
-/* SecurityResetProc
- *
- * Arguments:
- * extEntry is the extension information for the security extension.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Performs any cleanup needed by Security at server shutdown time.
- */
-
-static void
-SecurityResetProc(
- ExtensionEntry *extEntry)
-{
- SecurityFreePropertyAccessList();
- SecurityFreeSitePolicyStrings();
-} /* SecurityResetProc */
-
-
-int
-XSecurityOptions(argc, argv, i)
- int argc;
- char **argv;
- int i;
-{
- if (strcmp(argv[i], "-sp") == 0)
- {
- if (i < argc)
- SecurityPolicyFile = argv[++i];
- return (i + 1);
- }
- return (i);
-} /* XSecurityOptions */
-
-
-
-/* SecurityExtensionInit
- *
- * Arguments: none.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Enables the Security extension if possible.
- */
-
-void
-SecurityExtensionInit(INITARGS)
-{
- ExtensionEntry *extEntry;
- int i;
-
- SecurityAuthorizationResType =
- CreateNewResourceType(SecurityDeleteAuthorization);
-
- RTEventClient = CreateNewResourceType(
- SecurityDeleteAuthorizationEventClient);
-
- if (!SecurityAuthorizationResType || !RTEventClient)
- return;
-
- RTEventClient |= RC_NEVERRETAIN;
-
- if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL))
- return;
-
- extEntry = AddExtension(SECURITY_EXTENSION_NAME,
- XSecurityNumberEvents, XSecurityNumberErrors,
- ProcSecurityDispatch, SProcSecurityDispatch,
- SecurityResetProc, StandardMinorOpcode);
-
- SecurityErrorBase = extEntry->errorBase;
- SecurityEventBase = extEntry->eventBase;
-
- EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
- (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
-
- /* initialize untrusted proc vectors */
-
- for (i = 0; i < 128; i++)
- {
- UntrustedProcVector[i] = ProcVector[i];
- SwappedUntrustedProcVector[i] = SwappedProcVector[i];
- }
-
- /* make sure insecure extensions are not allowed */
-
- for (i = 128; i < 256; i++)
- {
- if (!UntrustedProcVector[i])
- {
- UntrustedProcVector[i] = ProcBadRequest;
- SwappedUntrustedProcVector[i] = ProcBadRequest;
- }
- }
-
- SecurityLoadPropertyAccessList();
-
-} /* SecurityExtensionInit */
diff --git a/nx-X11/programs/Xserver/Xext/security.c.X.original b/nx-X11/programs/Xserver/Xext/security.c.X.original
deleted file mode 100644
index c6a516733..000000000
--- a/nx-X11/programs/Xserver/Xext/security.c.X.original
+++ /dev/null
@@ -1,2008 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/security.c,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
-/* $Xorg: security.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.16tsi Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "windowstr.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#define _SECURITY_SERVER
-#include <X11/extensions/securstr.h>
-#include <assert.h>
-#include <stdarg.h>
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <X11/extensions/XLbx.h>
-extern unsigned char LbxReqCode;
-#endif
-#ifdef XAPPGROUP
-#include <X11/extensions/Xagsrv.h>
-#endif
-#include <stdio.h> /* for file reading operations */
-#include <X11/Xatom.h> /* for XA_STRING */
-
-#ifndef DEFAULTPOLICYFILE
-# define DEFAULTPOLICYFILE NULL
-#endif
-#if defined(WIN32) || defined(__CYGWIN__)
-#include <X11/Xos.h>
-#undef index
-#endif
-
-#include "modinit.h"
-
-static int SecurityErrorBase; /* first Security error number */
-static int SecurityEventBase; /* first Security event number */
-
-CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */
-
-RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
-
-static RESTYPE RTEventClient;
-
-/* Proc vectors for untrusted clients, swapped and unswapped versions.
- * These are the same as the normal proc vectors except that extensions
- * that haven't declared themselves secure will have ProcBadRequest plugged
- * in for their major opcode dispatcher. This prevents untrusted clients
- * from guessing extension major opcodes and using the extension even though
- * the extension can't be listed or queried.
- */
-int (*UntrustedProcVector[256])(
- ClientPtr /*client*/
-);
-int (*SwappedUntrustedProcVector[256])(
- ClientPtr /*client*/
-);
-
-/* SecurityAudit
- *
- * Arguments:
- * format is the formatting string to be used to interpret the
- * remaining arguments.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Writes the message to the log file if security logging is on.
- */
-
-void
-SecurityAudit(char *format, ...)
-{
- va_list args;
-
- if (auditTrailLevel < SECURITY_AUDIT_LEVEL)
- return;
- va_start(args, format);
- VAuditF(format, args);
- va_end(args);
-} /* SecurityAudit */
-
-#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-
-/* SecurityDeleteAuthorization
- *
- * Arguments:
- * value is the authorization to delete.
- * id is its resource ID.
- *
- * Returns: Success.
- *
- * Side Effects:
- * Frees everything associated with the authorization.
- */
-
-static int
-SecurityDeleteAuthorization(
- pointer value,
- XID id)
-{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
- unsigned short name_len, data_len;
- char *name, *data;
- int status;
- int i;
- OtherClientsPtr pEventClient;
-
- /* Remove the auth using the os layer auth manager */
-
- status = AuthorizationFromID(pAuth->id, &name_len, &name,
- &data_len, &data);
- assert(status);
- status = RemoveAuthorization(name_len, name, data_len, data);
- assert(status);
- (void)status;
-
- /* free the auth timer if there is one */
-
- if (pAuth->timer) TimerFree(pAuth->timer);
-
- /* send revoke events */
-
- while ((pEventClient = pAuth->eventClients))
- {
- /* send revocation event event */
- ClientPtr client = rClient(pEventClient);
-
- if (!client->clientGone)
- {
- xSecurityAuthorizationRevokedEvent are;
- are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.sequenceNumber = client->sequence;
- are.authId = pAuth->id;
- WriteEventsToClient(client, 1, (xEvent *)&are);
- }
- FreeResource(pEventClient->resource, RT_NONE);
- }
-
- /* kill all clients using this auth */
-
- for (i = 1; i<currentMaxClients; i++)
- {
- if (clients[i] && (clients[i]->authId == pAuth->id))
- CloseDownClient(clients[i]);
- }
-
- SecurityAudit("revoked authorization ID %d\n", pAuth->id);
- xfree(pAuth);
- return Success;
-
-} /* SecurityDeleteAuthorization */
-
-
-/* resource delete function for RTEventClient */
-static int
-SecurityDeleteAuthorizationEventClient(
- pointer value,
- XID id)
-{
- OtherClientsPtr pEventClient, prev = NULL;
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
-
- for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (pEventClient->resource == id)
- {
- if (prev)
- prev->next = pEventClient->next;
- else
- pAuth->eventClients = pEventClient->next;
- xfree(pEventClient);
- return(Success);
- }
- prev = pEventClient;
- }
- /*NOTREACHED*/
- return -1; /* make compiler happy */
-} /* SecurityDeleteAuthorizationEventClient */
-
-
-/* SecurityComputeAuthorizationTimeout
- *
- * Arguments:
- * pAuth is the authorization for which we are computing the timeout
- * seconds is the number of seconds we want to wait
- *
- * Returns:
- * the number of milliseconds that the auth timer should be set to
- *
- * Side Effects:
- * Sets pAuth->secondsRemaining to any "overflow" amount of time
- * that didn't fit in 32 bits worth of milliseconds
- */
-
-static CARD32
-SecurityComputeAuthorizationTimeout(
- SecurityAuthorizationPtr pAuth,
- unsigned int seconds)
-{
- /* maxSecs is the number of full seconds that can be expressed in
- * 32 bits worth of milliseconds
- */
- CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND;
-
- if (seconds > maxSecs)
- { /* only come here if we want to wait more than 49 days */
- pAuth->secondsRemaining = seconds - maxSecs;
- return maxSecs * MILLI_PER_SECOND;
- }
- else
- { /* by far the common case */
- pAuth->secondsRemaining = 0;
- return seconds * MILLI_PER_SECOND;
- }
-} /* SecurityStartAuthorizationTimer */
-
-/* SecurityAuthorizationExpired
- *
- * This function is passed as an argument to TimerSet and gets called from
- * the timer manager in the os layer when its time is up.
- *
- * Arguments:
- * timer is the timer for this authorization.
- * time is the current time.
- * pval is the authorization whose time is up.
- *
- * Returns:
- * A new time delay in milliseconds if the timer should wait some
- * more, else zero.
- *
- * Side Effects:
- * Frees the authorization resource if the timeout period is really
- * over, otherwise recomputes pAuth->secondsRemaining.
- */
-
-static CARD32
-SecurityAuthorizationExpired(
- OsTimerPtr timer,
- CARD32 time,
- pointer pval)
-{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval;
-
- assert(pAuth->timer == timer);
-
- if (pAuth->secondsRemaining)
- {
- return SecurityComputeAuthorizationTimeout(pAuth,
- pAuth->secondsRemaining);
- }
- else
- {
- FreeResource(pAuth->id, RT_NONE);
- return 0;
- }
-} /* SecurityAuthorizationExpired */
-
-/* SecurityStartAuthorizationTimer
- *
- * Arguments:
- * pAuth is the authorization whose timer should be started.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * A timer is started, set to expire after the timeout period for
- * this authorization. When it expires, the function
- * SecurityAuthorizationExpired will be called.
- */
-
-static void
-SecurityStartAuthorizationTimer(
- SecurityAuthorizationPtr pAuth)
-{
- pAuth->timer = TimerSet(pAuth->timer, 0,
- SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
- SecurityAuthorizationExpired, pAuth);
-} /* SecurityStartAuthorizationTimer */
-
-
-/* Proc functions all take a client argument, execute the request in
- * client->requestBuffer, and return a protocol error status.
- */
-
-static int
-ProcSecurityQueryVersion(
- ClientPtr client)
-{
- /* REQUEST(xSecurityQueryVersionReq); */
- xSecurityQueryVersionReply rep;
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SECURITY_MAJOR_VERSION;
- rep.minorVersion = SECURITY_MINOR_VERSION;
- if(client->swapped)
- {
- register char n;
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
- (char *)&rep);
- return (client->noClientException);
-} /* ProcSecurityQueryVersion */
-
-
-static int
-SecurityEventSelectForAuthorization(
- SecurityAuthorizationPtr pAuth,
- ClientPtr client,
- Mask mask)
-{
- OtherClients *pEventClient;
-
- for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (SameClient(pEventClient, client))
- {
- if (mask == 0)
- FreeResource(pEventClient->resource, RT_NONE);
- else
- pEventClient->mask = mask;
- return Success;
- }
- }
-
- pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
- if (!pEventClient)
- return BadAlloc;
- pEventClient->mask = mask;
- pEventClient->resource = FakeClientID(client->index);
- pEventClient->next = pAuth->eventClients;
- if (!AddResource(pEventClient->resource, RTEventClient,
- (pointer)pAuth))
- {
- xfree(pEventClient);
- return BadAlloc;
- }
- pAuth->eventClients = pEventClient;
-
- return Success;
-} /* SecurityEventSelectForAuthorization */
-
-
-static int
-ProcSecurityGenerateAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityGenerateAuthorizationReq);
- int len; /* request length in CARD32s*/
- Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
- SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
- int err; /* error to return from this function */
- XID authId; /* authorization ID assigned by os layer */
- xSecurityGenerateAuthorizationReply rep; /* reply struct */
- unsigned int trustLevel; /* trust level of new auth */
- XID group; /* group of new auth */
- CARD32 timeout; /* timeout of new auth */
- CARD32 *values; /* list of supplied attributes */
- char *protoname; /* auth proto name sent in request */
- char *protodata; /* auth proto data sent in request */
- unsigned int authdata_len; /* # bytes of generated auth data */
- char *pAuthdata; /* generated auth data */
- Mask eventMask; /* what events on this auth does client want */
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- /* check request length */
-
- REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2;
- len += (stuff->nbytesAuthProto + (unsigned)3) >> 2;
- len += (stuff->nbytesAuthData + (unsigned)3) >> 2;
- values = ((CARD32 *)stuff) + len;
- len += Ones(stuff->valueMask);
- if (client->req_len != len)
- return BadLength;
-
- /* check valuemask */
- if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
- {
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
-
- /* check timeout */
- timeout = 60;
- if (stuff->valueMask & XSecurityTimeout)
- {
- timeout = *values++;
- }
-
- /* check trustLevel */
- trustLevel = XSecurityClientUntrusted;
- if (stuff->valueMask & XSecurityTrustLevel)
- {
- trustLevel = *values++;
- if (trustLevel != XSecurityClientTrusted &&
- trustLevel != XSecurityClientUntrusted)
- {
- client->errorValue = trustLevel;
- return BadValue;
- }
- }
-
- /* check group */
- group = None;
- if (stuff->valueMask & XSecurityGroup)
- {
- group = *values++;
- if (SecurityValidateGroupCallback)
- {
- SecurityValidateGroupInfoRec vgi;
- vgi.group = group;
- vgi.valid = FALSE;
- CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi);
-
- /* if nobody said they recognized it, it's an error */
-
- if (!vgi.valid)
- {
- client->errorValue = group;
- return BadValue;
- }
- }
- }
-
- /* check event mask */
- eventMask = 0;
- if (stuff->valueMask & XSecurityEventMask)
- {
- eventMask = *values++;
- if (eventMask & ~XSecurityAllEventMasks)
- {
- client->errorValue = eventMask;
- return BadValue;
- }
- }
-
- protoname = (char *)&stuff[1];
- protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2);
-
- /* call os layer to generate the authorization */
-
- authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
- stuff->nbytesAuthData, protodata,
- &authdata_len, &pAuthdata);
- if ((XID) ~0L == authId)
- {
- err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
- goto bailout;
- }
-
- /* now that we've added the auth, remember to remove it if we have to
- * abort the request for some reason (like allocation failure)
- */
- removeAuth = TRUE;
-
- /* associate additional information with this auth ID */
-
- pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
- if (!pAuth)
- {
- err = BadAlloc;
- goto bailout;
- }
-
- /* fill in the auth fields */
-
- pAuth->id = authId;
- pAuth->timeout = timeout;
- pAuth->group = group;
- pAuth->trustLevel = trustLevel;
- pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */
- pAuth->secondsRemaining = 0;
- pAuth->timer = NULL;
- pAuth->eventClients = NULL;
-
- /* handle event selection */
- if (eventMask)
- {
- err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
- if (err != Success)
- goto bailout;
- }
-
- if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
- {
- err = BadAlloc;
- goto bailout;
- }
-
- /* start the timer ticking */
-
- if (pAuth->timeout != 0)
- SecurityStartAuthorizationTimer(pAuth);
-
- /* tell client the auth id and data */
-
- rep.type = X_Reply;
- rep.length = (authdata_len + 3) >> 2;
- rep.sequenceNumber = client->sequence;
- rep.authId = authId;
- rep.dataLength = authdata_len;
-
- if (client->swapped)
- {
- register char n;
- swapl(&rep.length, n);
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.authId, n);
- swaps(&rep.dataLength, n);
- }
-
- WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
- (char *)&rep);
- WriteToClient(client, authdata_len, pAuthdata);
-
- SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
- client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
- pAuth->group, eventMask);
-
- /* the request succeeded; don't call RemoveAuthorization or free pAuth */
-
- removeAuth = FALSE;
- pAuth = NULL;
- err = client->noClientException;
-
-bailout:
- if (removeAuth)
- RemoveAuthorization(stuff->nbytesAuthProto, protoname,
- authdata_len, pAuthdata);
- if (pAuth) xfree(pAuth);
- return err;
-
-} /* ProcSecurityGenerateAuthorization */
-
-static int
-ProcSecurityRevokeAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityRevokeAuthorizationReq);
- SecurityAuthorizationPtr pAuth;
-
- /* paranoia: this "can't happen" because this extension is hidden
- * from untrusted clients, but just in case...
- */
- if (client->trustLevel != XSecurityClientTrusted)
- return BadRequest;
-
- REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
-
- pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
- stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess);
- if (!pAuth)
- return SecurityErrorBase + XSecurityBadAuthorization;
-
- FreeResource(stuff->authId, RT_NONE);
- return Success;
-} /* ProcSecurityRevokeAuthorization */
-
-
-static int
-ProcSecurityDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return ProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return ProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return ProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
- }
-} /* ProcSecurityDispatch */
-
-static int
-SProcSecurityQueryVersion(
- ClientPtr client)
-{
- REQUEST(xSecurityQueryVersionReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion,n);
- return ProcSecurityQueryVersion(client);
-} /* SProcSecurityQueryVersion */
-
-
-static int
-SProcSecurityGenerateAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityGenerateAuthorizationReq);
- register char n;
- CARD32 *values;
- unsigned long nvalues;
- int values_offset;
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- swaps(&stuff->nbytesAuthProto, n);
- swaps(&stuff->nbytesAuthData, n);
- swapl(&stuff->valueMask, n);
- values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
- ((stuff->nbytesAuthData + (unsigned)3) >> 2);
- if (values_offset >
- stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
- return BadLength;
- values = (CARD32 *)(&stuff[1]) + values_offset;
- nvalues = (((CARD32 *)stuff) + stuff->length) - values;
- SwapLongs(values, nvalues);
- return ProcSecurityGenerateAuthorization(client);
-} /* SProcSecurityGenerateAuthorization */
-
-
-static int
-SProcSecurityRevokeAuthorization(
- ClientPtr client)
-{
- REQUEST(xSecurityRevokeAuthorizationReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
- swapl(&stuff->authId, n);
- return ProcSecurityRevokeAuthorization(client);
-} /* SProcSecurityRevokeAuthorization */
-
-
-static int
-SProcSecurityDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return SProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return SProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return SProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
- }
-} /* SProcSecurityDispatch */
-
-static void
-SwapSecurityAuthorizationRevokedEvent(
- xSecurityAuthorizationRevokedEvent *from,
- xSecurityAuthorizationRevokedEvent *to)
-{
- to->type = from->type;
- to->detail = from->detail;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->authId, to->authId);
-}
-
-/* SecurityDetermineEventPropogationLimits
- *
- * This is a helper function for SecurityCheckDeviceAccess.
- *
- * Arguments:
- * dev is the device for which the starting and stopping windows for
- * event propogation should be determined.
- * The values pointed to by ppWin and ppStopWin are not used.
- *
- * Returns:
- * ppWin is filled in with a pointer to the window at which event
- * propogation for the given device should start given the current
- * state of the server (pointer position, window layout, etc.)
- * ppStopWin is filled in with the window at which event propogation
- * should stop; events should not go to ppStopWin.
- *
- * Side Effects: none.
- */
-
-static void
-SecurityDetermineEventPropogationLimits(
- DeviceIntPtr dev,
- WindowPtr *ppWin,
- WindowPtr *ppStopWin)
-{
- WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin;
-
- if (pFocusWin == NoneWin)
- { /* no focus -- events don't go anywhere */
- *ppWin = *ppStopWin = NULL;
- return;
- }
-
- if (pFocusWin == PointerRootWin)
- { /* focus follows the pointer */
- *ppWin = GetSpriteWindow();
- *ppStopWin = NULL; /* propogate all the way to the root */
- }
- else
- { /* a real window is set for the focus */
- WindowPtr pSpriteWin = GetSpriteWindow();
- *ppStopWin = pFocusWin->parent; /* don't go past the focus window */
-
- /* if the pointer is in a subwindow of the focus window, start
- * at that subwindow, else start at the focus window itself
- */
- if (IsParent(pFocusWin, pSpriteWin))
- *ppWin = pSpriteWin;
- else *ppWin = pFocusWin;
- }
-} /* SecurityDetermineEventPropogationLimits */
-
-
-/* SecurityCheckDeviceAccess
- *
- * Arguments:
- * client is the client attempting to access a device.
- * dev is the device being accessed.
- * fromRequest is TRUE if the device access is a direct result of
- * the client executing some request and FALSE if it is a
- * result of the server trying to send an event (e.g. KeymapNotify)
- * to the client.
- * Returns:
- * TRUE if the device access should be allowed, else FALSE.
- *
- * Side Effects:
- * An audit message is generated if access is denied.
- */
-
-Bool
-SecurityCheckDeviceAccess(client, dev, fromRequest)
- ClientPtr client;
- DeviceIntPtr dev;
- Bool fromRequest;
-{
- WindowPtr pWin, pStopWin;
- Bool untrusted_got_event;
- Bool found_event_window;
- Mask eventmask;
- int reqtype = 0;
-
- /* trusted clients always allowed to do anything */
- if (client->trustLevel == XSecurityClientTrusted)
- return TRUE;
-
- /* device security other than keyboard is not implemented yet */
- if (dev != inputInfo.keyboard)
- return TRUE;
-
- /* some untrusted client wants access */
-
- if (fromRequest)
- {
- reqtype = ((xReq *)client->requestBuffer)->reqType;
- switch (reqtype)
- {
- /* never allow these */
- case X_ChangeKeyboardMapping:
- case X_ChangeKeyboardControl:
- case X_SetModifierMapping:
- SecurityAudit("client %d attempted request %d\n",
- client->index, reqtype);
- return FALSE;
- default:
- break;
- }
- }
-
- untrusted_got_event = FALSE;
- found_event_window = FALSE;
-
- if (dev->grab)
- {
- untrusted_got_event =
- ((rClient(dev->grab))->trustLevel != XSecurityClientTrusted);
- }
- else
- {
- SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin);
-
- eventmask = KeyPressMask | KeyReleaseMask;
- while ( (pWin != pStopWin) && !found_event_window)
- {
- OtherClients *other;
-
- if (pWin->eventMask & eventmask)
- {
- found_event_window = TRUE;
- client = wClient(pWin);
- if (client->trustLevel != XSecurityClientTrusted)
- {
- untrusted_got_event = TRUE;
- }
- }
- if (wOtherEventMasks(pWin) & eventmask)
- {
- found_event_window = TRUE;
- for (other = wOtherClients(pWin); other; other = other->next)
- {
- if (other->mask & eventmask)
- {
- client = rClient(other);
- if (client->trustLevel != XSecurityClientTrusted)
- {
- untrusted_got_event = TRUE;
- break;
- }
- }
- }
- }
- if (wDontPropagateMask(pWin) & eventmask)
- break;
- pWin = pWin->parent;
- } /* while propogating the event */
- }
-
- /* allow access by untrusted clients only if an event would have gone
- * to an untrusted client
- */
-
- if (!untrusted_got_event)
- {
- char *devname = dev->name;
- if (!devname) devname = "unnamed";
- if (fromRequest)
- SecurityAudit("client %d attempted request %d device %d (%s)\n",
- client->index, reqtype, dev->id, devname);
- else
- SecurityAudit("client %d attempted to access device %d (%s)\n",
- client->index, dev->id, devname);
- }
- return untrusted_got_event;
-} /* SecurityCheckDeviceAccess */
-
-
-
-/* SecurityAuditResourceIDAccess
- *
- * Arguments:
- * client is the client doing the resource access.
- * id is the resource id.
- *
- * Returns: NULL
- *
- * Side Effects:
- * An audit message is generated with details of the denied
- * resource access.
- */
-
-static pointer
-SecurityAuditResourceIDAccess(
- ClientPtr client,
- XID id)
-{
- int cid = CLIENT_ID(id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
- switch (reqtype)
- {
- case X_ChangeProperty:
- case X_DeleteProperty:
- case X_GetProperty:
- {
- xChangePropertyReq *req =
- (xChangePropertyReq *)client->requestBuffer;
- int propertyatom = req->property;
- char *propertyname = NameForAtom(propertyatom);
-
- SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n",
- client->index, reqtype, id, propertyname, cid);
- break;
- }
- default:
- {
- SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n",
- client->index, reqtype, id, cid);
- break;
- }
- }
- return NULL;
-} /* SecurityAuditResourceIDAccess */
-
-
-/* SecurityCheckResourceIDAccess
- *
- * This function gets plugged into client->CheckAccess and is called from
- * SecurityLookupIDByType/Class to determine if the client can access the
- * resource.
- *
- * Arguments:
- * client is the client doing the resource access.
- * id is the resource id.
- * rtype is its type or class.
- * access_mode represents the intended use of the resource; see
- * resource.h.
- * rval is a pointer to the resource structure for this resource.
- *
- * Returns:
- * If access is granted, the value of rval that was passed in, else NULL.
- *
- * Side Effects:
- * Disallowed resource accesses are audited.
- */
-
-static pointer
-SecurityCheckResourceIDAccess(
- ClientPtr client,
- XID id,
- RESTYPE rtype,
- Mask access_mode,
- pointer rval)
-{
- int cid = CLIENT_ID(id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
-
- if (SecurityUnknownAccess == access_mode)
- return rval; /* for compatibility, we have to allow access */
-
- switch (reqtype)
- { /* these are always allowed */
- case X_QueryTree:
- case X_TranslateCoords:
- case X_GetGeometry:
- /* property access is controlled in SecurityCheckPropertyAccess */
- case X_GetProperty:
- case X_ChangeProperty:
- case X_DeleteProperty:
- case X_RotateProperties:
- case X_ListProperties:
- return rval;
- default:
- break;
- }
-
- if (cid != 0)
- { /* not a server-owned resource */
- /*
- * The following 'if' restricts clients to only access resources at
- * the same trustLevel. Since there are currently only two trust levels,
- * and trusted clients never call this function, this degenerates into
- * saying that untrusted clients can only access resources of other
- * untrusted clients. One way to add the notion of groups would be to
- * allow values other than Trusted (0) and Untrusted (1) for this field.
- * Clients at the same trust level would be able to use each other's
- * resources, but not those of clients at other trust levels. I haven't
- * tried it, but this probably mostly works already. The obvious
- * competing alternative for grouping clients for security purposes is to
- * use app groups. dpw
- */
- if (client->trustLevel == clients[cid]->trustLevel
-#ifdef XAPPGROUP
- || (RT_COLORMAP == rtype &&
- XagDefaultColormap (client) == (Colormap) id)
-#endif
- )
- return rval;
- else
- return SecurityAuditResourceIDAccess(client, id);
- }
- else /* server-owned resource - probably a default colormap or root window */
- {
- if (RT_WINDOW == rtype || RC_DRAWABLE == rtype)
- {
- switch (reqtype)
- { /* the following operations are allowed on root windows */
- case X_CreatePixmap:
- case X_CreateGC:
- case X_CreateWindow:
- case X_CreateColormap:
- case X_ListProperties:
- case X_GrabPointer:
- case X_UngrabButton:
- case X_QueryBestSize:
- case X_GetWindowAttributes:
- break;
- case X_SendEvent:
- { /* see if it is an event specified by the ICCCM */
- xSendEventReq *req = (xSendEventReq *)
- (client->requestBuffer);
- if (req->propagate == xTrue
- ||
- (req->eventMask != ColormapChangeMask &&
- req->eventMask != StructureNotifyMask &&
- req->eventMask !=
- (SubstructureRedirectMask|SubstructureNotifyMask)
- )
- ||
- (req->event.u.u.type != UnmapNotify &&
- req->event.u.u.type != ConfigureRequest &&
- req->event.u.u.type != ClientMessage
- )
- )
- { /* not an ICCCM event */
- return SecurityAuditResourceIDAccess(client, id);
- }
- break;
- } /* case X_SendEvent on root */
-
- case X_ChangeWindowAttributes:
- { /* Allow selection of PropertyNotify and StructureNotify
- * events on the root.
- */
- xChangeWindowAttributesReq *req =
- (xChangeWindowAttributesReq *)(client->requestBuffer);
- if (req->valueMask == CWEventMask)
- {
- CARD32 value = *((CARD32 *)(req + 1));
- if ( (value &
- ~(PropertyChangeMask|StructureNotifyMask)) == 0)
- break;
- }
- return SecurityAuditResourceIDAccess(client, id);
- } /* case X_ChangeWindowAttributes on root */
-
- default:
- {
-#ifdef LBX
- /* XXX really need per extension dispatching */
- if (reqtype == LbxReqCode) {
- switch (((xReq *)client->requestBuffer)->data) {
- case X_LbxGetProperty:
- case X_LbxChangeProperty:
- return rval;
- default:
- break;
- }
- }
-#endif
- /* others not allowed */
- return SecurityAuditResourceIDAccess(client, id);
- }
- }
- } /* end server-owned window or drawable */
- else if (SecurityAuthorizationResType == rtype)
- {
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval;
- if (pAuth->trustLevel != client->trustLevel)
- return SecurityAuditResourceIDAccess(client, id);
- }
- else if (RT_COLORMAP != rtype)
- { /* don't allow anything else besides colormaps */
- return SecurityAuditResourceIDAccess(client, id);
- }
- }
- return rval;
-} /* SecurityCheckResourceIDAccess */
-
-
-/* SecurityClientStateCallback
- *
- * Arguments:
- * pcbl is &ClientStateCallback.
- * nullata is NULL.
- * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
- * which contains information about client state changes.
- *
- * Returns: nothing.
- *
- * Side Effects:
- *
- * If a new client is connecting, its authorization ID is copied to
- * client->authID. If this is a generated authorization, its reference
- * count is bumped, its timer is cancelled if it was running, and its
- * trustlevel is copied to client->trustLevel.
- *
- * If a client is disconnecting and the client was using a generated
- * authorization, the authorization's reference count is decremented, and
- * if it is now zero, the timer for this authorization is started.
- */
-
-static void
-SecurityClientStateCallback(
- CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata)
-{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
- ClientPtr client = pci->client;
-
- switch (client->clientState)
- {
- case ClientStateRunning:
- {
- XID authId = AuthorizationIDOfClient(client);
- SecurityAuthorizationPtr pAuth;
-
- client->authId = authId;
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- { /* it is a generated authorization */
- pAuth->refcnt++;
- if (pAuth->refcnt == 1)
- {
- if (pAuth->timer) TimerCancel(pAuth->timer);
- }
- client->trustLevel = pAuth->trustLevel;
- if (client->trustLevel != XSecurityClientTrusted)
- {
- client->CheckAccess = SecurityCheckResourceIDAccess;
- client->requestVector = client->swapped ?
- SwappedUntrustedProcVector : UntrustedProcVector;
- }
- }
- break;
- }
- case ClientStateGone:
- case ClientStateRetained: /* client disconnected */
- {
- XID authId = client->authId;
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- { /* it is a generated authorization */
- pAuth->refcnt--;
- if (pAuth->refcnt == 0)
- {
- SecurityStartAuthorizationTimer(pAuth);
- }
- }
- break;
- }
- default: break;
- }
-} /* SecurityClientStateCallback */
-
-#ifdef LBX
-Bool
-SecuritySameLevel(client, authId)
- ClientPtr client;
- XID authId;
-{
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- return client->trustLevel == pAuth->trustLevel;
- return client->trustLevel == XSecurityClientTrusted;
-}
-#endif
-
-/* SecurityCensorImage
- *
- * Called after pScreen->GetImage to prevent pieces or trusted windows from
- * being returned in image data from an untrusted window.
- *
- * Arguments:
- * client is the client doing the GetImage.
- * pVisibleRegion is the visible region of the window.
- * widthBytesLine is the width in bytes of one horizontal line in pBuf.
- * pDraw is the source window.
- * x, y, w, h is the rectangle of image data from pDraw in pBuf.
- * format is the format of the image data in pBuf: ZPixmap or XYPixmap.
- * pBuf is the image data.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Any part of the rectangle (x, y, w, h) that is outside the visible
- * region of the window will be destroyed (overwritten) in pBuf.
- */
-void
-SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
- format, pBuf)
- ClientPtr client;
- RegionPtr pVisibleRegion;
- long widthBytesLine;
- DrawablePtr pDraw;
- int x, y, w, h;
- unsigned int format;
- char * pBuf;
-{
- ScreenPtr pScreen = pDraw->pScreen;
- RegionRec imageRegion; /* region representing x,y,w,h */
- RegionRec censorRegion; /* region to obliterate */
- BoxRec imageBox;
- int nRects;
-
- imageBox.x1 = x;
- imageBox.y1 = y;
- imageBox.x2 = x + w;
- imageBox.y2 = y + h;
- REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
- REGION_NULL(pScreen, &censorRegion);
-
- /* censorRegion = imageRegion - visibleRegion */
- REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
- nRects = REGION_NUM_RECTS(&censorRegion);
- if (nRects > 0)
- { /* we have something to censor */
- GCPtr pScratchGC = NULL;
- PixmapPtr pPix = NULL;
- xRectangle *pRects = NULL;
- Bool failed = FALSE;
- int depth = 1;
- int bitsPerPixel = 1;
- int i;
- BoxPtr pBox;
-
- /* convert region to list-of-rectangles for PolyFillRect */
-
- pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
- if (!pRects)
- {
- failed = TRUE;
- goto failSafe;
- }
- for (pBox = REGION_RECTS(&censorRegion), i = 0;
- i < nRects;
- i++, pBox++)
- {
- pRects[i].x = pBox->x1;
- pRects[i].y = pBox->y1 - imageBox.y1;
- pRects[i].width = pBox->x2 - pBox->x1;
- pRects[i].height = pBox->y2 - pBox->y1;
- }
-
- /* use pBuf as a fake pixmap */
-
- if (format == ZPixmap)
- {
- depth = pDraw->depth;
- bitsPerPixel = pDraw->bitsPerPixel;
- }
-
- pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
- depth, bitsPerPixel,
- widthBytesLine, (pointer)pBuf);
- if (!pPix)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
- if (!pScratchGC)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- ValidateGC(&pPix->drawable, pScratchGC);
- (* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
- pScratchGC, nRects, pRects);
-
- failSafe:
- if (failed)
- {
- /* Censoring was not completed above. To be safe, wipe out
- * all the image data so that nothing trusted gets out.
- */
- bzero(pBuf, (int)(widthBytesLine * h));
- }
- if (pRects) DEALLOCATE_LOCAL(pRects);
- if (pScratchGC) FreeScratchGC(pScratchGC);
- if (pPix) FreeScratchPixmapHeader(pPix);
- }
- REGION_UNINIT(pScreen, &imageRegion);
- REGION_UNINIT(pScreen, &censorRegion);
-} /* SecurityCensorImage */
-
-/**********************************************************************/
-
-typedef struct _PropertyAccessRec {
- ATOM name;
- ATOM mustHaveProperty;
- char *mustHaveValue;
- char windowRestriction;
-#define SecurityAnyWindow 0
-#define SecurityRootWindow 1
-#define SecurityWindowWithProperty 2
- char readAction;
- char writeAction;
- char destroyAction;
- struct _PropertyAccessRec *next;
-} PropertyAccessRec, *PropertyAccessPtr;
-
-static PropertyAccessPtr PropertyAccessList = NULL;
-static char SecurityDefaultAction = SecurityErrorOperation;
-static char *SecurityPolicyFile = DEFAULTPOLICYFILE;
-static ATOM SecurityMaxPropertyName = 0;
-
-static char *SecurityKeywords[] = {
-#define SecurityKeywordComment 0
- "#",
-#define SecurityKeywordProperty 1
- "property",
-#define SecurityKeywordSitePolicy 2
- "sitepolicy",
-#define SecurityKeywordRoot 3
- "root",
-#define SecurityKeywordAny 4
- "any"
-};
-
-#define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *))
-
-#undef PROPDEBUG
-/*#define PROPDEBUG 1*/
-
-static void
-SecurityFreePropertyAccessList(void)
-{
- while (PropertyAccessList)
- {
- PropertyAccessPtr freeit = PropertyAccessList;
- PropertyAccessList = PropertyAccessList->next;
- xfree(freeit);
- }
-} /* SecurityFreePropertyAccessList */
-
-#ifndef __UNIXOS2__
-#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
-#else
-#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
-#endif
-
-static char *
-SecuritySkipWhitespace(
- char *p)
-{
- while (SecurityIsWhitespace(*p))
- p++;
- return p;
-} /* SecuritySkipWhitespace */
-
-
-static char *
-SecurityParseString(
- char **rest)
-{
- char *startOfString;
- char *s = *rest;
- char endChar = 0;
-
- s = SecuritySkipWhitespace(s);
-
- if (*s == '"' || *s == '\'')
- {
- endChar = *s++;
- startOfString = s;
- while (*s && (*s != endChar))
- s++;
- }
- else
- {
- startOfString = s;
- while (*s && !SecurityIsWhitespace(*s))
- s++;
- }
- if (*s)
- {
- *s = '\0';
- *rest = s + 1;
- return startOfString;
- }
- else
- {
- *rest = s;
- return (endChar) ? NULL : startOfString;
- }
-} /* SecurityParseString */
-
-
-static int
-SecurityParseKeyword(
- char **p)
-{
- int i;
- char *s = *p;
- s = SecuritySkipWhitespace(s);
- for (i = 0; i < NUMKEYWORDS; i++)
- {
- int len = strlen(SecurityKeywords[i]);
- if (strncmp(s, SecurityKeywords[i], len) == 0)
- {
- *p = s + len;
- return (i);
- }
- }
- *p = s;
- return -1;
-} /* SecurityParseKeyword */
-
-
-static Bool
-SecurityParsePropertyAccessRule(
- char *p)
-{
- char *propname;
- char c;
- char action = SecurityDefaultAction;
- char readAction, writeAction, destroyAction;
- PropertyAccessPtr pacl, prev, cur;
- char *mustHaveProperty = NULL;
- char *mustHaveValue = NULL;
- Bool invalid;
- char windowRestriction;
- int size;
- int keyword;
-
- /* get property name */
- propname = SecurityParseString(&p);
- if (!propname || (strlen(propname) == 0))
- return FALSE;
-
- /* get window on which property must reside for rule to apply */
-
- keyword = SecurityParseKeyword(&p);
- if (keyword == SecurityKeywordRoot)
- windowRestriction = SecurityRootWindow;
- else if (keyword == SecurityKeywordAny)
- windowRestriction = SecurityAnyWindow;
- else /* not root or any, must be a property name */
- {
- mustHaveProperty = SecurityParseString(&p);
- if (!mustHaveProperty || (strlen(mustHaveProperty) == 0))
- return FALSE;
- windowRestriction = SecurityWindowWithProperty;
- p = SecuritySkipWhitespace(p);
- if (*p == '=')
- { /* property value is specified too */
- p++; /* skip over '=' */
- mustHaveValue = SecurityParseString(&p);
- if (!mustHaveValue)
- return FALSE;
- }
- }
-
- /* get operations and actions */
-
- invalid = FALSE;
- readAction = writeAction = destroyAction = SecurityDefaultAction;
- while ( (c = *p++) && !invalid)
- {
- switch (c)
- {
- case 'i': action = SecurityIgnoreOperation; break;
- case 'a': action = SecurityAllowOperation; break;
- case 'e': action = SecurityErrorOperation; break;
-
- case 'r': readAction = action; break;
- case 'w': writeAction = action; break;
- case 'd': destroyAction = action; break;
-
- default :
- if (!SecurityIsWhitespace(c))
- invalid = TRUE;
- break;
- }
- }
- if (invalid)
- return FALSE;
-
- /* We've successfully collected all the information needed for this
- * property access rule. Now record it in a PropertyAccessRec.
- */
- size = sizeof(PropertyAccessRec);
-
- /* If there is a property value string, allocate space for it
- * right after the PropertyAccessRec.
- */
- if (mustHaveValue)
- size += strlen(mustHaveValue) + 1;
- pacl = (PropertyAccessPtr)Xalloc(size);
- if (!pacl)
- return FALSE;
-
- pacl->name = MakeAtom(propname, strlen(propname), TRUE);
- if (pacl->name == BAD_RESOURCE)
- {
- Xfree(pacl);
- return FALSE;
- }
- if (mustHaveProperty)
- {
- pacl->mustHaveProperty = MakeAtom(mustHaveProperty,
- strlen(mustHaveProperty), TRUE);
- if (pacl->mustHaveProperty == BAD_RESOURCE)
- {
- Xfree(pacl);
- return FALSE;
- }
- }
- else
- pacl->mustHaveProperty = 0;
-
- if (mustHaveValue)
- {
- pacl->mustHaveValue = (char *)(pacl + 1);
- strcpy(pacl->mustHaveValue, mustHaveValue);
- }
- else
- pacl->mustHaveValue = NULL;
-
- SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name);
-
- pacl->windowRestriction = windowRestriction;
- pacl->readAction = readAction;
- pacl->writeAction = writeAction;
- pacl->destroyAction = destroyAction;
-
- /* link the new rule into the list of rules in order of increasing
- * property name (atom) value to make searching easier
- */
-
- for (prev = NULL, cur = PropertyAccessList;
- cur && cur->name <= pacl->name;
- prev = cur, cur = cur->next)
- ;
- if (!prev)
- {
- pacl->next = cur;
- PropertyAccessList = pacl;
- }
- else
- {
- prev->next = pacl;
- pacl->next = cur;
- }
- return TRUE;
-} /* SecurityParsePropertyAccessRule */
-
-static char **SecurityPolicyStrings = NULL;
-static int nSecurityPolicyStrings = 0;
-
-static Bool
-SecurityParseSitePolicy(
- char *p)
-{
- char *policyStr = SecurityParseString(&p);
- char *copyPolicyStr;
- char **newStrings;
-
- if (!policyStr)
- return FALSE;
-
- copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1);
- if (!copyPolicyStr)
- return TRUE;
- strcpy(copyPolicyStr, policyStr);
- newStrings = (char **)Xrealloc(SecurityPolicyStrings,
- sizeof (char *) * (nSecurityPolicyStrings + 1));
- if (!newStrings)
- {
- Xfree(copyPolicyStr);
- return TRUE;
- }
-
- SecurityPolicyStrings = newStrings;
- SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr;
-
- return TRUE;
-
-} /* SecurityParseSitePolicy */
-
-
-char **
-SecurityGetSitePolicyStrings(n)
- int *n;
-{
- *n = nSecurityPolicyStrings;
- return SecurityPolicyStrings;
-} /* SecurityGetSitePolicyStrings */
-
-static void
-SecurityFreeSitePolicyStrings(void)
-{
- if (SecurityPolicyStrings)
- {
- assert(nSecurityPolicyStrings);
- while (nSecurityPolicyStrings--)
- {
- Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]);
- }
- Xfree(SecurityPolicyStrings);
- SecurityPolicyStrings = NULL;
- nSecurityPolicyStrings = 0;
- }
-} /* SecurityFreeSitePolicyStrings */
-
-
-static void
-SecurityLoadPropertyAccessList(void)
-{
- FILE *f;
- int lineNumber = 0;
-
- SecurityMaxPropertyName = 0;
-
- if (!SecurityPolicyFile)
- return;
-
-#ifndef __UNIXOS2__
- f = Fopen(SecurityPolicyFile, "r");
-#else
- f = Fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
-#endif
- if (!f)
- {
- ErrorF("error opening security policy file %s\n",
- SecurityPolicyFile);
- return;
- }
-
- while (!feof(f))
- {
- char buf[200];
- Bool validLine;
- char *p;
-
- if (!(p = fgets(buf, sizeof(buf), f)))
- break;
- lineNumber++;
-
- /* if first line, check version number */
- if (lineNumber == 1)
- {
- char *v = SecurityParseString(&p);
- if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0)
- {
- ErrorF("%s: invalid security policy file version, ignoring file\n",
- SecurityPolicyFile);
- break;
- }
- validLine = TRUE;
- }
- else
- {
- switch (SecurityParseKeyword(&p))
- {
- case SecurityKeywordComment:
- validLine = TRUE;
- break;
-
- case SecurityKeywordProperty:
- validLine = SecurityParsePropertyAccessRule(p);
- break;
-
- case SecurityKeywordSitePolicy:
- validLine = SecurityParseSitePolicy(p);
- break;
-
- default:
- validLine = (*p == '\0'); /* blank lines OK, others not */
- break;
- }
- }
-
- if (!validLine)
- ErrorF("Line %d of %s invalid, ignoring\n",
- lineNumber, SecurityPolicyFile);
- } /* end while more input */
-
-#ifdef PROPDEBUG
- {
- PropertyAccessPtr pacl;
- char *op = "aie";
- for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
- {
- ErrorF("property %s ", NameForAtom(pacl->name));
- switch (pacl->windowRestriction)
- {
- case SecurityAnyWindow: ErrorF("any "); break;
- case SecurityRootWindow: ErrorF("root "); break;
- case SecurityWindowWithProperty:
- {
- ErrorF("%s ", NameForAtom(pacl->mustHaveProperty));
- if (pacl->mustHaveValue)
- ErrorF(" = \"%s\" ", pacl->mustHaveValue);
-
- }
- break;
- }
- ErrorF("%cr %cw %cd\n", op[pacl->readAction],
- op[pacl->writeAction], op[pacl->destroyAction]);
- }
- }
-#endif /* PROPDEBUG */
-
- Fclose(f);
-} /* SecurityLoadPropertyAccessList */
-
-
-static Bool
-SecurityMatchString(
- char *ws,
- char *cs)
-{
- while (*ws && *cs)
- {
- if (*ws == '*')
- {
- Bool match = FALSE;
- ws++;
- while (!(match = SecurityMatchString(ws, cs)) && *cs)
- {
- cs++;
- }
- return match;
- }
- else if (*ws == *cs)
- {
- ws++;
- cs++;
- }
- else break;
- }
- return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') )
- && (*cs == '\0') );
-} /* SecurityMatchString */
-
-#ifdef PROPDEBUG
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-
-char
-SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
- ClientPtr client;
- WindowPtr pWin;
- ATOM propertyName;
- Mask access_mode;
-{
- PropertyAccessPtr pacl;
- char action = SecurityDefaultAction;
-
- /* if client trusted or window untrusted, allow operation */
-
- if ( (client->trustLevel == XSecurityClientTrusted) ||
- (wClient(pWin)->trustLevel != XSecurityClientTrusted) )
- return SecurityAllowOperation;
-
-#ifdef PROPDEBUG
- /* For testing, it's more convenient if the property rules file gets
- * reloaded whenever it changes, so we can rapidly try things without
- * having to reset the server.
- */
- {
- struct stat buf;
- static time_t lastmod = 0;
- int ret = stat(SecurityPolicyFile , &buf);
- if ( (ret == 0) && (buf.st_mtime > lastmod) )
- {
- ErrorF("reloading property rules\n");
- SecurityFreePropertyAccessList();
- SecurityLoadPropertyAccessList();
- lastmod = buf.st_mtime;
- }
- }
-#endif
-
- /* If the property atom is bigger than any atoms on the list,
- * we know we won't find it, so don't even bother looking.
- */
- if (propertyName <= SecurityMaxPropertyName)
- {
- /* untrusted client operating on trusted window; see if it's allowed */
-
- for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
- {
- if (pacl->name < propertyName)
- continue;
- if (pacl->name > propertyName)
- break;
-
- /* pacl->name == propertyName, so see if it applies to this window */
-
- switch (pacl->windowRestriction)
- {
- case SecurityAnyWindow: /* always applies */
- break;
-
- case SecurityRootWindow:
- {
- /* if not a root window, this rule doesn't apply */
- if (pWin->parent)
- continue;
- }
- break;
-
- case SecurityWindowWithProperty:
- {
- PropertyPtr pProp = wUserProps (pWin);
- Bool match = FALSE;
- char *p;
- char *pEndData;
-
- while (pProp)
- {
- if (pProp->propertyName == pacl->mustHaveProperty)
- break;
- pProp = pProp->next;
- }
- if (!pProp)
- continue;
- if (!pacl->mustHaveValue)
- break;
- if (pProp->type != XA_STRING || pProp->format != 8)
- continue;
-
- p = pProp->data;
- pEndData = ((char *)pProp->data) + pProp->size;
- while (!match && p < pEndData)
- {
- if (SecurityMatchString(pacl->mustHaveValue, p))
- match = TRUE;
- else
- { /* skip to the next string */
- while (*p++ && p < pEndData)
- ;
- }
- }
- if (!match)
- continue;
- }
- break; /* end case SecurityWindowWithProperty */
- } /* end switch on windowRestriction */
-
- /* If we get here, the property access rule pacl applies.
- * If pacl doesn't apply, something above should have
- * executed a continue, which will skip the follwing code.
- */
- action = SecurityAllowOperation;
- if (access_mode & SecurityReadAccess)
- action = max(action, pacl->readAction);
- if (access_mode & SecurityWriteAccess)
- action = max(action, pacl->writeAction);
- if (access_mode & SecurityDestroyAccess)
- action = max(action, pacl->destroyAction);
- break;
- } /* end for each pacl */
- } /* end if propertyName <= SecurityMaxPropertyName */
-
- if (SecurityAllowOperation != action)
- { /* audit the access violation */
- int cid = CLIENT_ID(pWin->drawable.id);
- int reqtype = ((xReq *)client->requestBuffer)->reqType;
- char *actionstr = (SecurityIgnoreOperation == action) ?
- "ignored" : "error";
- SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n",
- client->index, reqtype, pWin->drawable.id,
- NameForAtom(propertyName), propertyName, cid, actionstr);
- }
- return action;
-} /* SecurityCheckPropertyAccess */
-
-
-/* SecurityResetProc
- *
- * Arguments:
- * extEntry is the extension information for the security extension.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Performs any cleanup needed by Security at server shutdown time.
- */
-
-static void
-SecurityResetProc(
- ExtensionEntry *extEntry)
-{
- SecurityFreePropertyAccessList();
- SecurityFreeSitePolicyStrings();
-} /* SecurityResetProc */
-
-
-int
-XSecurityOptions(argc, argv, i)
- int argc;
- char **argv;
- int i;
-{
- if (strcmp(argv[i], "-sp") == 0)
- {
- if (i < argc)
- SecurityPolicyFile = argv[++i];
- return (i + 1);
- }
- return (i);
-} /* XSecurityOptions */
-
-
-
-/* SecurityExtensionInit
- *
- * Arguments: none.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Enables the Security extension if possible.
- */
-
-void
-SecurityExtensionInit(INITARGS)
-{
- ExtensionEntry *extEntry;
- int i;
-
- SecurityAuthorizationResType =
- CreateNewResourceType(SecurityDeleteAuthorization);
-
- RTEventClient = CreateNewResourceType(
- SecurityDeleteAuthorizationEventClient);
-
- if (!SecurityAuthorizationResType || !RTEventClient)
- return;
-
- RTEventClient |= RC_NEVERRETAIN;
-
- if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL))
- return;
-
- extEntry = AddExtension(SECURITY_EXTENSION_NAME,
- XSecurityNumberEvents, XSecurityNumberErrors,
- ProcSecurityDispatch, SProcSecurityDispatch,
- SecurityResetProc, StandardMinorOpcode);
-
- SecurityErrorBase = extEntry->errorBase;
- SecurityEventBase = extEntry->eventBase;
-
- EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
- (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
-
- /* initialize untrusted proc vectors */
-
- for (i = 0; i < 128; i++)
- {
- UntrustedProcVector[i] = ProcVector[i];
- SwappedUntrustedProcVector[i] = SwappedProcVector[i];
- }
-
- /* make sure insecure extensions are not allowed */
-
- for (i = 128; i < 256; i++)
- {
- if (!UntrustedProcVector[i])
- {
- UntrustedProcVector[i] = ProcBadRequest;
- SwappedUntrustedProcVector[i] = ProcBadRequest;
- }
- }
-
- SecurityLoadPropertyAccessList();
-
-} /* SecurityExtensionInit */
diff --git a/nx-X11/programs/Xserver/Xext/shape.c b/nx-X11/programs/Xserver/Xext/shape.c
index 3fa16081a..fa7f9e2e9 100644
--- a/nx-X11/programs/Xserver/Xext/shape.c
+++ b/nx-X11/programs/Xserver/Xext/shape.c
@@ -1,5 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/shape.c,v 1.9 2005/07/03 08:53:36 daniels Exp $ */
-/* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.18 2003/10/28 23:08:43 tsi Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -26,15 +24,14 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
-/* $Xorg: shape.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <stdlib.h>
+
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@@ -44,25 +41,21 @@ in this Software without prior written authorization from The Open Group.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
-#define _SHAPE_SERVER_ /* don't want Xlib structures */
-#include <X11/extensions/shapestr.h>
+#include <X11/extensions/shapeproto.h>
+#include "protocol-versions.h"
#include "regionstr.h"
#include "gcstruct.h"
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
-#include "modinit.h"
typedef RegionPtr (*CreateDftPtr)(
WindowPtr /* pWin */
);
static int ShapeFreeClient(
- pointer /* data */,
+ void * /* data */,
XID /* id */
);
static int ShapeFreeEvents(
- pointer /* data */,
+ void * /* data */,
XID /* id */
);
static void ShapeResetProc(
@@ -147,7 +140,7 @@ typedef struct _ShapeEvent {
****************/
void
-ShapeExtensionInit(INITARGS)
+ShapeExtensionInit(void)
{
ExtensionEntry *extEntry;
@@ -186,11 +179,11 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
ScreenPtr pScreen = pWin->drawable.pScreen;
if (srcRgn && (xoff || yoff))
- REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff);
+ RegionTranslate(srcRgn, xoff, yoff);
if (!pWin->parent)
{
if (srcRgn)
- REGION_DESTROY(pScreen, srcRgn);
+ RegionDestroy(srcRgn);
return Success;
}
@@ -201,7 +194,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
*/
if (srcRgn == NULL) {
if (*destRgnp != NULL) {
- REGION_DESTROY (pScreen, *destRgnp);
+ RegionDestroy(*destRgnp);
*destRgnp = 0;
/* go on to remove shape and generate ShapeNotify */
}
@@ -220,17 +213,17 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
else switch (op) {
case ShapeSet:
if (*destRgnp)
- REGION_DESTROY(pScreen, *destRgnp);
+ RegionDestroy(*destRgnp);
*destRgnp = srcRgn;
srcRgn = 0;
break;
case ShapeUnion:
if (*destRgnp)
- REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionUnion(*destRgnp, *destRgnp, srcRgn);
break;
case ShapeIntersect:
if (*destRgnp)
- REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionIntersect(*destRgnp, *destRgnp, srcRgn);
else {
*destRgnp = srcRgn;
srcRgn = 0;
@@ -239,20 +232,20 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
case ShapeSubtract:
if (!*destRgnp)
*destRgnp = (*create)(pWin);
- REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionSubtract(*destRgnp, *destRgnp, srcRgn);
break;
case ShapeInvert:
if (!*destRgnp)
- *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
+ *destRgnp = RegionCreate((BoxPtr) 0, 0);
else
- REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp);
+ RegionSubtract(*destRgnp, srcRgn, *destRgnp);
break;
default:
client->errorValue = op;
return BadValue;
}
if (srcRgn)
- REGION_DESTROY(pScreen, srcRgn);
+ RegionDestroy(srcRgn);
(*pScreen->SetShape) (pWin);
SendShapeNotify (pWin, kind);
return Success;
@@ -268,7 +261,7 @@ CreateBoundingShape (pWin)
extents.y1 = -wBorderWidth (pWin);
extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+ return RegionCreate(&extents, 1);
}
RegionPtr
@@ -281,7 +274,7 @@ CreateClipShape (pWin)
extents.y1 = 0;
extents.x2 = pWin->drawable.width;
extents.y2 = pWin->drawable.height;
- return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+ return RegionCreate(&extents, 1);
}
static int
@@ -289,21 +282,21 @@ ProcShapeQueryVersion (client)
register ClientPtr client;
{
xShapeQueryVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
+ memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = SHAPE_MAJOR_VERSION;
- rep.minorVersion = SHAPE_MINOR_VERSION;
+ rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof (xShapeQueryVersionReply), &rep);
return (client->noClientException);
}
@@ -317,7 +310,6 @@ ProcShapeRectangles (client)
register ClientPtr client;
{
WindowPtr pWin;
- ScreenPtr pScreen;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype;
@@ -350,7 +342,6 @@ ProcShapeRectangles (client)
client->errorValue = stuff->ordering;
return BadValue;
}
- pScreen = pWin->drawable.pScreen;
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
@@ -359,7 +350,7 @@ ProcShapeRectangles (client)
ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
if (ctype < 0)
return BadMatch;
- srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype);
+ srcRgn = RegionFromRects(nrects, prects, ctype);
if (!pWin->optional)
MakeWindowOptional (pWin);
@@ -394,7 +385,7 @@ ProcPanoramiXShapeRectangles(
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@@ -426,7 +417,7 @@ ProcShapeMask (client)
REQUEST_SIZE_MATCH (xShapeMaskReq);
UpdateCurrentTime();
- pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess);
+ pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess);
if (!pWin)
return BadWindow;
switch (stuff->destKind) {
@@ -448,13 +439,13 @@ ProcShapeMask (client)
srcRgn = 0;
else {
pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src,
- RT_PIXMAP, SecurityReadAccess);
+ RT_PIXMAP, DixReadAccess);
if (!pPixmap)
return BadPixmap;
if (pPixmap->drawable.pScreen != pScreen ||
pPixmap->drawable.depth != 1)
return BadMatch;
- srcRgn = BITMAP_TO_REGION(pScreen, pPixmap);
+ srcRgn = BitmapToRegion(pScreen, pPixmap);
if (!srcRgn)
return BadAlloc;
}
@@ -492,12 +483,12 @@ ProcPanoramiXShapeMask(
REQUEST_SIZE_MATCH (xShapeMaskReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(stuff->src != None) {
if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->src, XRT_PIXMAP, SecurityReadAccess)))
+ client, stuff->src, XRT_PIXMAP, DixReadAccess)))
return BadPixmap;
} else
pmap = NULL;
@@ -580,8 +571,8 @@ ProcShapeCombine (client)
}
if (srcRgn) {
- tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
- REGION_COPY(pScreen, tmp, srcRgn);
+ tmp = RegionCreate((BoxPtr) 0, 0);
+ RegionCopy(tmp, srcRgn);
srcRgn = tmp;
} else
srcRgn = (*createSrc) (pSrcWin);
@@ -620,11 +611,11 @@ ProcPanoramiXShapeCombine(
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->src, XRT_WINDOW, SecurityReadAccess)))
+ client, stuff->src, XRT_WINDOW, DixReadAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@@ -672,7 +663,7 @@ ProcShapeOffset (client)
pScreen = pWin->drawable.pScreen;
if (srcRgn)
{
- REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
+ RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
(*pScreen->SetShape) (pWin);
}
SendShapeNotify (pWin, (int)stuff->destKind);
@@ -692,7 +683,7 @@ ProcPanoramiXShapeOffset(
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
return BadWindow;
FOR_NSCREENS(j) {
@@ -713,10 +704,10 @@ ProcShapeQueryExtents (client)
WindowPtr pWin;
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
- register int n;
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
@@ -727,7 +718,7 @@ ProcShapeQueryExtents (client)
rep.clipShaped = (wClipShape(pWin) != 0);
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
+ pExtents = RegionExtents(region);
extents = *pExtents;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -741,7 +732,7 @@ ProcShapeQueryExtents (client)
rep.heightBoundingShape = extents.y2 - extents.y1;
if ((region = wClipShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
+ pExtents = RegionExtents(region);
extents = *pExtents;
} else {
extents.x1 = 0;
@@ -754,25 +745,25 @@ ProcShapeQueryExtents (client)
rep.widthClipShape = extents.x2 - extents.x1;
rep.heightClipShape = extents.y2 - extents.y1;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.xBoundingShape, n);
- swaps(&rep.yBoundingShape, n);
- swaps(&rep.widthBoundingShape, n);
- swaps(&rep.heightBoundingShape, n);
- swaps(&rep.xClipShape, n);
- swaps(&rep.yClipShape, n);
- swaps(&rep.widthClipShape, n);
- swaps(&rep.heightClipShape, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.xBoundingShape);
+ swaps(&rep.yBoundingShape);
+ swaps(&rep.widthBoundingShape);
+ swaps(&rep.heightBoundingShape);
+ swaps(&rep.xClipShape);
+ swaps(&rep.yClipShape);
+ swaps(&rep.widthClipShape);
+ swaps(&rep.heightClipShape);
}
- WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
+ WriteToClient(client, sizeof (xShapeQueryExtentsReply), &rep);
return (client->noClientException);
}
/*ARGSUSED*/
static int
ShapeFreeClient (data, id)
- pointer data;
+ void *data;
XID id;
{
ShapeEventPtr pShapeEvent;
@@ -794,14 +785,14 @@ ShapeFreeClient (data, id)
*pHead = pShapeEvent->next;
}
}
- xfree ((pointer) pShapeEvent);
+ free ((void *) pShapeEvent);
return 1;
}
/*ARGSUSED*/
static int
ShapeFreeEvents (data, id)
- pointer data;
+ void *data;
XID id;
{
ShapeEventPtr *pHead, pCur, pNext;
@@ -810,9 +801,9 @@ ShapeFreeEvents (data, id)
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource (pCur->clientResource, ClientType);
- xfree ((pointer) pCur);
+ free ((void *) pCur);
}
- xfree ((pointer) pHead);
+ free ((void *) pHead);
return 1;
}
@@ -826,11 +817,11 @@ ProcShapeSelectInput (client)
XID clientResource;
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
- pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess);
+ pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess);
if (!pWin)
return BadWindow;
pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
- pWin->drawable.id, EventType, SecurityWriteAccess);
+ pWin->drawable.id, EventType, DixWriteAccess);
switch (stuff->enable) {
case xTrue:
if (pHead) {
@@ -847,7 +838,7 @@ ProcShapeSelectInput (client)
/* build the entry */
pNewShapeEvent = (ShapeEventPtr)
- xalloc (sizeof (ShapeEventRec));
+ malloc (sizeof (ShapeEventRec));
if (!pNewShapeEvent)
return BadAlloc;
pNewShapeEvent->next = 0;
@@ -859,7 +850,7 @@ ProcShapeSelectInput (client)
*/
clientResource = FakeClientID (client->index);
pNewShapeEvent->clientResource = clientResource;
- if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent))
+ if (!AddResource (clientResource, ClientType, (void *)pNewShapeEvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
@@ -869,9 +860,9 @@ ProcShapeSelectInput (client)
*/
if (!pHead)
{
- pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr));
+ pHead = (ShapeEventPtr *) malloc (sizeof (ShapeEventPtr));
if (!pHead ||
- !AddResource (pWin->drawable.id, EventType, (pointer)pHead))
+ !AddResource (pWin->drawable.id, EventType, (void *)pHead))
{
FreeResource (clientResource, RT_NONE);
return BadAlloc;
@@ -896,7 +887,7 @@ ProcShapeSelectInput (client)
pNewShapeEvent->next = pShapeEvent->next;
else
*pHead = pShapeEvent->next;
- xfree (pShapeEvent);
+ free (pShapeEvent);
}
}
break;
@@ -917,7 +908,6 @@ SendShapeNotify (pWin, which)
int which;
{
ShapeEventPtr *pHead, pShapeEvent;
- ClientPtr client;
xShapeNotifyEvent se;
BoxRec extents;
RegionPtr region;
@@ -930,7 +920,7 @@ SendShapeNotify (pWin, which)
case ShapeBounding:
region = wBoundingShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -943,7 +933,7 @@ SendShapeNotify (pWin, which)
case ShapeClip:
region = wClipShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = 0;
@@ -956,7 +946,7 @@ SendShapeNotify (pWin, which)
case ShapeInput:
region = wInputShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -970,20 +960,16 @@ SendShapeNotify (pWin, which)
return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- client = pShapeEvent->client;
- if (client == serverClient || client->clientGone)
- continue;
se.type = ShapeNotify + ShapeEventBase;
se.kind = which;
se.window = pWin->drawable.id;
- se.sequenceNumber = client->sequence;
se.x = extents.x1;
se.y = extents.y1;
se.width = extents.x2 - extents.x1;
se.height = extents.y2 - extents.y1;
se.time = currentTime.milliseconds;
se.shaped = shaped;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se);
}
}
@@ -996,14 +982,13 @@ ProcShapeInputSelected (client)
ShapeEventPtr pShapeEvent, *pHead;
int enabled;
xShapeInputSelectedReply rep;
- register int n;
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
- pWin->drawable.id, EventType, SecurityReadAccess);
+ pWin->drawable.id, EventType, DixReadAccess);
enabled = xFalse;
if (pHead) {
for (pShapeEvent = *pHead;
@@ -1021,10 +1006,10 @@ ProcShapeInputSelected (client)
rep.sequenceNumber = client->sequence;
rep.enabled = enabled;
if (client->swapped) {
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
}
- WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
+ WriteToClient (client, sizeof (xShapeInputSelectedReply), &rep);
return (client->noClientException);
}
@@ -1038,7 +1023,6 @@ ProcShapeGetRectangles (client)
xRectangle *rects;
int nrects, i;
RegionPtr region;
- register int n;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
pWin = LookupWindow (stuff->window, client);
@@ -1060,7 +1044,7 @@ ProcShapeGetRectangles (client)
}
if (!region) {
nrects = 1;
- rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle));
+ rects = (xRectangle *) malloc (sizeof (xRectangle));
if (!rects)
return BadAlloc;
switch (stuff->kind) {
@@ -1085,9 +1069,9 @@ ProcShapeGetRectangles (client)
}
} else {
BoxPtr box;
- nrects = REGION_NUM_RECTS(region);
- box = REGION_RECTS(region);
- rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle));
+ nrects = RegionNumRects(region);
+ box = RegionRects(region);
+ rects = (xRectangle *) malloc (nrects * sizeof (xRectangle));
if (!rects && nrects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
@@ -1103,14 +1087,14 @@ ProcShapeGetRectangles (client)
rep.ordering = YXBanded;
rep.nrects = nrects;
if (client->swapped) {
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.nrects, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.nrects);
SwapShorts ((short *)rects, (unsigned long)nrects * 4);
}
- WriteToClient (client, sizeof (rep), (char *) &rep);
- WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
- DEALLOCATE_LOCAL (rects);
+ WriteToClient (client, sizeof (rep), &rep);
+ WriteToClient (client, nrects * sizeof (xRectangle), rects);
+ free (rects);
return client->noClientException;
}
@@ -1183,10 +1167,9 @@ static int
SProcShapeQueryVersion (client)
register ClientPtr client;
{
- register int n;
REQUEST (xShapeQueryVersionReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
return ProcShapeQueryVersion (client);
}
@@ -1194,14 +1177,13 @@ static int
SProcShapeRectangles (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeRectanglesReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
- swapl (&stuff->dest, n);
- swaps (&stuff->xOff, n);
- swaps (&stuff->yOff, n);
+ swapl (&stuff->dest);
+ swaps (&stuff->xOff);
+ swaps (&stuff->yOff);
SwapRestS(stuff);
return ProcShapeRectangles (client);
}
@@ -1210,15 +1192,14 @@ static int
SProcShapeMask (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeMaskReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeMaskReq);
- swapl (&stuff->dest, n);
- swaps (&stuff->xOff, n);
- swaps (&stuff->yOff, n);
- swapl (&stuff->src, n);
+ swapl (&stuff->dest);
+ swaps (&stuff->xOff);
+ swaps (&stuff->yOff);
+ swapl (&stuff->src);
return ProcShapeMask (client);
}
@@ -1226,15 +1207,14 @@ static int
SProcShapeCombine (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeCombineReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeCombineReq);
- swapl (&stuff->dest, n);
- swaps (&stuff->xOff, n);
- swaps (&stuff->yOff, n);
- swapl (&stuff->src, n);
+ swapl (&stuff->dest);
+ swaps (&stuff->xOff);
+ swaps (&stuff->yOff);
+ swapl (&stuff->src);
return ProcShapeCombine (client);
}
@@ -1242,14 +1222,13 @@ static int
SProcShapeOffset (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeOffsetReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeOffsetReq);
- swapl (&stuff->dest, n);
- swaps (&stuff->xOff, n);
- swaps (&stuff->yOff, n);
+ swapl (&stuff->dest);
+ swaps (&stuff->xOff);
+ swaps (&stuff->yOff);
return ProcShapeOffset (client);
}
@@ -1257,12 +1236,11 @@ static int
SProcShapeQueryExtents (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeQueryExtentsReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
- swapl (&stuff->window, n);
+ swapl (&stuff->window);
return ProcShapeQueryExtents (client);
}
@@ -1270,12 +1248,11 @@ static int
SProcShapeSelectInput (client)
register ClientPtr client;
{
- register char n;
REQUEST (xShapeSelectInputReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
- swapl (&stuff->window, n);
+ swapl (&stuff->window);
return ProcShapeSelectInput (client);
}
@@ -1283,12 +1260,11 @@ static int
SProcShapeInputSelected (client)
register ClientPtr client;
{
- register int n;
REQUEST (xShapeInputSelectedReq);
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
- swapl (&stuff->window, n);
+ swapl (&stuff->window);
return ProcShapeInputSelected (client);
}
@@ -1297,11 +1273,10 @@ SProcShapeGetRectangles (client)
register ClientPtr client;
{
REQUEST(xShapeGetRectanglesReq);
- register char n;
- swaps (&stuff->length, n);
+ swaps (&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
- swapl (&stuff->window, n);
+ swapl (&stuff->window);
return ProcShapeGetRectangles (client);
}
diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c
index f25bb9b5d..ca1ff9a7f 100644
--- a/nx-X11/programs/Xserver/Xext/shm.c
+++ b/nx-X11/programs/Xserver/Xext/shm.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.41 2003/12/17 23:28:56 alanh Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -27,7 +26,6 @@ in this Software without prior written authorization from The Open Group.
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
-/* $Xorg: shm.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
#define SHM
@@ -36,19 +34,12 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <sys/types.h>
-#ifndef Lynx
#include <sys/ipc.h>
#include <sys/shm.h>
-#else
-#include <ipc.h>
-#include <shm.h>
-#endif
#include <unistd.h>
#include <sys/stat.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@@ -61,18 +52,15 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#define _XSHM_SERVER_
#include <X11/extensions/shmstr.h>
-#include <X11/Xfuncproto.h>
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
+#include <nx-X11/Xfuncproto.h>
+
+#include "protocol-versions.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
-#include "modinit.h"
-
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
@@ -86,7 +74,7 @@ static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(
- pointer /* value */,
+ void * /* value */,
XID /* shmseg */
);
static void ShmResetProc(
@@ -162,7 +150,6 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
-#include <sys/signal.h>
static Bool badSysCall = FALSE;
@@ -179,7 +166,7 @@ static Bool CheckForShmSyscall()
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
- oldHandler = signal(SIGSYS, SigSysHandler);
+ oldHandler = OsSignal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
@@ -194,7 +181,7 @@ static Bool CheckForShmSyscall()
/* Allocation failed */
badSysCall = TRUE;
}
- signal(SIGSYS, oldHandler);
+ OsSignal(SIGSYS, oldHandler);
return(!badSysCall);
}
@@ -202,8 +189,9 @@ static Bool CheckForShmSyscall()
#endif
+#ifndef NXAGENT_SERVER
void
-ShmExtensionInit(INITARGS)
+ShmExtensionInit(void)
{
ExtensionEntry *extEntry;
int i;
@@ -265,6 +253,7 @@ ShmExtensionInit(INITARGS)
EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
}
}
+#endif /* NXAGENT_SERVER */
/*ARGSUSED*/
static void
@@ -309,7 +298,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
#else
char *base = (char *) pPixmap->devPrivate.ptr;
- if (base != (pointer) (pPixmap + 1))
+ if (base != (void *) (pPixmap + 1))
{
for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next)
{
@@ -321,7 +310,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
shmdesc = 0;
#endif
if (shmdesc)
- ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
+ ShmDetachSegment ((void *) shmdesc, pPixmap->drawable.id);
}
pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum];
@@ -343,27 +332,27 @@ ProcShmQueryVersion(client)
register ClientPtr client;
{
xShmQueryVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
+ memset(&rep, 0, sizeof(xShmQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.sharedPixmaps = sharedPixmaps;
rep.pixmapFormat = pixmapFormat;
- rep.majorVersion = SHM_MAJOR_VERSION;
- rep.minorVersion = SHM_MINOR_VERSION;
+ rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SHM_MINOR_VERSION;
rep.uid = geteuid();
rep.gid = getegid();
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- swaps(&rep.uid, n);
- swaps(&rep.gid, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ swaps(&rep.uid);
+ swaps(&rep.gid);
}
- WriteToClient(client, sizeof(xShmQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShmQueryVersionReply), &rep);
return (client->noClientException);
}
@@ -435,7 +424,7 @@ ProcShmAttach(client)
}
else
{
- shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec));
+ shmdesc = (ShmDescPtr) malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
shmdesc->addr = shmat(stuff->shmid, 0,
@@ -443,7 +432,7 @@ ProcShmAttach(client)
if ((shmdesc->addr == ((char *)-1)) ||
shmctl(stuff->shmid, IPC_STAT, &buf))
{
- xfree(shmdesc);
+ free(shmdesc);
return BadAccess;
}
@@ -453,7 +442,7 @@ ProcShmAttach(client)
if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
- xfree(shmdesc);
+ free(shmdesc);
return BadAccess;
}
@@ -464,7 +453,7 @@ ProcShmAttach(client)
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
}
- if (!AddResource(stuff->shmseg, ShmSegType, (pointer)shmdesc))
+ if (!AddResource(stuff->shmseg, ShmSegType, (void *)shmdesc))
return BadAlloc;
return(client->noClientException);
}
@@ -472,7 +461,7 @@ ProcShmAttach(client)
/*ARGSUSED*/
static int
ShmDetachSegment(value, shmseg)
- pointer value; /* must conform to DeleteType */
+ void * value; /* must conform to DeleteType */
XID shmseg;
{
ShmDescPtr shmdesc = (ShmDescPtr)value;
@@ -484,7 +473,7 @@ ShmDetachSegment(value, shmseg)
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
;
*prev = shmdesc->next;
- xfree(shmdesc);
+ free(shmdesc);
return Success;
}
@@ -501,6 +490,7 @@ ProcShmDetach(client)
return(client->noClientException);
}
+#ifndef NXAGENT_SERVER
static void
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
@@ -515,7 +505,8 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
putGC = GetScratchGC(depth, dst->pScreen);
if (!putGC)
return;
- pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth);
+ pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
if (!pmap)
{
FreeScratchGC(putGC);
@@ -547,7 +538,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
- BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
+ BitsPerPixel(depth), PixmapBytePad(w, depth), (void *)data);
if (!pPixmap)
return;
if (format == XYBitmap)
@@ -562,6 +553,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
data);
}
+#endif /* NXAGENT_SERVER */
#ifdef PANORAMIX
@@ -576,11 +568,11 @@ ProcPanoramiXShmPutImage(register ClientPtr client)
REQUEST_SIZE_MATCH(xShmPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -626,7 +618,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if (draw->type == XRT_PIXMAP)
@@ -668,6 +660,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+ memset(&xgi, 0, sizeof(xShmGetImageReply));
xgi.visual = wVisual(((WindowPtr)pDraw));
xgi.type = X_Reply;
xgi.length = 0;
@@ -706,13 +699,12 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
if (client->swapped) {
- register int n;
- swaps(&xgi.sequenceNumber, n);
- swapl(&xgi.length, n);
- swapl(&xgi.visual, n);
- swapl(&xgi.size, n);
+ swaps(&xgi.sequenceNumber);
+ swapl(&xgi.length);
+ swapl(&xgi.visual);
+ swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
return(client->noClientException);
}
@@ -773,7 +765,7 @@ CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
- if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ if(!(newPix = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@@ -793,12 +785,12 @@ CreatePmap:
if (pMap) {
#ifdef PIXPRIV
- pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
+ pMap->devPrivates[shmPixmapPrivate].ptr = (void *) shmdesc;
#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
- if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
+ if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *)pMap)) {
(*pScreen->DestroyPixmap)(pMap);
result = BadAlloc;
break;
@@ -814,7 +806,7 @@ CreatePmap:
(*pScreen->DestroyPixmap)(pMap);
FreeResource(newPix->info[j].id, RT_NONE);
}
- xfree(newPix);
+ free(newPix);
} else
AddResource(stuff->pid, XRT_PIXMAP, newPix);
@@ -823,6 +815,7 @@ CreatePmap:
#endif
+#ifndef NXAGENT_SERVER
static int
ProcShmPutImage(client)
register ClientPtr client;
@@ -921,9 +914,9 @@ ProcShmPutImage(client)
{
xShmCompletionEvent ev;
+ memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
- ev.sequenceNumber = client->sequence;
ev.minorEvent = X_ShmPutImage;
ev.majorEvent = ShmReqCode;
ev.shmseg = stuff->shmseg;
@@ -933,7 +926,7 @@ ProcShmPutImage(client)
return (client->noClientException);
}
-
+#endif /* NXAGENT_SERVER */
static int
@@ -945,7 +938,6 @@ ProcShmGetImage(client)
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
- int n;
REQUEST(xShmGetImageReq);
@@ -957,6 +949,9 @@ ProcShmGetImage(client)
}
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+
+ memset(&xgi, 0, sizeof(xShmGetImageReply));
+
if (pDraw->type == DRAWABLE_WINDOW)
{
if( /* check for being viewable */
@@ -1036,16 +1031,17 @@ ProcShmGetImage(client)
}
if (client->swapped) {
- swaps(&xgi.sequenceNumber, n);
- swapl(&xgi.length, n);
- swapl(&xgi.visual, n);
- swapl(&xgi.size, n);
+ swaps(&xgi.sequenceNumber);
+ swapl(&xgi.length);
+ swapl(&xgi.visual);
+ swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
return(client->noClientException);
}
+#ifndef NXAGENT_SERVER
static PixmapPtr
fbShmCreatePixmap (pScreen, width, height, depth, addr)
ScreenPtr pScreen;
@@ -1056,17 +1052,18 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
{
register PixmapPtr pPixmap;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth);
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
if (!pPixmap)
return NullPixmap;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
+ BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr)) {
(*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap;
}
return pPixmap;
}
+#endif /* NXAGENT_SERVER */
static int
ProcShmCreatePixmap(client)
@@ -1128,12 +1125,12 @@ CreatePmap:
if (pMap)
{
#ifdef PIXPRIV
- pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
+ pMap->devPrivates[shmPixmapPrivate].ptr = (void *) shmdesc;
#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
- if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
+ if (AddResource(stuff->pid, RT_PIXMAP, (void *)pMap))
{
return(client->noClientException);
}
@@ -1141,6 +1138,7 @@ CreatePmap:
return (BadAlloc);
}
+#ifndef NXAGENT_SERVER
static int
ProcShmDispatch (client)
register ClientPtr client;
@@ -1176,6 +1174,7 @@ ProcShmDispatch (client)
return BadRequest;
}
}
+#endif /* NXAGENT_SERVER */
static void
SShmCompletionEvent(from, to)
@@ -1194,10 +1193,9 @@ static int
SProcShmQueryVersion(client)
register ClientPtr client;
{
- register int n;
REQUEST(xShmQueryVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return ProcShmQueryVersion(client);
}
@@ -1205,12 +1203,11 @@ static int
SProcShmAttach(client)
ClientPtr client;
{
- register int n;
REQUEST(xShmAttachReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachReq);
- swapl(&stuff->shmseg, n);
- swapl(&stuff->shmid, n);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->shmid);
return ProcShmAttach(client);
}
@@ -1218,11 +1215,10 @@ static int
SProcShmDetach(client)
ClientPtr client;
{
- register int n;
REQUEST(xShmDetachReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmDetachReq);
- swapl(&stuff->shmseg, n);
+ swapl(&stuff->shmseg);
return ProcShmDetach(client);
}
@@ -1230,22 +1226,21 @@ static int
SProcShmPutImage(client)
ClientPtr client;
{
- register int n;
REQUEST(xShmPutImageReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmPutImageReq);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swaps(&stuff->totalWidth, n);
- swaps(&stuff->totalHeight, n);
- swaps(&stuff->srcX, n);
- swaps(&stuff->srcY, n);
- swaps(&stuff->srcWidth, n);
- swaps(&stuff->srcHeight, n);
- swaps(&stuff->dstX, n);
- swaps(&stuff->dstY, n);
- swapl(&stuff->shmseg, n);
- swapl(&stuff->offset, n);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->totalWidth);
+ swaps(&stuff->totalHeight);
+ swaps(&stuff->srcX);
+ swaps(&stuff->srcY);
+ swaps(&stuff->srcWidth);
+ swaps(&stuff->srcHeight);
+ swaps(&stuff->dstX);
+ swaps(&stuff->dstY);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->offset);
return ProcShmPutImage(client);
}
@@ -1253,18 +1248,17 @@ static int
SProcShmGetImage(client)
ClientPtr client;
{
- register int n;
REQUEST(xShmGetImageReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmGetImageReq);
- swapl(&stuff->drawable, n);
- swaps(&stuff->x, n);
- swaps(&stuff->y, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- swapl(&stuff->planeMask, n);
- swapl(&stuff->shmseg, n);
- swapl(&stuff->offset, n);
+ swapl(&stuff->drawable);
+ swaps(&stuff->x);
+ swaps(&stuff->y);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
+ swapl(&stuff->planeMask);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->offset);
return ProcShmGetImage(client);
}
@@ -1272,19 +1266,19 @@ static int
SProcShmCreatePixmap(client)
ClientPtr client;
{
- register int n;
REQUEST(xShmCreatePixmapReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
- swapl(&stuff->pid, n);
- swapl(&stuff->drawable, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- swapl(&stuff->shmseg, n);
- swapl(&stuff->offset, n);
+ swapl(&stuff->pid);
+ swapl(&stuff->drawable);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->offset);
return ProcShmCreatePixmap(client);
}
+#ifndef NXAGENT_SERVER
static int
SProcShmDispatch (client)
register ClientPtr client;
@@ -1308,3 +1302,4 @@ SProcShmDispatch (client)
return BadRequest;
}
}
+#endif /* NXAGENT_SERVER */
diff --git a/nx-X11/programs/Xserver/Xext/shmint.h b/nx-X11/programs/Xserver/Xext/shmint.h
new file mode 100644
index 000000000..5135d1729
--- /dev/null
+++ b/nx-X11/programs/Xserver/Xext/shmint.h
@@ -0,0 +1,44 @@
+/*
+ * $Id$
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SHMINT_H_
+#define _SHMINT_H_
+
+#define _XSHM_SERVER_
+#include <X11/extensions/shmstr.h>
+
+#include "screenint.h"
+#include "pixmap.h"
+#include "gc.h"
+
+void
+ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
+
+void
+ShmSetPixmapFormat(ScreenPtr pScreen, int format);
+
+void
+ShmRegisterFbFuncs(ScreenPtr pScreen);
+
+#endif /* _SHMINT_H_ */
diff --git a/nx-X11/programs/Xserver/Xext/sleepuntil.c b/nx-X11/programs/Xserver/Xext/sleepuntil.c
index 8e0008cab..1934828d4 100644
--- a/nx-X11/programs/Xserver/Xext/sleepuntil.c
+++ b/nx-X11/programs/Xserver/Xext/sleepuntil.c
@@ -25,7 +25,6 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
-/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.6 2003/07/16 01:38:30 dawes Exp $ */
/* dixsleep.c - implement millisecond timeouts for X clients */
@@ -34,8 +33,8 @@ in this Software without prior written authorization from The Open Group.
#endif
#include "sleepuntil.h"
-#include <X11/X.h>
-#include <X11/Xmd.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xmd.h>
#include "misc.h"
#include "windowstr.h"
#include "dixstruct.h"
@@ -49,10 +48,10 @@ typedef struct _Sertafied {
XID id;
void (*notifyFunc)(
ClientPtr /* client */,
- pointer /* closure */
+ void * /* closure */
);
- pointer closure;
+ void *closure;
} SertafiedRec, *SertafiedPtr;
static SertafiedPtr pPending;
@@ -62,21 +61,21 @@ static int SertafiedGeneration;
static void ClientAwaken(
ClientPtr /* client */,
- pointer /* closure */
+ void * /* closure */
);
static int SertafiedDelete(
- pointer /* value */,
+ void * /* value */,
XID /* id */
);
static void SertafiedBlockHandler(
- pointer /* data */,
+ void * /* data */,
OSTimePtr /* wt */,
- pointer /* LastSelectMask */
+ void * /* LastSelectMask */
);
static void SertafiedWakeupHandler(
- pointer /* data */,
+ void * /* data */,
int /* i */,
- pointer /* LastSelectMask */
+ void * /* LastSelectMask */
);
int
@@ -85,8 +84,8 @@ ClientSleepUntil (client, revive, notifyFunc, closure)
TimeStamp *revive;
void (*notifyFunc)(
ClientPtr /* client */,
- pointer /* closure */);
- pointer closure;
+ void * /* closure */);
+ void *closure;
{
SertafiedPtr pRequest, pReq, pPrev;
@@ -98,7 +97,7 @@ ClientSleepUntil (client, revive, notifyFunc, closure)
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
- pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec));
+ pRequest = (SertafiedPtr) malloc (sizeof (SertafiedRec));
if (!pRequest)
return FALSE;
pRequest->pClient = client;
@@ -109,15 +108,15 @@ ClientSleepUntil (client, revive, notifyFunc, closure)
{
if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
- (pointer) 0))
+ (void *) 0))
{
- xfree (pRequest);
+ free (pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
}
pRequest->notifyFunc = 0;
- if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
+ if (!AddResource (pRequest->id, SertafiedResType, (void *) pRequest))
return FALSE;
if (!notifyFunc)
notifyFunc = ClientAwaken;
@@ -142,7 +141,7 @@ ClientSleepUntil (client, revive, notifyFunc, closure)
static void
ClientAwaken (client, closure)
ClientPtr client;
- pointer closure;
+ void *closure;
{
if (!client->clientGone)
AttendClient (client);
@@ -151,7 +150,7 @@ ClientAwaken (client, closure)
static int
SertafiedDelete (value, id)
- pointer value;
+ void * value;
XID id;
{
SertafiedPtr pRequest = (SertafiedPtr)value;
@@ -169,15 +168,15 @@ SertafiedDelete (value, id)
}
if (pRequest->notifyFunc)
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
- xfree (pRequest);
+ free (pRequest);
return TRUE;
}
static void
SertafiedBlockHandler (data, wt, LastSelectMask)
- pointer data; /* unused */
+ void *data; /* unused */
OSTimePtr wt; /* wait time */
- pointer LastSelectMask;
+ void *LastSelectMask;
{
SertafiedPtr pReq, pNext;
unsigned long delay;
@@ -211,9 +210,9 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
static void
SertafiedWakeupHandler (data, i, LastSelectMask)
- pointer data;
+ void * data;
int i;
- pointer LastSelectMask;
+ void * LastSelectMask;
{
SertafiedPtr pReq, pNext;
TimeStamp now;
@@ -233,7 +232,7 @@ SertafiedWakeupHandler (data, i, LastSelectMask)
{
RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
- (pointer) 0);
+ (void *) 0);
BlockHandlerRegistered = FALSE;
}
}
diff --git a/nx-X11/programs/Xserver/Xext/sleepuntil.h b/nx-X11/programs/Xserver/Xext/sleepuntil.h
index 0b99148a4..c9c0f1478 100644
--- a/nx-X11/programs/Xserver/Xext/sleepuntil.h
+++ b/nx-X11/programs/Xserver/Xext/sleepuntil.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.h,v 1.2 2003/11/17 22:20:27 dawes Exp $ */
/*
* Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -39,9 +38,9 @@ extern int ClientSleepUntil(
TimeStamp *revive,
void (*notifyFunc)(
ClientPtr /* client */,
- pointer /* closure */
+ void * /* closure */
),
- pointer Closure
+ void * Closure
);
#endif
diff --git a/nx-X11/programs/Xserver/Xext/sync.c b/nx-X11/programs/Xserver/Xext/sync.c
index 0e0df8305..7fa6145a6 100644
--- a/nx-X11/programs/Xserver/Xext/sync.c
+++ b/nx-X11/programs/Xserver/Xext/sync.c
@@ -1,4 +1,3 @@
-/* $Xorg: sync.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
/*
Copyright 1991, 1993, 1998 The Open Group
@@ -50,17 +49,16 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.13 2003/09/02 18:19:01 tsi Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xmd.h>
+#include <string.h>
+
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
+#include <nx-X11/Xmd.h>
#include "misc.h"
#include "os.h"
#include "extnsionst.h"
@@ -68,19 +66,14 @@ PERFORMANCE OF THIS SOFTWARE.
#include "resource.h"
#include "opaque.h"
#define _SYNC_SERVER
-#include <X11/extensions/sync.h>
-#include <X11/extensions/syncstr.h>
+#include <nx-X11/extensions/sync.h>
+#include <nx-X11/extensions/syncstr.h>
+#include "protocol-versions.h"
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#else
#include <stdio.h>
-#if !defined(WIN32) && !defined(Lynx)
+#if !defined(WIN32)
#include <sys/time.h>
#endif
-#endif
-
-#include "modinit.h"
/*
* Local Global Variables
@@ -103,40 +96,40 @@ static SyncCounter **SysCounterList = NULL;
static int
FreeAlarm(
- pointer /* addr */,
+ void * /* addr */,
XID /* id */
);
static int
FreeAlarmClient(
- pointer /* value */,
+ void * /* value */,
XID /* id */
);
static int
FreeAwait(
- pointer /* addr */,
+ void * /* addr */,
XID /* id */
);
static void
ServertimeBracketValues(
- pointer /* pCounter */,
+ void * /* pCounter */,
CARD64 * /* pbracket_less */,
CARD64 * /* pbracket_greater */
);
static void
ServertimeQueryValue(
- pointer /* pCounter */,
+ void * /* pCounter */,
CARD64 * /* pValue_return */
);
static void
ServertimeWakeupHandler(
- pointer /* env */,
+ void * /* env */,
int /* rc */,
- pointer /* LastSelectMask */
+ void * /* LastSelectMask */
);
static int
@@ -161,9 +154,9 @@ SCounterNotifyEvent(
static void
ServertimeBlockHandler(
- pointer /* env */,
+ void * /* env */,
struct timeval ** /* wt */,
- pointer /* LastSelectMask */
+ void * /* LastSelectMask */
);
static int
@@ -318,7 +311,7 @@ SyncDeleteTriggerFromCounter(pTrigger)
pPrev->next = pCur->next;
else
pTrigger->pCounter->pTriglist = pCur->next;
- xfree(pCur);
+ free(pCur);
break;
}
}
@@ -344,7 +337,7 @@ SyncAddTriggerToCounter(pTrigger)
return Success;
}
- if (!(pCur = (SyncTriggerList *)xalloc(sizeof(SyncTriggerList))))
+ if (!(pCur = (SyncTriggerList *)malloc(sizeof(SyncTriggerList))))
return BadAlloc;
pCur->pTrigger = pTrigger;
@@ -432,7 +425,7 @@ SyncInitTrigger(client, pTrigger, counter, changes)
if (counter == None)
pCounter = NULL;
else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType(
- client, counter, RTCounter, SecurityReadAccess)))
+ client, counter, RTCounter, DixReadAccess)))
{
client->errorValue = counter;
return SyncErrorBase + XSyncBadCounter;
@@ -449,7 +442,7 @@ SyncInitTrigger(client, pTrigger, counter, changes)
if (IsSystemCounter(pCounter))
{
- (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter,
&pCounter->value);
}
@@ -544,7 +537,6 @@ SyncSendAlarmNotifyEvents(pAlarm)
ane.type = SyncEventBase + XSyncAlarmNotify;
ane.kind = XSyncAlarmNotify;
- ane.sequenceNumber = pAlarm->client->sequence;
ane.alarm = pAlarm->alarm_id;
if (pTrigger->pCounter)
{
@@ -562,18 +554,12 @@ SyncSendAlarmNotifyEvents(pAlarm)
ane.state = pAlarm->state;
/* send to owner */
- if (pAlarm->events && !pAlarm->client->clientGone)
+ if (pAlarm->events)
WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
/* send to other interested clients */
for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next)
- {
- if (!pAlarm->client->clientGone)
- {
- ane.sequenceNumber = pcl->client->sequence;
- WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
- }
- }
+ WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
}
@@ -592,7 +578,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
if (client->clientGone)
return;
pev = pEvents = (xSyncCounterNotifyEvent *)
- ALLOCATE_LOCAL(num_events * sizeof(xSyncCounterNotifyEvent));
+ malloc(num_events * sizeof(xSyncCounterNotifyEvent));
if (!pEvents)
return;
UpdateCurrentTime();
@@ -601,7 +587,6 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
SyncTrigger *pTrigger = &(*ppAwait)->trigger;
pev->type = SyncEventBase + XSyncCounterNotify;
pev->kind = XSyncCounterNotify;
- pev->sequenceNumber = client->sequence;
pev->counter = pTrigger->pCounter->id;
pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value);
pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
@@ -613,7 +598,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
}
/* swapping will be taken care of by this */
WriteEventsToClient(client, num_events, (xEvent *)pEvents);
- DEALLOCATE_LOCAL(pEvents);
+ free(pEvents);
}
@@ -723,7 +708,7 @@ SyncAwaitTriggerFired(pTrigger)
pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions;
- ppAwait = (SyncAwait **)ALLOCATE_LOCAL(numwaits * sizeof(SyncAwait *));
+ ppAwait = (SyncAwait **)malloc(numwaits * sizeof(SyncAwait *));
if (!ppAwait)
goto bail;
@@ -792,7 +777,7 @@ SyncAwaitTriggerFired(pTrigger)
if (num_events)
SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
num_events);
- DEALLOCATE_LOCAL(ppAwait);
+ free(ppAwait);
bail:
/* unblock the client */
@@ -878,7 +863,7 @@ SyncEventSelectForAlarm(pAlarm, client, wantevents)
/* add new client to pAlarm->pEventClients */
- pClients = (SyncAlarmClientList *) xalloc(sizeof(SyncAlarmClientList));
+ pClients = (SyncAlarmClientList *) malloc(sizeof(SyncAlarmClientList));
if (!pClients)
return BadAlloc;
@@ -889,7 +874,7 @@ SyncEventSelectForAlarm(pAlarm, client, wantevents)
pClients->delete_id = FakeClientID(client->index);
if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
{
- xfree(pClients);
+ free(pClients);
return BadAlloc;
}
@@ -1013,12 +998,12 @@ SyncCreateCounter(client, id, initialvalue)
{
SyncCounter *pCounter;
- if (!(pCounter = (SyncCounter *) xalloc(sizeof(SyncCounter))))
+ if (!(pCounter = (SyncCounter *) malloc(sizeof(SyncCounter))))
return (SyncCounter *)NULL;
- if (!AddResource(id, RTCounter, (pointer) pCounter))
+ if (!AddResource(id, RTCounter, (void *) pCounter))
{
- xfree((pointer) pCounter);
+ free((void *) pCounter);
return (SyncCounter *)NULL;
}
@@ -1032,7 +1017,7 @@ SyncCreateCounter(client, id, initialvalue)
}
static int FreeCounter(
- pointer /*env*/,
+ void * /*env*/,
XID /*id*/
);
@@ -1040,7 +1025,7 @@ static int FreeCounter(
* ***** System Counter utilities
*/
-pointer
+void *
SyncCreateSystemCounter(name, initial, resolution, counterType,
QueryValue, BracketValues)
char *name;
@@ -1048,19 +1033,19 @@ SyncCreateSystemCounter(name, initial, resolution, counterType,
CARD64 resolution;
SyncCounterType counterType;
void (*QueryValue) (
- pointer /* pCounter */,
+ void * /* pCounter */,
CARD64 * /* pValue_return */);
void (*BracketValues) (
- pointer /* pCounter */,
+ void * /* pCounter */,
CARD64 * /* pbracket_less */,
CARD64 * /* pbracket_greater */);
{
SyncCounter *pCounter;
- SysCounterList = (SyncCounter **)xrealloc(SysCounterList,
+ SysCounterList = (SyncCounter **)realloc(SysCounterList,
(SyncNumSystemCounters+1)*sizeof(SyncCounter *));
if (!SysCounterList)
- return (pointer)NULL;
+ return (void *)NULL;
/* this function may be called before SYNC has been initialized, so we
* have to make sure RTCounter is created.
@@ -1070,7 +1055,7 @@ SyncCreateSystemCounter(name, initial, resolution, counterType,
RTCounter = CreateNewResourceType(FreeCounter);
if (RTCounter == 0)
{
- return (pointer)NULL;
+ return (void *)NULL;
}
}
@@ -1080,11 +1065,11 @@ SyncCreateSystemCounter(name, initial, resolution, counterType,
{
SysCounterInfo *psci;
- psci = (SysCounterInfo *)xalloc(sizeof(SysCounterInfo));
+ psci = (SysCounterInfo *)malloc(sizeof(SysCounterInfo));
if (!psci)
{
FreeResource(pCounter->id, RT_NONE);
- return (pointer) pCounter;
+ return (void *) pCounter;
}
pCounter->pSysCounterInfo = psci;
psci->name = name;
@@ -1096,12 +1081,12 @@ SyncCreateSystemCounter(name, initial, resolution, counterType,
XSyncMinValue(&psci->bracket_less);
SysCounterList[SyncNumSystemCounters++] = pCounter;
}
- return (pointer) pCounter;
+ return (void *) pCounter;
}
void
SyncDestroySystemCounter(pSysCounter)
- pointer pSysCounter;
+ void * pSysCounter;
{
SyncCounter *pCounter = (SyncCounter *)pSysCounter;
FreeResource(pCounter->id, RT_NONE);
@@ -1186,7 +1171,7 @@ SyncComputeBracketValues(pCounter, startOver)
if (pnewgtval || pnewltval)
{
- (*psci->BracketValues)((pointer)pCounter, pnewltval, pnewgtval);
+ (*psci->BracketValues)((void *)pCounter, pnewltval, pnewgtval);
}
}
@@ -1197,7 +1182,7 @@ SyncComputeBracketValues(pCounter, startOver)
/* ARGSUSED */
static int
FreeAlarm(addr, id)
- pointer addr;
+ void *addr;
XID id;
{
SyncAlarm *pAlarm = (SyncAlarm *) addr;
@@ -1213,7 +1198,7 @@ FreeAlarm(addr, id)
SyncDeleteTriggerFromCounter(&pAlarm->trigger);
- xfree(pAlarm);
+ free(pAlarm);
return Success;
}
@@ -1224,7 +1209,7 @@ FreeAlarm(addr, id)
/* ARGSUSED */
static int
FreeCounter(env, id)
- pointer env;
+ void *env;
XID id;
{
SyncCounter *pCounter = (SyncCounter *) env;
@@ -1236,13 +1221,13 @@ FreeCounter(env, id)
{
(*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
pnext = ptl->next;
- xfree(ptl); /* destroy the trigger list as we go */
+ free(ptl); /* destroy the trigger list as we go */
}
if (IsSystemCounter(pCounter))
{
int i, found = 0;
- xfree(pCounter->pSysCounterInfo);
+ free(pCounter->pSysCounterInfo);
/* find the counter in the list of system counters and remove it */
@@ -1266,7 +1251,7 @@ FreeCounter(env, id)
}
SyncNumSystemCounters--;
}
- xfree(pCounter);
+ free(pCounter);
return Success;
}
@@ -1276,7 +1261,7 @@ FreeCounter(env, id)
/* ARGSUSED */
static int
FreeAwait(addr, id)
- pointer addr;
+ void *addr;
XID id;
{
SyncAwaitUnion *pAwaitUnion = (SyncAwaitUnion *) addr;
@@ -1297,14 +1282,14 @@ FreeAwait(addr, id)
if (pCounter && !pCounter->beingDestroyed)
SyncDeleteTriggerFromCounter(&pAwait->trigger);
}
- xfree(pAwaitUnion);
+ free(pAwaitUnion);
return Success;
}
/* loosely based on dix/events.c/OtherClientGone */
static int
FreeAlarmClient(value, id)
- pointer value; /* must conform to DeleteType */
+ void * value; /* must conform to DeleteType */
XID id;
{
SyncAlarm *pAlarm = (SyncAlarm *)value;
@@ -1320,7 +1305,7 @@ FreeAlarmClient(value, id)
pPrev->next = pCur->next;
else
pAlarm->pEventClients = pCur->next;
- xfree(pCur);
+ free(pCur);
return(Success);
}
}
@@ -1342,21 +1327,21 @@ ProcSyncInitialize(client)
ClientPtr client;
{
xSyncInitializeReply rep;
- int n;
REQUEST_SIZE_MATCH(xSyncInitializeReq);
+ memset(&rep, 0, sizeof(xSyncInitializeReply));
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = SYNC_MAJOR_VERSION;
- rep.minorVersion = SYNC_MINOR_VERSION;
+ rep.majorVersion = SERVER_SYNC_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
rep.length = 0;
if (client->swapped)
{
- swaps(&rep.sequenceNumber, n);
+ swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, sizeof(rep), &rep);
return (client->noClientException);
}
@@ -1386,7 +1371,7 @@ ProcSyncListSystemCounters(client)
if (len)
{
- walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len);
+ walklist = list = (xSyncSystemCounter *) malloc(len);
if (!list)
return BadAlloc;
}
@@ -1395,10 +1380,9 @@ ProcSyncListSystemCounters(client)
if (client->swapped)
{
- register char n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.nCounters, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.nCounters);
}
for (i = 0; i < SyncNumSystemCounters; i++)
@@ -1415,11 +1399,10 @@ ProcSyncListSystemCounters(client)
if (client->swapped)
{
- register char n;
- swapl(&walklist->counter, n);
- swapl(&walklist->resolution_hi, n);
- swapl(&walklist->resolution_lo, n);
- swaps(&walklist->name_length, n);
+ swapl(&walklist->counter);
+ swapl(&walklist->resolution_hi);
+ swapl(&walklist->resolution_lo);
+ swaps(&walklist->name_length);
}
pname_in_reply = ((char *)walklist) + sz_xSyncSystemCounter;
@@ -1428,11 +1411,11 @@ ProcSyncListSystemCounters(client)
((sz_xSyncSystemCounter + namelen + 3) & ~3));
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, sizeof(rep), &rep);
if (len)
{
- WriteToClient(client, len, (char *) list);
- DEALLOCATE_LOCAL(list);
+ WriteToClient(client, len, list);
+ free(list);
}
return (client->noClientException);
@@ -1500,12 +1483,11 @@ ProcSyncGetPriority(client)
if (client->swapped)
{
- register char n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.priority, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.priority);
}
- WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
return (client->noClientException);
}
@@ -1545,7 +1527,7 @@ ProcSyncSetCounter(client)
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid,
- RTCounter, SecurityWriteAccess);
+ RTCounter, DixWriteAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->cid;
@@ -1578,7 +1560,7 @@ ProcSyncChangeCounter(client)
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid,
- RTCounter, SecurityWriteAccess);
+ RTCounter, DixWriteAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->cid;
@@ -1616,7 +1598,7 @@ ProcSyncDestroyCounter(client)
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
- RTCounter, SecurityDestroyAccess);
+ RTCounter, DixDestroyAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->counter;
@@ -1668,7 +1650,7 @@ ProcSyncAwait(client)
/* all the memory for the entire await list is allocated
* here in one chunk
*/
- pAwaitUnion = (SyncAwaitUnion *)xalloc((items+1) * sizeof(SyncAwaitUnion));
+ pAwaitUnion = (SyncAwaitUnion *)malloc((items+1) * sizeof(SyncAwaitUnion));
if (!pAwaitUnion)
return BadAlloc;
@@ -1677,7 +1659,7 @@ ProcSyncAwait(client)
pAwaitUnion->header.delete_id = FakeClientID(client->index);
if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
{
- xfree(pAwaitUnion);
+ free(pAwaitUnion);
return BadAlloc;
}
@@ -1762,7 +1744,7 @@ ProcSyncQueryCounter(client)
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
- RTCounter, SecurityReadAccess);
+ RTCounter, DixReadAccess);
if (pCounter == NULL)
{
client->errorValue = stuff->counter;
@@ -1777,7 +1759,7 @@ ProcSyncQueryCounter(client)
if (IsSystemCounter(pCounter))
{
- (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter,
&pCounter->value);
}
@@ -1785,13 +1767,12 @@ ProcSyncQueryCounter(client)
rep.value_lo = XSyncValueLow32(pCounter->value);
if (client->swapped)
{
- register char n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.value_hi, n);
- swapl(&rep.value_lo, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.value_hi);
+ swapl(&rep.value_lo);
}
- WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
return (client->noClientException);
}
@@ -1819,7 +1800,7 @@ ProcSyncCreateAlarm(client)
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
return BadLength;
- if (!(pAlarm = (SyncAlarm *) xalloc(sizeof(SyncAlarm))))
+ if (!(pAlarm = (SyncAlarm *) malloc(sizeof(SyncAlarm))))
{
return BadAlloc;
}
@@ -1836,7 +1817,7 @@ ProcSyncCreateAlarm(client)
status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger);
if (status != Success)
{
- xfree(pAlarm);
+ free(pAlarm);
return status;
}
@@ -1850,13 +1831,13 @@ ProcSyncCreateAlarm(client)
(CARD32 *)&stuff[1]);
if (status != Success)
{
- xfree(pAlarm);
+ free(pAlarm);
return status;
}
if (!AddResource(stuff->id, RTAlarm, pAlarm))
{
- xfree(pAlarm);
+ free(pAlarm);
return BadAlloc;
}
@@ -1891,7 +1872,7 @@ ProcSyncChangeAlarm(client)
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
- RTAlarm, SecurityWriteAccess)))
+ RTAlarm, DixWriteAccess)))
{
client->errorValue = stuff->alarm;
return SyncErrorBase + XSyncBadAlarm;
@@ -1932,7 +1913,7 @@ ProcSyncQueryAlarm(client)
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
- RTAlarm, SecurityReadAccess);
+ RTAlarm, DixReadAccess);
if (!pAlarm)
{
client->errorValue = stuff->alarm;
@@ -1967,18 +1948,17 @@ ProcSyncQueryAlarm(client)
if (client->swapped)
{
- register char n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.counter, n);
- swapl(&rep.wait_value_hi, n);
- swapl(&rep.wait_value_lo, n);
- swapl(&rep.test_type, n);
- swapl(&rep.delta_hi, n);
- swapl(&rep.delta_lo, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.counter);
+ swapl(&rep.wait_value_hi);
+ swapl(&rep.wait_value_lo);
+ swapl(&rep.test_type);
+ swapl(&rep.delta_hi);
+ swapl(&rep.delta_lo);
}
- WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
return (client->noClientException);
}
@@ -1992,7 +1972,7 @@ ProcSyncDestroyAlarm(client)
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
if (!((SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
- RTAlarm, SecurityDestroyAccess)))
+ RTAlarm, DixDestroyAccess)))
{
client->errorValue = stuff->alarm;
return SyncErrorBase + XSyncBadAlarm;
@@ -2056,9 +2036,8 @@ SProcSyncInitialize(client)
ClientPtr client;
{
REQUEST(xSyncInitializeReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncInitializeReq);
return ProcSyncInitialize(client);
@@ -2069,9 +2048,8 @@ SProcSyncListSystemCounters(client)
ClientPtr client;
{
REQUEST(xSyncListSystemCountersReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncListSystemCountersReq);
return ProcSyncListSystemCounters(client);
@@ -2082,13 +2060,12 @@ SProcSyncCreateCounter(client)
ClientPtr client;
{
REQUEST(xSyncCreateCounterReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncCreateCounterReq);
- swapl(&stuff->cid, n);
- swapl(&stuff->initial_value_lo, n);
- swapl(&stuff->initial_value_hi, n);
+ swapl(&stuff->cid);
+ swapl(&stuff->initial_value_lo);
+ swapl(&stuff->initial_value_hi);
return ProcSyncCreateCounter(client);
}
@@ -2098,13 +2075,12 @@ SProcSyncSetCounter(client)
ClientPtr client;
{
REQUEST(xSyncSetCounterReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncSetCounterReq);
- swapl(&stuff->cid, n);
- swapl(&stuff->value_lo, n);
- swapl(&stuff->value_hi, n);
+ swapl(&stuff->cid);
+ swapl(&stuff->value_lo);
+ swapl(&stuff->value_hi);
return ProcSyncSetCounter(client);
}
@@ -2114,13 +2090,12 @@ SProcSyncChangeCounter(client)
ClientPtr client;
{
REQUEST(xSyncChangeCounterReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncChangeCounterReq);
- swapl(&stuff->cid, n);
- swapl(&stuff->value_lo, n);
- swapl(&stuff->value_hi, n);
+ swapl(&stuff->cid);
+ swapl(&stuff->value_lo);
+ swapl(&stuff->value_hi);
return ProcSyncChangeCounter(client);
}
@@ -2130,11 +2105,10 @@ SProcSyncQueryCounter(client)
ClientPtr client;
{
REQUEST(xSyncQueryCounterReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncQueryCounterReq);
- swapl(&stuff->counter, n);
+ swapl(&stuff->counter);
return ProcSyncQueryCounter(client);
}
@@ -2144,11 +2118,10 @@ SProcSyncDestroyCounter(client)
ClientPtr client;
{
REQUEST(xSyncDestroyCounterReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncDestroyCounterReq);
- swapl(&stuff->counter, n);
+ swapl(&stuff->counter);
return ProcSyncDestroyCounter(client);
}
@@ -2158,9 +2131,8 @@ SProcSyncAwait(client)
ClientPtr client;
{
REQUEST(xSyncAwaitReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
SwapRestL(stuff);
@@ -2173,12 +2145,11 @@ SProcSyncCreateAlarm(client)
ClientPtr client;
{
REQUEST(xSyncCreateAlarmReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
- swapl(&stuff->id, n);
- swapl(&stuff->valueMask, n);
+ swapl(&stuff->id);
+ swapl(&stuff->valueMask);
SwapRestL(stuff);
return ProcSyncCreateAlarm(client);
@@ -2189,12 +2160,11 @@ SProcSyncChangeAlarm(client)
ClientPtr client;
{
REQUEST(xSyncChangeAlarmReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
- swapl(&stuff->alarm, n);
- swapl(&stuff->valueMask, n);
+ swapl(&stuff->alarm);
+ swapl(&stuff->valueMask);
SwapRestL(stuff);
return ProcSyncChangeAlarm(client);
}
@@ -2204,11 +2174,10 @@ SProcSyncQueryAlarm(client)
ClientPtr client;
{
REQUEST(xSyncQueryAlarmReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncQueryAlarmReq);
- swapl(&stuff->alarm, n);
+ swapl(&stuff->alarm);
return ProcSyncQueryAlarm(client);
}
@@ -2218,11 +2187,10 @@ SProcSyncDestroyAlarm(client)
ClientPtr client;
{
REQUEST(xSyncDestroyAlarmReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq);
- swapl(&stuff->alarm, n);
+ swapl(&stuff->alarm);
return ProcSyncDestroyAlarm(client);
}
@@ -2232,12 +2200,11 @@ SProcSyncSetPriority(client)
ClientPtr client;
{
REQUEST(xSyncSetPriorityReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncSetPriorityReq);
- swapl(&stuff->id, n);
- swapl(&stuff->priority, n);
+ swapl(&stuff->id);
+ swapl(&stuff->priority);
return ProcSyncSetPriority(client);
}
@@ -2247,11 +2214,10 @@ SProcSyncGetPriority(client)
ClientPtr client;
{
REQUEST(xSyncGetPriorityReq);
- register char n;
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH (xSyncGetPriorityReq);
- swapl(&stuff->id, n);
+ swapl(&stuff->id);
return ProcSyncGetPriority(client);
}
@@ -2344,7 +2310,7 @@ static void
SyncResetProc(extEntry)
ExtensionEntry *extEntry;
{
- xfree(SysCounterList);
+ free(SysCounterList);
SysCounterList = NULL;
RTCounter = 0;
}
@@ -2354,7 +2320,7 @@ SyncResetProc(extEntry)
* ** Initialise the extension.
*/
void
-SyncExtensionInit(INITARGS)
+SyncExtensionInit(void)
{
ExtensionEntry *extEntry;
@@ -2405,7 +2371,7 @@ SyncExtensionInit(INITARGS)
-static pointer ServertimeCounter;
+static void * ServertimeCounter;
static XSyncValue Now;
static XSyncValue *pnext_time;
@@ -2423,9 +2389,9 @@ static XSyncValue *pnext_time;
*/
/*ARGSUSED*/
static void ServertimeBlockHandler(env, wt, LastSelectMask)
-pointer env;
+void * env;
struct timeval **wt;
-pointer LastSelectMask;
+void * LastSelectMask;
{
XSyncValue delay;
unsigned long timeout;
@@ -2454,9 +2420,9 @@ pointer LastSelectMask;
*/
/*ARGSUSED*/
static void ServertimeWakeupHandler(env, rc, LastSelectMask)
-pointer env;
+void * env;
int rc;
-pointer LastSelectMask;
+void * LastSelectMask;
{
if (pnext_time)
{
@@ -2471,7 +2437,7 @@ pointer LastSelectMask;
static void
ServertimeQueryValue(pCounter, pValue_return)
- pointer pCounter;
+ void * pCounter;
CARD64 *pValue_return;
{
GetTime();
@@ -2480,7 +2446,7 @@ ServertimeQueryValue(pCounter, pValue_return)
static void
ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater)
- pointer pCounter;
+ void * pCounter;
CARD64 *pbracket_less;
CARD64 *pbracket_greater;
{
diff --git a/nx-X11/programs/Xserver/Xext/vidmodeproc.h b/nx-X11/programs/Xserver/Xext/vidmodeproc.h
deleted file mode 100644
index 918d1e4df..000000000
--- a/nx-X11/programs/Xserver/Xext/vidmodeproc.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/vidmodeproc.h,v 1.4 1999/12/13 01:39:40 robin Exp $ */
-
-/* Prototypes for DGA functions that the DDX must provide */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _VIDMODEPROC_H_
-#define _VIDMODEPROC_H_
-
-
-typedef enum {
- VIDMODE_H_DISPLAY,
- VIDMODE_H_SYNCSTART,
- VIDMODE_H_SYNCEND,
- VIDMODE_H_TOTAL,
- VIDMODE_H_SKEW,
- VIDMODE_V_DISPLAY,
- VIDMODE_V_SYNCSTART,
- VIDMODE_V_SYNCEND,
- VIDMODE_V_TOTAL,
- VIDMODE_FLAGS,
- VIDMODE_CLOCK
-} VidModeSelectMode;
-
-typedef enum {
- VIDMODE_MON_VENDOR,
- VIDMODE_MON_MODEL,
- VIDMODE_MON_NHSYNC,
- VIDMODE_MON_NVREFRESH,
- VIDMODE_MON_HSYNC_LO,
- VIDMODE_MON_HSYNC_HI,
- VIDMODE_MON_VREFRESH_LO,
- VIDMODE_MON_VREFRESH_HI
-} VidModeSelectMonitor;
-
-typedef union {
- pointer ptr;
- int i;
- float f;
-} vidMonitorValue;
-
-void XFree86VidModeExtensionInit(void);
-
-Bool VidModeAvailable(int scrnIndex);
-Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock);
-Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock);
-Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock);
-Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
-Bool VidModeZoomViewport(int scrnIndex, int zoom);
-Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
-Bool VidModeSetViewPort(int scrnIndex, int x, int y);
-Bool VidModeSwitchMode(int scrnIndex, pointer mode);
-Bool VidModeLockZoom(int scrnIndex, Bool lock);
-Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
-int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
-Bool VidModeGetClocks(int scrnIndex, int *Clocks);
-ModeStatus VidModeCheckModeForMonitor(int scrnIndex, pointer mode);
-ModeStatus VidModeCheckModeForDriver(int scrnIndex, pointer mode);
-void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
-Bool VidModeAddModeline(int scrnIndex, pointer mode);
-int VidModeGetDotClock(int scrnIndex, int Clock);
-int VidModeGetNumOfModes(int scrnIndex);
-Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
-Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
-pointer VidModeCreateMode(void);
-void VidModeCopyMode(pointer modefrom, pointer modeto);
-int VidModeGetModeValue(pointer mode, int valtyp);
-void VidModeSetModeValue(pointer mode, int valtyp, int val);
-vidMonitorValue VidModeGetMonitorValue(pointer monitor, int valtyp, int indx);
-Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
-Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
-int VidModeGetGammaRampSize(int scrnIndex);
-
-#endif
-
-
diff --git a/nx-X11/programs/Xserver/Xext/xcmisc.c b/nx-X11/programs/Xserver/Xext/xcmisc.c
index c7bb72d9b..bb47df979 100644
--- a/nx-X11/programs/Xserver/Xext/xcmisc.c
+++ b/nx-X11/programs/Xserver/Xext/xcmisc.c
@@ -1,4 +1,3 @@
-/* $Xorg: xcmisc.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
/*
Copyright 1993, 1998 The Open Group
@@ -26,10 +25,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.7 2003/10/28 23:08:43 tsi Exp $ */
-#define NEED_EVENTS
-#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -41,14 +37,9 @@ from The Open Group.
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
-#include <X11/extensions/xcmiscstr.h>
-#include "modinit.h"
+#include <nx-X11/extensions/xcmiscstr.h>
-#if HAVE_STDINT_H
#include <stdint.h>
-#elif !defined(UINT32_MAX)
-#define UINT32_MAX 0xffffffffU
-#endif
#if 0
static unsigned char XCMiscCode;
@@ -68,7 +59,7 @@ static DISPATCH_PROC(SProcXCMiscGetXIDList);
static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void
-XCMiscExtensionInit(INITARGS)
+XCMiscExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
@@ -98,7 +89,6 @@ ProcXCMiscGetVersion(client)
register ClientPtr client;
{
xXCMiscGetVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
rep.type = X_Reply;
@@ -107,11 +97,11 @@ ProcXCMiscGetVersion(client)
rep.majorVersion = XCMiscMajorVersion;
rep.minorVersion = XCMiscMinorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
return(client->noClientException);
}
@@ -120,7 +110,6 @@ ProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
xXCMiscGetXIDRangeReply rep;
- register int n;
XID min_id, max_id;
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
@@ -131,11 +120,11 @@ ProcXCMiscGetXIDRange(client)
rep.start_id = min_id;
rep.count = max_id - min_id + 1;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.start_id, n);
- swapl(&rep.count, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.start_id);
+ swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
return(client->noClientException);
}
@@ -145,7 +134,6 @@ ProcXCMiscGetXIDList(client)
{
REQUEST(xXCMiscGetXIDListReq);
xXCMiscGetXIDListReply rep;
- register int n;
XID *pids;
unsigned int count;
@@ -154,7 +142,7 @@ ProcXCMiscGetXIDList(client)
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
- pids = (XID *)Xalloc(stuff->count * sizeof(XID));
+ pids = (XID *)malloc(stuff->count * sizeof(XID));
if (!pids)
{
return BadAlloc;
@@ -165,17 +153,17 @@ ProcXCMiscGetXIDList(client)
rep.length = count;
rep.count = count;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.count, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
if (count)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
- Xfree(pids);
+ free(pids);
return(client->noClientException);
}
@@ -201,13 +189,12 @@ static int
SProcXCMiscGetVersion(client)
register ClientPtr client;
{
- register int n;
REQUEST(xXCMiscGetVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion, n);
+ swaps(&stuff->majorVersion);
+ swaps(&stuff->minorVersion);
return ProcXCMiscGetVersion(client);
}
@@ -215,10 +202,9 @@ static int
SProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
- register int n;
REQUEST(xReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return ProcXCMiscGetXIDRange(client);
}
@@ -226,11 +212,11 @@ static int
SProcXCMiscGetXIDList(client)
register ClientPtr client;
{
- register int n;
REQUEST(xXCMiscGetXIDListReq);
+ REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
- swaps(&stuff->length, n);
- swapl(&stuff->count, n);
+ swaps(&stuff->length);
+ swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
diff --git a/nx-X11/programs/Xserver/Xext/xevie.c b/nx-X11/programs/Xserver/Xext/xevie.c
deleted file mode 100644
index 3ec6cc4f0..000000000
--- a/nx-X11/programs/Xserver/Xext/xevie.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/************************************************************
-
-Copyright 2003-2005 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-************************************************************/
-/* $XdotOrg: xc/programs/Xserver/Xext/xevie.c,v 1.11 2005/10/06 17:55:54 alanc Exp $ */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define _XEVIE_SERVER_
-#include <X11/extensions/Xeviestr.h>
-#include <X11/Xfuncproto.h>
-#include "input.h"
-#include "inputstr.h"
-#include "windowstr.h"
-#include "cursorstr.h"
-#include <X11/extensions/XKBsrv.h>
-
-#include "../os/osdep.h"
-
-#define NoSuchEvent 0x80000000
-
-extern Bool noXkbExtension;
-extern int xeviegrabState;
-
-static int ProcDispatch (), SProcDispatch ();
-static void ResetProc ();
-
-static unsigned char ReqCode = 0;
-static int ErrorBase;
-
-int xevieFlag = 0;
-int xevieClientIndex = 0;
-DeviceIntPtr xeviekb = NULL;
-DeviceIntPtr xeviemouse = NULL;
-Mask xevieMask = 0;
-int xevieEventSent = 0;
-int xevieKBEventSent = 0;
-static unsigned int xevieServerGeneration;
-static int xevieDevicePrivateIndex;
-static Bool xevieModifiersOn = FALSE;
-
-#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr)
-
-Mask xevieFilters[128] =
-{
- NoSuchEvent, /* 0 */
- NoSuchEvent, /* 1 */
- KeyPressMask, /* KeyPress */
- KeyReleaseMask, /* KeyRelease */
- ButtonPressMask, /* ButtonPress */
- ButtonReleaseMask, /* ButtonRelease */
- PointerMotionMask /* MotionNotify (initial state) */
-};
-
-typedef struct {
- ProcessInputProc processInputProc;
- ProcessInputProc realInputProc;
- DeviceUnwrapProc unwrapProc;
-} xevieDeviceInfoRec, *xevieDeviceInfoPtr;
-
-typedef struct {
- CARD32 time;
- KeyClassPtr keyc;
-} xevieKeycQueueRec, *xevieKeycQueuePtr;
-
-#define KEYC_QUEUE_SIZE 100
-xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {0, NULL};
-static int keycqHead = 0, keycqTail = 0;
-
-static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
-static void ResetProc (ExtensionEntry*);
-
-static int ErrorBase;
-
-static Bool XevieStart(void);
-static void XevieEnd(int clientIndex);
-static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
- pointer calldata);
-static void XevieServerGrabStateCallback(CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata);
-
-static Bool XevieAdd(DeviceIntPtr device, pointer data);
-static void XevieWrap(DeviceIntPtr device, ProcessInputProc proc);
-static Bool XevieRemove(DeviceIntPtr device, pointer data);
-static void doSendEvent(xEvent *xE, DeviceIntPtr device);
-static void XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev,
- int count);
-static void XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count);
-
-void
-XevieExtensionInit ()
-{
- ExtensionEntry* extEntry;
-
- if (serverGeneration != xevieServerGeneration) {
- if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
- return;
- xevieServerGeneration = serverGeneration;
- }
-
- if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
- return;
-
- if ((extEntry = AddExtension (XEVIENAME,
- 0,
- XevieNumberErrors,
- ProcDispatch,
- SProcDispatch,
- ResetProc,
- StandardMinorOpcode))) {
- ReqCode = (unsigned char)extEntry->base;
- ErrorBase = extEntry->errorBase;
- }
-
- /* PC servers initialize the desktop colors (citems) here! */
-}
-
-/*ARGSUSED*/
-static
-void ResetProc (extEntry)
- ExtensionEntry* extEntry;
-{
-}
-
-static
-int ProcQueryVersion (client)
- register ClientPtr client;
-{
- REQUEST (xXevieQueryVersionReq);
- xXevieQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.server_major_version = XEVIE_MAJOR_VERSION;
- rep.server_minor_version = XEVIE_MINOR_VERSION;
- WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcStart (client)
- register ClientPtr client;
-{
- REQUEST (xXevieStartReq);
- xXevieStartReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH (xXevieStartReq);
- rep.pad1 = 0;
-
- if(!xevieFlag){
- if (AddCallback(&ClientStateCallback,XevieClientStateCallback,NULL)) {
- xevieFlag = 1;
- rep.pad1 = 1;
- xevieClientIndex = client->index;
- if(!keycq[0].time ) {
- int i;
- for(i=0; i<KEYC_QUEUE_SIZE; i++) {
- keycq[i].keyc = xalloc(sizeof(KeyClassRec));
- keycq[i].keyc->xkbInfo = xalloc(sizeof(XkbSrvInfoRec));
- }
- }
- } else
- return BadAlloc;
- } else
- return BadAccess;
- if (!noXkbExtension) {
- if (!XevieStart()) {
- DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
- return BadAlloc;
- }
- }
-
- xevieModifiersOn = FALSE;
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcEnd (client)
- register ClientPtr client;
-{
- xXevieEndReply rep;
-
- if (xevieFlag) {
- if (client->index != xevieClientIndex)
- return BadAccess;
-
- DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
- XevieEnd(xevieClientIndex);
- }
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcSend (client)
- register ClientPtr client;
-{
- REQUEST (xXevieSendReq);
- xXevieSendReply rep;
- xEvent *xE;
- OsCommPtr oc;
- static unsigned char lastDetail = 0, lastType = 0;
-
- if (client->index != xevieClientIndex)
- return BadAccess;
-
- xE = (xEvent *)&stuff->event;
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep);
-
- switch(xE->u.u.type) {
- case KeyPress:
- case KeyRelease:
- xevieKBEventSent = 1;
- if(noXkbExtension)
- CoreProcessKeyboardEvent (xE, xeviekb, 1);
- else
- doSendEvent(xE, inputInfo.keyboard);
- break;
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- xevieEventSent = 1;
- if(noXkbExtension)
- CoreProcessPointerEvent(xE, xeviemouse, 1);
- else
- doSendEvent(xE, inputInfo.pointer);
- break;
- default:
- break;
- }
- lastType = xE->u.u.type;
- lastDetail = xE->u.u.detail;
- return client->noClientException;
-}
-
-static
-int ProcSelectInput (client)
- register ClientPtr client;
-{
- REQUEST (xXevieSelectInputReq);
- xXevieSelectInputReply rep;
-
- if (client->index != xevieClientIndex)
- return BadAccess;
-
- xevieMask = (long)stuff->event_mask;
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcDispatch (client)
- register ClientPtr client;
-{
- REQUEST (xReq);
- switch (stuff->data)
- {
- case X_XevieQueryVersion:
- return ProcQueryVersion (client);
- case X_XevieStart:
- return ProcStart (client);
- case X_XevieEnd:
- return ProcEnd (client);
- case X_XevieSend:
- return ProcSend (client);
- case X_XevieSelectInput:
- return ProcSelectInput(client);
- default:
- return BadRequest;
- }
-}
-
-static
-int SProcQueryVersion (client)
- register ClientPtr client;
-{
- register int n;
-
- REQUEST(xXevieQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcQueryVersion(client);
-}
-
-static
-int SProcStart (client)
- ClientPtr client;
-{
- register int n;
-
- REQUEST (xXevieStartReq);
- swaps (&stuff->length, n);
- swapl (&stuff->screen, n);
- REQUEST_AT_LEAST_SIZE (xXevieStartReq);
- return ProcStart (client);
-}
-
-static
-int SProcEnd (client)
- ClientPtr client;
-{
- register int n;
- int count;
- xColorItem* pItem;
-
- REQUEST (xXevieEndReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXevieEndReq);
- swapl(&stuff->cmap, n);
- return ProcEnd (client);
-}
-
-static
-int SProcSend (client)
- ClientPtr client;
-{
- register int n;
- int count;
-
- REQUEST (xXevieSendReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXevieSendReq);
- swapl(&stuff->event, n);
- return ProcSend (client);
-}
-
-static
-int SProcSelectInput (client)
- ClientPtr client;
-{
- register int n;
- int count;
-
- REQUEST (xXevieSelectInputReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXevieSendReq);
- swapl(&stuff->event_mask, n);
- return ProcSelectInput (client);
-}
-
-
-static
-int SProcDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XevieQueryVersion:
- return SProcQueryVersion (client);
- case X_XevieStart:
- return SProcStart (client);
- case X_XevieEnd:
- return SProcEnd (client);
- case X_XevieSend:
- return SProcSend (client);
- case X_XevieSelectInput:
- return SProcSelectInput(client);
- default:
- return BadRequest;
- }
-}
-/*======================================================*/
-
-#define WRAP_INPUTPROC(dev,store,inputProc) \
- store->processInputProc = dev->public.processInputProc; \
- dev->public.processInputProc = inputProc; \
- store->realInputProc = dev->public.realInputProc; \
- dev->public.realInputProc = inputProc;
-
-#define COND_WRAP_INPUTPROC(dev,store,inputProc) \
- if (dev->public.processInputProc == dev->public.realInputProc) \
- dev->public.processInputProc = inputProc; \
- store->processInputProc = \
- store->realInputProc = dev->public.realInputProc; \
- dev->public.realInputProc = inputProc;
-
-#define UNWRAP_INPUTPROC(dev,restore) \
- dev->public.processInputProc = restore->processInputProc; \
- dev->public.realInputProc = restore->realInputProc;
-
-#define UNWRAP_INPUTPROC(dev,restore) \
- dev->public.processInputProc = restore->processInputProc; \
- dev->public.realInputProc = restore->realInputProc;
-
-#define XEVIE_EVENT(xE) \
- (xevieFlag \
- && !xeviegrabState \
- && clients[xevieClientIndex] \
- && (xevieMask & xevieFilters[xE->u.u.type]))
-
-
-static void
-sendEvent(ClientPtr pClient, xEvent *xE)
-{
- if(pClient->swapped) {
- xEvent eventTo;
-
- /* Remember to strip off the leading bit of type in case
- this event was sent with "SendEvent." */
- (*EventSwapVector[xE->u.u.type & 0177]) (xE, &eventTo);
- (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo);
- } else {
- (void)WriteToClient(pClient, sizeof(xEvent), (char *) xE);
- }
-}
-
-static void
-XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
-{
- int key, bit;
- BYTE *kptr;
- ProcessInputProc tmp;
- KeyClassPtr keyc = dev->key;
- xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
-
- if(XEVIE_EVENT(xE)) {
- key = xE->u.u.detail;
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (dev->key->modifierMap[xE->u.u.detail])
- xevieModifiersOn = TRUE;
-
- xE->u.keyButtonPointer.event = xeviewin->drawable.id;
- xE->u.keyButtonPointer.root = GetCurrentRootWindow()->drawable.id;
- xE->u.keyButtonPointer.child = (xeviewin->firstChild)
- ? xeviewin->firstChild->drawable.id:0;
- xE->u.keyButtonPointer.rootX = xeviehot.x;
- xE->u.keyButtonPointer.rootY = xeviehot.y;
- xE->u.keyButtonPointer.state = keyc->state | inputInfo.pointer->button->state;
- /* fix bug: sequence lost in Xlib */
- xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
- /* fix for bug5092586 */
- if(!noXkbExtension) {
- switch(xE->u.u.type) {
- case KeyPress: *kptr |= bit; break;
- case KeyRelease: *kptr &= ~bit; break;
- }
- }
- keycq[keycqHead].time = xE->u.keyButtonPointer.time;
- memcpy(keycq[keycqHead].keyc, keyc, sizeof(KeyClassRec) - sizeof(KeyClassPtr));
- memcpy(keycq[keycqHead].keyc->xkbInfo, keyc->xkbInfo, sizeof(XkbSrvInfoRec));
- if(++keycqHead >=KEYC_QUEUE_SIZE)
- keycqHead = 0;
- sendEvent(clients[xevieClientIndex], xE);
- return;
- }
-
- tmp = dev->public.realInputProc;
- UNWRAP_INPUTPROC(dev,xeviep);
- dev->public.processInputProc(xE,dev,count);
- COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-}
-
-static void
-XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
-{
- xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
- ProcessInputProc tmp;
-
- if (XEVIE_EVENT(xE)) {
- /* fix bug: sequence lost in Xlib */
- xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
- sendEvent(clients[xevieClientIndex], xE);
- return;
- }
-
- tmp = dev->public.realInputProc;
- UNWRAP_INPUTPROC(dev,xeviep);
- dev->public.processInputProc(xE,dev,count);
- COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-}
-
-static Bool
-XevieStart(void)
-{
- ProcessInputProc prp;
- prp = XevieKbdProcessInputProc;
- if (!XevieAdd(inputInfo.keyboard,&prp))
- return FALSE;
- prp = XeviePointerProcessInputProc;
- if (!XevieAdd(inputInfo.pointer,&prp))
- return FALSE;
-
- return TRUE;
-}
-
-
-static void
-XevieEnd(int clientIndex)
-{
- if (!clientIndex || clientIndex == xevieClientIndex) {
-
- if(!noXkbExtension) {
-
- XevieRemove(inputInfo.keyboard,NULL);
-
- inputInfo.keyboard->public.processInputProc = CoreProcessKeyboardEvent;
- inputInfo.keyboard->public.realInputProc = CoreProcessKeyboardEvent;
- XkbSetExtension(inputInfo.keyboard,ProcessKeyboardEvent);
-
-
- XevieRemove(inputInfo.pointer,NULL);
-
- inputInfo.pointer->public.processInputProc = CoreProcessPointerEvent;
- inputInfo.pointer->public.realInputProc = CoreProcessPointerEvent;
- XkbSetExtension(inputInfo.pointer,ProcessPointerEvent);
- }
-
- xevieFlag = 0;
- xevieClientIndex = 0;
- DeleteCallback (&ClientStateCallback, XevieClientStateCallback, NULL);
- }
-}
-
-static void
-XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
- pointer calldata)
-{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
- ClientPtr client = pci->client;
- if (client->clientState == ClientStateGone
- || client->clientState == ClientStateRetained)
- XevieEnd(client->index);
-}
-
-static void
-XevieServerGrabStateCallback(CallbackListPtr *pcbl, pointer nulldata,
- pointer calldata)
-{
- ServerGrabInfoRec *grbinfo = (ServerGrabInfoRec *)calldata;
- if (grbinfo->grabstate == SERVER_GRABBED)
- xeviegrabState = TRUE;
- else
- xeviegrabState = FALSE;
-}
-
-#define UNWRAP_UNWRAPPROC(device,proc_store) \
- device->unwrapProc = proc_store;
-
-#define WRAP_UNWRAPPROC(device,proc_store,proc) \
- proc_store = device->unwrapProc; \
- device->unwrapProc = proc;
-
-static void
-xevieUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data)
-{
- xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
- ProcessInputProc tmp = device->public.processInputProc;
-
- UNWRAP_INPUTPROC(device,xeviep);
- UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
- proc(device,data);
- WRAP_INPUTPROC(device,xeviep,tmp);
- WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
-}
-
-static Bool
-XevieUnwrapAdd(DeviceIntPtr device, void* data)
-{
- if (device->unwrapProc)
- device->unwrapProc(device,XevieUnwrapAdd,data);
- else {
- ProcessInputProc *ptr = data;
- XevieWrap(device,*ptr);
- }
-
- return TRUE;
-}
-
-static Bool
-XevieAdd(DeviceIntPtr device, void* data)
-{
- xevieDeviceInfoPtr xeviep;
-
- if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex))
- return FALSE;
-
- xeviep = xalloc (sizeof (xevieDeviceInfoRec));
- if (!xeviep)
- return FALSE;
-
- device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep;
- XevieUnwrapAdd(device, data);
-
- return TRUE;
-}
-
-static Bool
-XevieRemove(DeviceIntPtr device,pointer data)
-{
- xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
-
- if (!xeviep) return TRUE;
-
- UNWRAP_INPUTPROC(device,xeviep);
- UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
-
- xfree(xeviep);
- device->devPrivates[xevieDevicePrivateIndex].ptr = NULL;
- return TRUE;
-}
-
-static void
-XevieWrap(DeviceIntPtr device, ProcessInputProc proc)
-{
- xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
-
- WRAP_INPUTPROC(device,xeviep,proc);
- WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
-}
-
-static void
-doSendEvent(xEvent *xE, DeviceIntPtr dev)
-{
- xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
- ProcessInputProc tmp = dev->public.realInputProc;
- if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))
- && !xevieModifiersOn) {
- KeyClassPtr keyc = dev->key;
- CARD8 realModes = dev->key->modifierMap[xE->u.u.detail];
- int notFound = 0;
- /* if some events are consumed by client, move the queue tail pointer to the current
- event which just comes back from Xevie client .
- */
- if(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
- while(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
- if(++keycqTail >= KEYC_QUEUE_SIZE)
- keycqTail = 0;
- if(keycqTail == keycqHead) {
- notFound = 1;
- break;
- }
- }
- }
- if(!notFound) {
- dev->key = keycq[keycqTail].keyc;
- if(++keycqTail >= KEYC_QUEUE_SIZE)
- keycqTail = 0;
- }
- dev->key->modifierMap[xE->u.u.detail] = 0;
-
- if(dev->key->xkbInfo->repeatKey != 0 && xE->u.u.type != KeyPress)
- XkbLastRepeatEvent= (pointer)xE;
- UNWRAP_INPUTPROC(dev,xeviep);
- dev->public.processInputProc(xE,dev,1);
- COND_WRAP_INPUTPROC(dev,xeviep,tmp);
- XkbLastRepeatEvent= NULL;
-
- dev->key->modifierMap[xE->u.u.detail] = realModes;
- dev->key = keyc;
- if(notFound) {
- DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
- XevieEnd(xevieClientIndex);
- ErrorF("Error: Xevie keyc queue size is not enough, disable Xevie\n");
- }
- } else {
- UNWRAP_INPUTPROC(dev,xeviep);
- dev->public.processInputProc(xE,dev,1);
- COND_WRAP_INPUTPROC(dev,xeviep,tmp);
- }
-}
-
diff --git a/nx-X11/programs/Xserver/Xext/xf86bigfont.c b/nx-X11/programs/Xserver/Xext/xf86bigfont.c
index 36af17622..d8cae74ef 100644
--- a/nx-X11/programs/Xserver/Xext/xf86bigfont.c
+++ b/nx-X11/programs/Xserver/Xext/xf86bigfont.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.17 2003/10/28 23:08:43 tsi Exp $ */
/*
* BIGFONT extension for sharing font metrics between clients (if possible)
* and for transmitting font metrics to clients in a compressed form.
@@ -64,17 +63,21 @@
#include <errno.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
-#include "os.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
+#include "protocol-versions.h"
#define _XF86BIGFONT_SERVER_
-#include <X11/extensions/xf86bigfstr.h>
+#include <nx-X11/extensions/xf86bigfproto.h>
+
+#ifdef HAS_XFONT2
+# include <X11/fonts/libxfont2.h>
+#endif /* HAS_XFONT2 */
static void XF86BigfontResetProc(
ExtensionEntry * /* extEntry */
@@ -107,8 +110,6 @@ static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
-#include <sys/signal.h>
-
static void
SigSysHandler(
int signo)
@@ -123,7 +124,7 @@ CheckForShmSyscall(void)
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
- oldHandler = signal(SIGSYS, SigSysHandler);
+ oldHandler = OsSignal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
@@ -137,7 +138,7 @@ CheckForShmSyscall(void)
/* Allocation failed */
badSysCall = TRUE;
}
- signal(SIGSYS, oldHandler);
+ OsSignal(SIGSYS, oldHandler);
return (!badSysCall);
}
@@ -189,7 +190,11 @@ XFree86BigfontExtensionInit()
+ (unsigned int) (65536.0/(RAND_MAX+1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */
+#ifdef HAS_XFONT2
+ FontShmdescIndex = xfont2_allocate_font_private_index();
+#else
FontShmdescIndex = AllocateFontPrivateIndex();
+#endif /* HAS_XFONT2 */
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;
@@ -247,7 +252,7 @@ shmalloc(
if (size < 3500)
return (ShmDescPtr) NULL;
- pDesc = (ShmDescRec *) xalloc(sizeof(ShmDescRec));
+ pDesc = (ShmDescRec *) malloc(sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
@@ -256,7 +261,7 @@ shmalloc(
if (shmid == -1) {
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, errno = %d\n",
size, errno);
- xfree(pDesc);
+ free(pDesc);
return (ShmDescPtr) NULL;
}
@@ -264,7 +269,7 @@ shmalloc(
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, errno = %d\n",
size, errno);
shmctl(shmid, IPC_RMID, (void *) 0);
- xfree(pDesc);
+ free(pDesc);
return (ShmDescPtr) NULL;
}
@@ -293,7 +298,7 @@ shmdealloc(
if (pDesc->next) pDesc->next->prev = pDesc->prev;
*pDesc->prev = pDesc->next;
- xfree(pDesc);
+ free(pDesc);
}
#endif
@@ -354,11 +359,12 @@ ProcXF86BigfontQueryVersion(
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
+ memset(&reply, 0, sizeof(xXF86BigfontQueryVersionReply));
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
- reply.majorVersion = XF86BIGFONT_MAJOR_VERSION;
- reply.minorVersion = XF86BIGFONT_MINOR_VERSION;
+ reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
+ reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
reply.uid = geteuid();
reply.gid = getegid();
#ifdef HAS_SHM
@@ -368,23 +374,22 @@ ProcXF86BigfontQueryVersion(
#endif
reply.capabilities =
#ifdef HAS_SHM
- (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
+ (client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
#else
0
#endif
; /* may add more bits here in future versions */
if (client->swapped) {
- char tmp;
- swaps(&reply.sequenceNumber, tmp);
- swapl(&reply.length, tmp);
- swaps(&reply.majorVersion, tmp);
- swaps(&reply.minorVersion, tmp);
- swapl(&reply.uid, tmp);
- swapl(&reply.gid, tmp);
- swapl(&reply.signature, tmp);
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swaps(&reply.majorVersion);
+ swaps(&reply.minorVersion);
+ swapl(&reply.uid);
+ swapl(&reply.gid);
+ swapl(&reply.signature);
}
WriteToClient(client,
- sizeof(xXF86BigfontQueryVersionReply), (char *)&reply);
+ sizeof(xXF86BigfontQueryVersionReply), &reply);
return client->noClientException;
}
@@ -392,14 +397,12 @@ static void
swapCharInfo(
xCharInfo *pCI)
{
- char tmp;
-
- swaps(&pCI->leftSideBearing, tmp);
- swaps(&pCI->rightSideBearing, tmp);
- swaps(&pCI->characterWidth, tmp);
- swaps(&pCI->ascent, tmp);
- swaps(&pCI->descent, tmp);
- swaps(&pCI->attributes, tmp);
+ swaps(&pCI->leftSideBearing);
+ swaps(&pCI->rightSideBearing);
+ swaps(&pCI->characterWidth);
+ swaps(&pCI->ascent);
+ swaps(&pCI->descent);
+ swaps(&pCI->attributes);
}
/* static CARD32 hashCI (xCharInfo *p); */
@@ -421,7 +424,7 @@ ProcXF86BigfontQueryFont(
int nCharInfos;
int shmid;
#ifdef HAS_SHM
- ShmDescPtr pDesc;
+ ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
#endif
@@ -435,7 +438,7 @@ ProcXF86BigfontQueryFont(
#else
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
- stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
+ stuff_flags = (client->local && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
break;
case 3: /* client with version 1.1 libX11 */
stuff_flags = stuff->flags;
@@ -446,11 +449,11 @@ ProcXF86BigfontQueryFont(
#endif
client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
- SecurityReadAccess);
+ DixReadAccess);
if (!pFont) {
/* can't use VERIFY_GC because it might return BadGC */
GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
- SecurityReadAccess);
+ DixReadAccess);
if (!pGC) {
client->errorValue = stuff->id;
return BadFont; /* procotol spec says only error is BadFont */
@@ -493,7 +496,7 @@ ProcXF86BigfontQueryFont(
} else {
#endif
pCI = (xCharInfo *)
- ALLOCATE_LOCAL(nCharInfos * sizeof(xCharInfo));
+ malloc(nCharInfos * sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef HAS_SHM
@@ -531,7 +534,11 @@ ProcXF86BigfontQueryFont(
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *)(pCI + nCharInfos) = signature;
+#ifdef HAS_XFONT2
+ if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
+#else
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
+#endif /* HAS_XFONT2 */
shmdealloc(pDesc);
return BadAlloc;
}
@@ -556,9 +563,9 @@ ProcXF86BigfontQueryFont(
hashModulus = nCharInfos+1;
tmp = (CARD16*)
- ALLOCATE_LOCAL((4*nCharInfos+1) * sizeof(CARD16));
+ malloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) {
- if (!pDesc) DEALLOCATE_LOCAL(pCI);
+ if (!pDesc) free(pCI);
return BadAlloc;
}
pIndex2UniqIndex = tmp;
@@ -641,12 +648,12 @@ ProcXF86BigfontQueryFont(
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply* reply =
- (xXF86BigfontQueryFontReply *) ALLOCATE_LOCAL(rlength);
+ (xXF86BigfontQueryFontReply *) calloc(1, rlength);
char* p;
if (!reply) {
if (nCharInfos > 0) {
- if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
- if (!pDesc) DEALLOCATE_LOCAL(pCI);
+ if (shmid == -1) free(pIndex2UniqIndex);
+ if (!pDesc) free(pCI);
}
return BadAlloc;
}
@@ -670,21 +677,20 @@ ProcXF86BigfontQueryFont(
reply->shmid = shmid;
reply->shmsegoffset = 0;
if (client->swapped) {
- char tmp;
- swaps(&reply->sequenceNumber, tmp);
- swapl(&reply->length, tmp);
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
swapCharInfo(&reply->minBounds);
swapCharInfo(&reply->maxBounds);
- swaps(&reply->minCharOrByte2, tmp);
- swaps(&reply->maxCharOrByte2, tmp);
- swaps(&reply->defaultChar, tmp);
- swaps(&reply->nFontProps, tmp);
- swaps(&reply->fontAscent, tmp);
- swaps(&reply->fontDescent, tmp);
- swapl(&reply->nCharInfos, tmp);
- swapl(&reply->nUniqCharInfos, tmp);
- swapl(&reply->shmid, tmp);
- swapl(&reply->shmsegoffset, tmp);
+ swaps(&reply->minCharOrByte2);
+ swaps(&reply->maxCharOrByte2);
+ swaps(&reply->defaultChar);
+ swaps(&reply->nFontProps);
+ swaps(&reply->fontAscent);
+ swaps(&reply->fontDescent);
+ swapl(&reply->nCharInfos);
+ swapl(&reply->nUniqCharInfos);
+ swapl(&reply->shmid);
+ swapl(&reply->shmsegoffset);
}
p = (char*) &reply[1];
{
@@ -697,9 +703,8 @@ ProcXF86BigfontQueryFont(
prFP->name = pFP->name;
prFP->value = pFP->value;
if (client->swapped) {
- char tmp;
- swapl(&prFP->name, tmp);
- swapl(&prFP->value, tmp);
+ swapl(&prFP->name);
+ swapl(&prFP->value);
}
}
p = (char*) prFP;
@@ -718,16 +723,15 @@ ProcXF86BigfontQueryFont(
for (j = 0; j < nCharInfos; j++, ps++) {
*ps = pIndex2UniqIndex[j];
if (client->swapped) {
- char tmp;
- swaps(ps, tmp);
+ swaps(ps);
}
}
}
- WriteToClient(client, rlength, (char *)reply);
- DEALLOCATE_LOCAL(reply);
+ WriteToClient(client, rlength, reply);
+ free(reply);
if (nCharInfos > 0) {
- if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
- if (!pDesc) DEALLOCATE_LOCAL(pCI);
+ if (shmid == -1) free(pIndex2UniqIndex);
+ if (!pDesc) free(pCI);
}
return (client->noClientException);
}
@@ -754,9 +758,8 @@ SProcXF86BigfontQueryVersion(
ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
- char tmp;
- swaps(&stuff->length, tmp);
+ swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
@@ -765,11 +768,10 @@ SProcXF86BigfontQueryFont(
ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
- char tmp;
- swaps(&stuff->length, tmp);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
- swapl(&stuff->id, tmp);
+ swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);
}
diff --git a/nx-X11/programs/Xserver/Xext/xf86dga.c b/nx-X11/programs/Xserver/Xext/xf86dga.c
deleted file mode 100644
index 9979bfb30..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86dga.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.21 2000/06/30 19:06:54 keithp Exp $ */
-
-/*
-
-Copyright (c) 1995 Jon Tombs
-Copyright (c) 1995, 1996, 1999 XFree86 Inc
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define _XF86DGA_SERVER_
-#include <X11/extensions/xf86dga.h>
-#include <X11/extensions/xf86dgastr.h>
-#include "swaprep.h"
-#include "dgaproc.h"
-
-#include "xf86dgaext.h"
-
-
-static DISPATCH_PROC(ProcXF86DGADirectVideo);
-static DISPATCH_PROC(ProcXF86DGAGetVidPage);
-static DISPATCH_PROC(ProcXF86DGAGetVideoLL);
-static DISPATCH_PROC(ProcXF86DGAGetViewPortSize);
-static DISPATCH_PROC(ProcXF86DGASetVidPage);
-static DISPATCH_PROC(ProcXF86DGASetViewPort);
-static DISPATCH_PROC(ProcXF86DGAInstallColormap);
-static DISPATCH_PROC(ProcXF86DGAQueryDirectVideo);
-static DISPATCH_PROC(ProcXF86DGAViewPortChanged);
-
-
-static int
-ProcXF86DGAGetVideoLL(ClientPtr client)
-{
- REQUEST(xXF86DGAGetVideoLLReq);
- xXF86DGAGetVideoLLReply rep;
- XDGAModeRec mode;
- int num, offset, flags;
- char *name;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- if(!DGAAvailable(stuff->screen))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
-
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
-
- /* get the parameters for the mode that best matches */
- DGAGetModeInfo(stuff->screen, &mode, num);
-
- if(!DGAOpenFramebuffer(stuff->screen, &name,
- (unsigned char**)(&rep.offset),
- (int*)(&rep.bank_size), &offset, &flags))
- return BadAlloc;
-
- rep.offset += mode.offset;
- rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
- rep.ram_size = rep.bank_size >> 10;
-
- WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86DGADirectVideo(ClientPtr client)
-{
- int num;
- PixmapPtr pix;
- XDGAModeRec mode;
- REQUEST(xXF86DGADirectVideoReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
-
- if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
-
- if (stuff->enable & XF86DGADirectGraphics) {
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
- } else
- num = 0;
-
- if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
- return (DGAErrorBase + XF86DGAScreenNotActive);
-
- DGASetInputMode (stuff->screen,
- (stuff->enable & XF86DGADirectKeyb) != 0,
- (stuff->enable & XF86DGADirectMouse) != 0);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86DGAGetViewPortSize(ClientPtr client)
-{
- int num;
- XDGAModeRec mode;
- REQUEST(xXF86DGAGetViewPortSizeReq);
- xXF86DGAGetViewPortSizeReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- if (!DGAAvailable(stuff->screen))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
-
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
-
- DGAGetModeInfo(stuff->screen, &mode, num);
-
- rep.width = mode.viewportWidth;
- rep.height = mode.viewportHeight;
-
- WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86DGASetViewPort(ClientPtr client)
-{
- REQUEST(xXF86DGASetViewPortReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
-
- if (!DGAActive(stuff->screen))
- {
- int num;
- PixmapPtr pix;
- XDGAModeRec mode;
-
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
- if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
- return (DGAErrorBase + XF86DGAScreenNotActive);
- }
-
- if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
- != Success)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86DGAGetVidPage(ClientPtr client)
-{
- REQUEST(xXF86DGAGetVidPageReq);
- xXF86DGAGetVidPageReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.vpage = 0; /* silently fail */
-
- WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
- return (client->noClientException);
-}
-
-
-static int
-ProcXF86DGASetVidPage(ClientPtr client)
-{
- REQUEST(xXF86DGASetVidPageReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
-
- /* silently fail */
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXF86DGAInstallColormap(ClientPtr client)
-{
- ColormapPtr pcmp;
- REQUEST(xXF86DGAInstallColormapReq);
-
- REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
-
- if (!DGAActive(stuff->screen))
- return (DGAErrorBase + XF86DGADirectNotActivated);
-
- pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP);
- if (pcmp) {
- DGAInstallCmap(pcmp);
- return (client->noClientException);
- } else {
- client->errorValue = stuff->id;
- return (BadColor);
- }
-}
-
-static int
-ProcXF86DGAQueryDirectVideo(ClientPtr client)
-{
- REQUEST(xXF86DGAQueryDirectVideoReq);
- xXF86DGAQueryDirectVideoReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.flags = 0;
-
- if (DGAAvailable(stuff->screen))
- rep.flags = XF86DGADirectPresent;
-
- WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86DGAViewPortChanged(ClientPtr client)
-{
- REQUEST(xXF86DGAViewPortChangedReq);
- xXF86DGAViewPortChangedReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
-
- if (!DGAActive(stuff->screen))
- return (DGAErrorBase + XF86DGADirectNotActivated);
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.result = 1;
-
- WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
- return (client->noClientException);
-}
-
-int
-ProcXF86DGADispatch(register ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_XF86DGAGetVideoLL:
- return ProcXF86DGAGetVideoLL(client);
- case X_XF86DGADirectVideo:
- return ProcXF86DGADirectVideo(client);
- case X_XF86DGAGetViewPortSize:
- return ProcXF86DGAGetViewPortSize(client);
- case X_XF86DGASetViewPort:
- return ProcXF86DGASetViewPort(client);
- case X_XF86DGAGetVidPage:
- return ProcXF86DGAGetVidPage(client);
- case X_XF86DGASetVidPage:
- return ProcXF86DGASetVidPage(client);
- case X_XF86DGAInstallColormap:
- return ProcXF86DGAInstallColormap(client);
- case X_XF86DGAQueryDirectVideo:
- return ProcXF86DGAQueryDirectVideo(client);
- case X_XF86DGAViewPortChanged:
- return ProcXF86DGAViewPortChanged(client);
- default:
- return BadRequest;
- }
-}
-
diff --git a/nx-X11/programs/Xserver/Xext/xf86dga2.c b/nx-X11/programs/Xserver/Xext/xf86dga2.c
deleted file mode 100644
index a5cab0f11..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86dga2.c
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- Copyright (c) 1999 - The XFree86 Project Inc.
-
- Written by Mark Vojkovich
-*/
-/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.17 2001/10/28 03:32:51 tsi Exp $ */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "dixevents.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define _XF86DGA_SERVER_
-#include <X11/extensions/xf86dga.h>
-#include <X11/extensions/xf86dgastr.h>
-#include "swaprep.h"
-#include "dgaproc.h"
-#include "xf86dgaext.h"
-
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#else
-#include <string.h>
-#endif
-
-#include "modinit.h"
-
-static DISPATCH_PROC(ProcXDGADispatch);
-static DISPATCH_PROC(SProcXDGADispatch);
-static DISPATCH_PROC(ProcXDGAQueryVersion);
-static DISPATCH_PROC(ProcXDGAQueryModes);
-static DISPATCH_PROC(ProcXDGASetMode);
-static DISPATCH_PROC(ProcXDGAOpenFramebuffer);
-static DISPATCH_PROC(ProcXDGACloseFramebuffer);
-static DISPATCH_PROC(ProcXDGASetViewport);
-static DISPATCH_PROC(ProcXDGAInstallColormap);
-static DISPATCH_PROC(ProcXDGASelectInput);
-static DISPATCH_PROC(ProcXDGAFillRectangle);
-static DISPATCH_PROC(ProcXDGACopyArea);
-static DISPATCH_PROC(ProcXDGACopyTransparentArea);
-static DISPATCH_PROC(ProcXDGAGetViewportStatus);
-static DISPATCH_PROC(ProcXDGASync);
-static DISPATCH_PROC(ProcXDGASetClientVersion);
-static DISPATCH_PROC(ProcXDGAChangePixmapMode);
-static DISPATCH_PROC(ProcXDGACreateColormap);
-
-static void XDGAResetProc(ExtensionEntry *extEntry);
-
-static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
-
-static ClientPtr DGAClients[MAXSCREENS];
-
-unsigned char DGAReqCode = 0;
-int DGAErrorBase;
-int DGAEventBase;
-
-static int DGAGeneration = 0;
-static int DGAClientPrivateIndex;
-static int DGACallbackRefCount = 0;
-
-/* This holds the client's version information */
-typedef struct {
- int major;
- int minor;
-} DGAPrivRec, *DGAPrivPtr;
-
-#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr)
-
-void
-XFree86DGAExtensionInit(INITARGS)
-{
- ExtensionEntry* extEntry;
-
- if ((extEntry = AddExtension(XF86DGANAME,
- XF86DGANumberEvents,
- XF86DGANumberErrors,
- ProcXDGADispatch,
- SProcXDGADispatch,
- XDGAResetProc,
- StandardMinorOpcode))) {
- int i;
-
- for(i = 0; i < MAXSCREENS; i++)
- DGAClients[i] = NULL;
-
- DGAReqCode = (unsigned char)extEntry->base;
- DGAErrorBase = extEntry->errorBase;
- DGAEventBase = extEntry->eventBase;
- for (i = KeyPress; i <= MotionNotify; i++)
- SetCriticalEvent (DGAEventBase + i);
- }
-
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (DGAGeneration != serverGeneration) {
- DGAClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to
- * our DGAPrivRec.
- */
- if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) {
- ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n");
- return;
- }
- DGAGeneration = serverGeneration;
- }
-}
-
-
-
-static void
-XDGAResetProc (ExtensionEntry *extEntry)
-{
- DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- DGACallbackRefCount = 0;
-}
-
-
-static int
-ProcXDGAQueryVersion(ClientPtr client)
-{
- xXDGAQueryVersionReply rep;
-
- REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XDGA_MAJOR_VERSION;
- rep.minorVersion = XDGA_MINOR_VERSION;
-
- WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGAOpenFramebuffer(ClientPtr client)
-{
- REQUEST(xXDGAOpenFramebufferReq);
- xXDGAOpenFramebufferReply rep;
- char *deviceName;
- int nameSize;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
-
- REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
- (unsigned char**)(&rep.mem1),
- (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
- {
- return BadAlloc;
- }
-
- nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
- rep.length = (nameSize + 3) >> 2;
-
- WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
- if(rep.length)
- WriteToClient(client, nameSize, deviceName);
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGACloseFramebuffer(ClientPtr client)
-{
- REQUEST(xXDGACloseFramebufferReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
-
- REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
-
- DGACloseFramebuffer(stuff->screen);
-
- return (client->noClientException);
-}
-
-static int
-ProcXDGAQueryModes(ClientPtr client)
-{
- int i, num, size;
- REQUEST(xXDGAQueryModesReq);
- xXDGAQueryModesReply rep;
- xXDGAModeInfo info;
- XDGAModePtr mode;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.number = 0;
- rep.sequenceNumber = client->sequence;
-
- if (!DGAAvailable(stuff->screen)) {
- rep.number = 0;
- rep.length = 0;
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return (client->noClientException);
- }
-
- if(!(num = DGAGetModes(stuff->screen))) {
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return (client->noClientException);
- }
-
- if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec))))
- return BadAlloc;
-
- for(i = 0; i < num; i++)
- DGAGetModeInfo(stuff->screen, mode + i, i + 1);
-
- size = num * sz_xXDGAModeInfo;
- for(i = 0; i < num; i++)
- size += (strlen(mode[i].name) + 4) & ~3L; /* plus NULL */
-
- rep.number = num;
- rep.length = size >> 2;
-
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
-
- for(i = 0; i < num; i++) {
- size = strlen(mode[i].name) + 1;
-
- info.byte_order = mode[i].byteOrder;
- info.depth = mode[i].depth;
- info.num = mode[i].num;
- info.bpp = mode[i].bitsPerPixel;
- info.name_size = (size + 3) & ~3L;
- info.vsync_num = mode[i].VSync_num;
- info.vsync_den = mode[i].VSync_den;
- info.flags = mode[i].flags;
- info.image_width = mode[i].imageWidth;
- info.image_height = mode[i].imageHeight;
- info.pixmap_width = mode[i].pixmapWidth;
- info.pixmap_height = mode[i].pixmapHeight;
- info.bytes_per_scanline = mode[i].bytesPerScanline;
- info.red_mask = mode[i].red_mask;
- info.green_mask = mode[i].green_mask;
- info.blue_mask = mode[i].blue_mask;
- info.visual_class = mode[i].visualClass;
- info.viewport_width = mode[i].viewportWidth;
- info.viewport_height = mode[i].viewportHeight;
- info.viewport_xstep = mode[i].xViewportStep;
- info.viewport_ystep = mode[i].yViewportStep;
- info.viewport_xmax = mode[i].maxViewportX;
- info.viewport_ymax = mode[i].maxViewportY;
- info.viewport_flags = mode[i].viewportFlags;
- info.reserved1 = mode[i].reserved1;
- info.reserved2 = mode[i].reserved2;
-
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
- WriteToClient(client, size, mode[i].name);
- }
-
- xfree(mode);
-
- return (client->noClientException);
-}
-
-
-static void
-DGAClientStateChange (
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata
-){
- NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
- ClientPtr client = NULL;
- int i;
-
- for(i = 0; i < screenInfo.numScreens; i++) {
- if(DGAClients[i] == pci->client) {
- client = pci->client;
- break;
- }
- }
-
- if(client &&
- ((client->clientState == ClientStateGone) ||
- (client->clientState == ClientStateRetained))) {
- XDGAModeRec mode;
- PixmapPtr pPix;
-
- DGAClients[i] = NULL;
- DGASelectInput(i, NULL, 0);
- DGASetMode(i, 0, &mode, &pPix);
-
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
-}
-
-static int
-ProcXDGASetMode(ClientPtr client)
-{
- REQUEST(xXDGASetModeReq);
- xXDGASetModeReply rep;
- XDGAModeRec mode;
- xXDGAModeInfo info;
- PixmapPtr pPix;
- int size;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXDGASetModeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.offset = 0;
- rep.flags = 0;
- rep.sequenceNumber = client->sequence;
-
- if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
-
- if(DGAClients[stuff->screen] &&
- (DGAClients[stuff->screen] != client))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
-
- if(!stuff->mode) {
- if(DGAClients[stuff->screen]) {
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
- DGAClients[stuff->screen] = NULL;
- DGASelectInput(stuff->screen, NULL, 0);
- DGASetMode(stuff->screen, 0, &mode, &pPix);
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- return (client->noClientException);
- }
-
- if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
- return BadValue;
-
- if(!DGAClients[stuff->screen]) {
- if(DGACallbackRefCount++ == 0)
- AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- }
-
- DGAClients[stuff->screen] = client;
-
- if(pPix) {
- if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
- pPix->drawable.id = (int)stuff->pid;
- rep.flags = DGA_PIXMAP_AVAILABLE;
- }
- }
-
- size = strlen(mode.name) + 1;
-
- info.byte_order = mode.byteOrder;
- info.depth = mode.depth;
- info.num = mode.num;
- info.bpp = mode.bitsPerPixel;
- info.name_size = (size + 3) & ~3L;
- info.vsync_num = mode.VSync_num;
- info.vsync_den = mode.VSync_den;
- info.flags = mode.flags;
- info.image_width = mode.imageWidth;
- info.image_height = mode.imageHeight;
- info.pixmap_width = mode.pixmapWidth;
- info.pixmap_height = mode.pixmapHeight;
- info.bytes_per_scanline = mode.bytesPerScanline;
- info.red_mask = mode.red_mask;
- info.green_mask = mode.green_mask;
- info.blue_mask = mode.blue_mask;
- info.visual_class = mode.visualClass;
- info.viewport_width = mode.viewportWidth;
- info.viewport_height = mode.viewportHeight;
- info.viewport_xstep = mode.xViewportStep;
- info.viewport_ystep = mode.yViewportStep;
- info.viewport_xmax = mode.maxViewportX;
- info.viewport_ymax = mode.maxViewportY;
- info.viewport_flags = mode.viewportFlags;
- info.reserved1 = mode.reserved1;
- info.reserved2 = mode.reserved2;
-
- rep.length = (sz_xXDGAModeInfo + info.name_size) >> 2;
-
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
- WriteToClient(client, size, mode.name);
-
- return (client->noClientException);
-}
-
-static int
-ProcXDGASetViewport(ClientPtr client)
-{
- REQUEST(xXDGASetViewportReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGASetViewportReq);
-
- DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
-
- return (client->noClientException);
-}
-
-static int
-ProcXDGAInstallColormap(ClientPtr client)
-{
- ColormapPtr cmap;
- REQUEST(xXDGAInstallColormapReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
-
- cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP);
- if (cmap) {
- DGAInstallCmap(cmap);
- return (client->noClientException);
- } else {
- client->errorValue = stuff->cmap;
- return (BadColor);
- }
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGASelectInput(ClientPtr client)
-{
- REQUEST(xXDGASelectInputReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGASelectInputReq);
-
- if(DGAClients[stuff->screen] == client)
- DGASelectInput(stuff->screen, client, stuff->mask);
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGAFillRectangle(ClientPtr client)
-{
- REQUEST(xXDGAFillRectangleReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
-
- if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
- stuff->width, stuff->height, stuff->color))
- return BadMatch;
-
- return (client->noClientException);
-}
-
-static int
-ProcXDGACopyArea(ClientPtr client)
-{
- REQUEST(xXDGACopyAreaReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
-
- if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty))
- return BadMatch;
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGACopyTransparentArea(ClientPtr client)
-{
- REQUEST(xXDGACopyTransparentAreaReq);
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
-
- if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
- return BadMatch;
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGAGetViewportStatus(ClientPtr client)
-{
- REQUEST(xXDGAGetViewportStatusReq);
- xXDGAGetViewportStatusReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- rep.status = DGAGetViewportStatus(stuff->screen);
-
- WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXDGASync(ClientPtr client)
-{
- REQUEST(xXDGASyncReq);
- xXDGASyncReply rep;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGASyncReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- DGASync(stuff->screen);
-
- WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXDGASetClientVersion(ClientPtr client)
-{
- REQUEST(xXDGASetClientVersionReq);
-
- DGAPrivPtr pPriv;
-
- REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
- if ((pPriv = DGAPRIV(client)) == NULL) {
- pPriv = xalloc(sizeof(DGAPrivRec));
- /* XXX Need to look into freeing this */
- if (!pPriv)
- return BadAlloc;
- DGAPRIV(client) = pPriv;
- }
- pPriv->major = stuff->major;
- pPriv->minor = stuff->minor;
-
- return (client->noClientException);
-}
-
-static int
-ProcXDGAChangePixmapMode(ClientPtr client)
-{
- REQUEST(xXDGAChangePixmapModeReq);
- xXDGAChangePixmapModeReply rep;
- int x, y;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- x = stuff->x;
- y = stuff->y;
-
- if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
- return BadMatch;
-
- rep.x = x;
- rep.y = y;
- WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXDGACreateColormap(ClientPtr client)
-{
- REQUEST(xXDGACreateColormapReq);
- int result;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- if(DGAClients[stuff->screen] != client)
- return DGAErrorBase + XF86DGADirectNotActivated;
-
- REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
-
- if(!stuff->mode)
- return BadValue;
-
- result = DGACreateColormap(stuff->screen, client, stuff->id,
- stuff->mode, stuff->alloc);
- if(result != Success)
- return result;
-
- return (client->noClientException);
-}
-
-
-static int
-SProcXDGADispatch (ClientPtr client)
-{
- return DGAErrorBase + XF86DGAClientNotLocal;
-}
-
-#if 0
-#define DGA_REQ_DEBUG
-#endif
-
-#ifdef DGA_REQ_DEBUG
-static char *dgaMinor[] = {
- "QueryVersion",
- "GetVideoLL",
- "DirectVideo",
- "GetViewPortSize",
- "SetViewPort",
- "GetVidPage",
- "SetVidPage",
- "InstallColormap",
- "QueryDirectVideo",
- "ViewPortChanged",
- "10",
- "11",
- "QueryModes",
- "SetMode",
- "SetViewport",
- "InstallColormap",
- "SelectInput",
- "FillRectangle",
- "CopyArea",
- "CopyTransparentArea",
- "GetViewportStatus",
- "Sync",
- "OpenFramebuffer",
- "CloseFramebuffer",
- "SetClientVersion",
- "ChangePixmapMode",
- "CreateColormap",
-};
-#endif
-
-static int
-ProcXDGADispatch (ClientPtr client)
-{
- REQUEST(xReq);
-
- if (!LocalClient(client))
- return DGAErrorBase + XF86DGAClientNotLocal;
-
-#ifdef DGA_REQ_DEBUG
- if (stuff->data <= X_XDGACreateColormap)
- fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]);
-#endif
-
- /* divert old protocol */
-#if 1
- if( (stuff->data <= X_XF86DGAViewPortChanged) &&
- (stuff->data >= X_XF86DGAGetVideoLL))
- return ProcXF86DGADispatch(client);
-#endif
-
- switch (stuff->data){
- case X_XDGAQueryVersion:
- return ProcXDGAQueryVersion(client);
- case X_XDGAQueryModes:
- return ProcXDGAQueryModes(client);
- case X_XDGASetMode:
- return ProcXDGASetMode(client);
- case X_XDGAOpenFramebuffer:
- return ProcXDGAOpenFramebuffer(client);
- case X_XDGACloseFramebuffer:
- return ProcXDGACloseFramebuffer(client);
- case X_XDGASetViewport:
- return ProcXDGASetViewport(client);
- case X_XDGAInstallColormap:
- return ProcXDGAInstallColormap(client);
- case X_XDGASelectInput:
- return ProcXDGASelectInput(client);
- case X_XDGAFillRectangle:
- return ProcXDGAFillRectangle(client);
- case X_XDGACopyArea:
- return ProcXDGACopyArea(client);
- case X_XDGACopyTransparentArea:
- return ProcXDGACopyTransparentArea(client);
- case X_XDGAGetViewportStatus:
- return ProcXDGAGetViewportStatus(client);
- case X_XDGASync:
- return ProcXDGASync(client);
- case X_XDGASetClientVersion:
- return ProcXDGASetClientVersion(client);
- case X_XDGAChangePixmapMode:
- return ProcXDGAChangePixmapMode(client);
- case X_XDGACreateColormap:
- return ProcXDGACreateColormap(client);
- default:
- return BadRequest;
- }
-}
-
-#ifdef EXTMODULE
-void
-XFree86DGARegister(INITARGS)
-{
- XDGAEventBase = &DGAEventBase;
-}
-#endif
diff --git a/nx-X11/programs/Xserver/Xext/xf86dgaext.h b/nx-X11/programs/Xserver/Xext/xf86dgaext.h
deleted file mode 100644
index 16fc4c8b2..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86dgaext.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $XFree86$ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _XF86DGAEXT_H_
-#define _XF86DGAEXT_H_
-
-extern DISPATCH_PROC(ProcXF86DGADispatch);
-
-#endif /* _XF86DGAEXT_H_ */
diff --git a/nx-X11/programs/Xserver/Xext/xf86misc.c b/nx-X11/programs/Xserver/Xext/xf86misc.c
deleted file mode 100644
index a5dc2e212..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86misc.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.41 2003/11/17 22:20:27 dawes Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 The XFree86 Project, Inc
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "inputstr.h"
-#include "servermd.h"
-#define _XF86MISC_SERVER_
-#undef _XF86MISC_SAVER_COMPAT_
-#include <X11/extensions/xf86mscstr.h>
-#include "swaprep.h"
-#include "xf86.h"
-#include <X11/Xfuncproto.h>
-#include "xf86miscproc.h"
-
-#if 0
-#include <X11/Xtrans/Xtrans.h>
-#include "../os/osdep.h"
-#include <X11/Xauth.h>
-#ifndef USL
-#ifndef Lynx
-#include <sys/socket.h>
-#else
-#include <socket.h>
-#endif
-#endif /* USL */
-#endif
-
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
-
-static int miscErrorBase;
-static int MiscGeneration = 0;
-static int MiscClientPrivateIndex;
-
-/* This holds the client's version information */
-typedef struct {
- int major;
- int minor;
-} MiscPrivRec, *MiscPrivPtr;
-
-#define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr)
-
-static void XF86MiscResetProc(
- ExtensionEntry* /* extEntry */
-);
-
-static void
-ClientVersion(ClientPtr client, int *major, int *minor)
-{
- MiscPrivPtr pPriv;
-
- pPriv = MPRIV(client);
- if (!pPriv) {
- if (major) *major = 0;
- if (minor) *minor = 0;
- return;
- }
-
- if (major) *major = pPriv->major;
- if (minor) *minor = pPriv->minor;
-}
-
-static DISPATCH_PROC(ProcXF86MiscDispatch);
-static DISPATCH_PROC(ProcXF86MiscQueryVersion);
-static DISPATCH_PROC(ProcXF86MiscGetKbdSettings);
-static DISPATCH_PROC(ProcXF86MiscGetMouseSettings);
-static DISPATCH_PROC(ProcXF86MiscSetKbdSettings);
-static DISPATCH_PROC(ProcXF86MiscSetMouseSettings);
-static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState);
-static DISPATCH_PROC(ProcXF86MiscSetClientVersion);
-static DISPATCH_PROC(ProcXF86MiscGetFilePaths);
-static DISPATCH_PROC(ProcXF86MiscPassMessage);
-#ifdef _XF86MISC_SAVER_COMPAT_
-static DISPATCH_PROC(ProcXF86MiscGetSaver);
-static DISPATCH_PROC(ProcXF86MiscSetSaver);
-#endif
-static DISPATCH_PROC(SProcXF86MiscDispatch);
-static DISPATCH_PROC(SProcXF86MiscQueryVersion);
-static DISPATCH_PROC(SProcXF86MiscGetKbdSettings);
-static DISPATCH_PROC(SProcXF86MiscGetMouseSettings);
-static DISPATCH_PROC(SProcXF86MiscSetKbdSettings);
-static DISPATCH_PROC(SProcXF86MiscSetMouseSettings);
-static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState);
-static DISPATCH_PROC(SProcXF86MiscSetClientVersion);
-static DISPATCH_PROC(SProcXF86MiscGetFilePaths);
-static DISPATCH_PROC(SProcXF86MiscPassMessage);
-#ifdef _XF86MISC_SAVER_COMPAT_
-static DISPATCH_PROC(SProcXF86MiscGetSaver);
-static DISPATCH_PROC(SProcXF86MiscSetSaver);
-#endif
-
-#if 0
-static unsigned char XF86MiscReqCode = 0;
-#endif
-
-#ifdef DEBUG
-# define DEBUG_P(x) ErrorF(x"\n");
-#else
-# define DEBUG_P(x) /**/
-#endif
-
-#define MISCERR(x) (miscErrorBase + x)
-
-void
-XFree86MiscExtensionInit(void)
-{
- ExtensionEntry* extEntry;
-
- DEBUG_P("XFree86MiscExtensionInit");
-
- if (!xf86GetModInDevEnabled())
- return;
-
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (MiscGeneration != serverGeneration) {
- MiscClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * MiscPrivRec.
- */
- if (!AllocateClientPrivate(MiscClientPrivateIndex, 0)) {
- ErrorF("XFree86MiscExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- MiscGeneration = serverGeneration;
- }
-
- if (
- (extEntry = AddExtension(XF86MISCNAME,
- XF86MiscNumberEvents,
- XF86MiscNumberErrors,
- ProcXF86MiscDispatch,
- SProcXF86MiscDispatch,
- XF86MiscResetProc,
- StandardMinorOpcode))) {
-#if 0
- XF86MiscReqCode = (unsigned char)extEntry->base;
-#endif
- miscErrorBase = extEntry->errorBase;
- }
-}
-
-/*ARGSUSED*/
-static void
-XF86MiscResetProc (extEntry)
- ExtensionEntry* extEntry;
-{
-}
-
-static int
-ProcXF86MiscQueryVersion(client)
- register ClientPtr client;
-{
- xXF86MiscQueryVersionReply rep;
- register int n;
-
- DEBUG_P("XF86MiscQueryVersion");
-
- REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XF86MISC_MAJOR_VERSION;
- rep.minorVersion = XF86MISC_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-#ifdef _XF86MISC_SAVER_COMPAT_
-/* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */
-
-/*
- * This will go away, but remains for now for compatibility with older
- * clients.
- */
-static int
-ProcXF86MiscSetSaver(client)
- register ClientPtr client;
-{
- REQUEST(xXF86MiscSetSaverReq);
- ScrnInfoPtr vptr;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
-
- REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
-
- if (stuff->suspendTime < 0)
- return BadValue;
- if (stuff->offTime < 0)
- return BadValue;
-
- return (client->noClientException);
-}
-
-/*
- * This will go away, but remains for now for compatibility with older
- * clients.
- */
-static int
-ProcXF86MiscGetSaver(client)
- register ClientPtr client;
-{
- REQUEST(xXF86MiscGetSaverReq);
- xXF86MiscGetSaverReply rep;
- register int n;
- ScrnInfoPtr vptr;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
-
- REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.suspendTime = 0;
- rep.offTime = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.suspendTime, n);
- swapl(&rep.offTime, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep);
- return (client->noClientException);
-}
-
-#endif /* _XF86MISC_SAVER_COMPAT_ */
-
-static int
-ProcXF86MiscGetMouseSettings(client)
- register ClientPtr client;
-{
- xXF86MiscGetMouseSettingsReply rep;
- char *devname;
- pointer mouse;
- register int n;
-
- DEBUG_P("XF86MiscGetMouseSettings");
-
- REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
-
- if (!MiscExtGetMouseSettings(&mouse, &devname))
- return BadValue;
-
- rep.mousetype = MiscExtGetMouseValue(mouse, MISC_MSE_PROTO);
- rep.baudrate = MiscExtGetMouseValue(mouse, MISC_MSE_BAUDRATE);
- rep.samplerate = MiscExtGetMouseValue(mouse, MISC_MSE_SAMPLERATE);
- rep.resolution = MiscExtGetMouseValue(mouse, MISC_MSE_RESOLUTION);
- rep.buttons = MiscExtGetMouseValue(mouse, MISC_MSE_BUTTONS);
- rep.emulate3buttons = MiscExtGetMouseValue(mouse, MISC_MSE_EM3BUTTONS);
- rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
- rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
- rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
- rep.devnamelen = (devname? strlen(devname): 0);
- rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
- sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.mousetype, n);
- swapl(&rep.baudrate, n);
- swapl(&rep.samplerate, n);
- swapl(&rep.resolution, n);
- swapl(&rep.buttons, n);
- swapl(&rep.emulate3buttons, n);
- swapl(&rep.emulate3timeout, n);
- swapl(&rep.chordmiddle, n);
- swapl(&rep.flags, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
- MiscExtDestroyStruct(mouse, MISC_POINTER);
-
- if (rep.devnamelen)
- WriteToClient(client, rep.devnamelen, devname);
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscGetKbdSettings(client)
- register ClientPtr client;
-{
- xXF86MiscGetKbdSettingsReply rep;
- pointer kbd;
- register int n;
-
- DEBUG_P("XF86MiscGetKbdSettings");
-
- REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- if (!MiscExtGetKbdSettings(&kbd))
- return BadValue;
-
- rep.kbdtype = MiscExtGetKbdValue(kbd, MISC_KBD_TYPE);
- rep.rate = MiscExtGetKbdValue(kbd, MISC_KBD_RATE);
- rep.delay = MiscExtGetKbdValue(kbd, MISC_KBD_DELAY);
- rep.servnumlock = MiscExtGetKbdValue(kbd, MISC_KBD_SERVNUMLOCK);
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.kbdtype, n);
- swapl(&rep.rate, n);
- swapl(&rep.delay, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscSetMouseSettings(client)
- register ClientPtr client;
-{
- MiscExtReturn ret;
- pointer mouse;
- char *devname = NULL;
- int major, minor;
-
- REQUEST(xXF86MiscSetMouseSettingsReq);
-
- DEBUG_P("XF86MiscSetMouseSettings");
-
- REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq);
-
- ClientVersion(client, &major, &minor);
-
- if (xf86GetVerbosity() > 1) {
- ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
- (int)stuff->mousetype, (int)stuff->baudrate,
- (int)stuff->samplerate, stuff->chordmiddle);
- ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n",
- stuff->emulate3buttons, (int)stuff->emulate3timeout,
- (int)stuff->resolution, (unsigned long)stuff->flags);
- }
-
- if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0)
- return BadAlloc;
-
- MiscExtSetMouseValue(mouse, MISC_MSE_PROTO, stuff->mousetype);
- MiscExtSetMouseValue(mouse, MISC_MSE_BAUDRATE, stuff->baudrate);
- MiscExtSetMouseValue(mouse, MISC_MSE_SAMPLERATE, stuff->samplerate);
- MiscExtSetMouseValue(mouse, MISC_MSE_RESOLUTION, stuff->resolution);
- MiscExtSetMouseValue(mouse, MISC_MSE_BUTTONS, stuff->buttons);
- MiscExtSetMouseValue(mouse, MISC_MSE_EM3BUTTONS, stuff->emulate3buttons);
- MiscExtSetMouseValue(mouse, MISC_MSE_EM3TIMEOUT, stuff->emulate3timeout);
- MiscExtSetMouseValue(mouse, MISC_MSE_CHORDMIDDLE, stuff->chordmiddle);
- MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags);
-
- if ((major > 0 || minor > 5) && stuff->devnamelen) {
- int size = sizeof(xXF86MiscSetMouseSettingsReq) + stuff->devnamelen;
- size = (size + 3) >> 2;
- if (client->req_len < size)
- return BadLength;
- if (stuff->devnamelen) {
- if (!(devname = xalloc(stuff->devnamelen)))
- return BadAlloc;
- strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen);
- if (xf86GetVerbosity() > 1)
- ErrorF("SetMouseSettings - device: %s\n",devname);
- MiscExtSetMouseDevice(mouse, devname);
- }
- }
-
- ret = MiscExtApply(mouse, MISC_POINTER);
-
- if (devname)
- xfree(devname);
-
- switch ((ret)) {
- case MISC_RET_SUCCESS: break;
- case MISC_RET_BADVAL: return BadValue;
- case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol);
- case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate);
- case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags);
- case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
- case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule);
- default:
- ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret);
- return BadImplementation;
- }
-
- if (xf86GetVerbosity() > 1)
- ErrorF("SetMouseSettings - Succeeded\n");
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscSetKbdSettings(client)
- register ClientPtr client;
-{
- MiscExtReturn ret;
- pointer kbd;
- REQUEST(xXF86MiscSetKbdSettingsReq);
-
- DEBUG_P("XF86MiscSetKbdSettings");
-
- REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
-
- if (xf86GetVerbosity() > 1)
- ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
- (int)stuff->kbdtype, (int)stuff->rate,
- (int)stuff->delay, stuff->servnumlock);
-
- if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
- return BadAlloc;
-
- MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, stuff->kbdtype);
- MiscExtSetKbdValue(kbd, MISC_KBD_RATE, stuff->rate);
- MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, stuff->delay);
- MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, stuff->servnumlock);
-
- switch ((ret = MiscExtApply(kbd, MISC_KEYBOARD))) {
- case MISC_RET_SUCCESS: break;
- case MISC_RET_BADVAL: return BadValue;
- case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
- default:
- ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret);
- return BadImplementation;
- }
-
- if (xf86GetVerbosity() > 1)
- ErrorF("SetKbdSettings - Succeeded\n");
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscSetGrabKeysState(client)
- register ClientPtr client;
-{
- int n, status;
- xXF86MiscSetGrabKeysStateReply rep;
- REQUEST(xXF86MiscSetGrabKeysStateReq);
-
- DEBUG_P("XF86MiscSetGrabKeysState");
-
- REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
-
- if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) {
- if (xf86GetVerbosity() > 1)
- ErrorF("SetGrabKeysState - %s\n",
- stuff->enable ? "enabled" : "disabled");
- }
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscSetGrabKeysStateReply), (char *)&rep);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscSetClientVersion(ClientPtr client)
-{
- REQUEST(xXF86MiscSetClientVersionReq);
-
- MiscPrivPtr pPriv;
-
- DEBUG_P("XF86MiscSetClientVersion");
-
- REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
-
- if ((pPriv = MPRIV(client)) == NULL) {
- pPriv = xalloc(sizeof(MiscPrivRec));
- if (!pPriv)
- return BadAlloc;
- MPRIV(client) = pPriv;
- }
- ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor);
- pPriv->major = stuff->major;
- pPriv->minor = stuff->minor;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscGetFilePaths(client)
- register ClientPtr client;
-{
- xXF86MiscGetFilePathsReply rep;
- const char *configfile;
- const char *modulepath;
- const char *logfile;
- register int n;
-
- DEBUG_P("XF86MiscGetFilePaths");
-
- REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
-
- if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
- return BadValue;
-
- rep.configlen = (configfile? strlen(configfile): 0);
- rep.modulelen = (modulepath? strlen(modulepath): 0);
- rep.loglen = (logfile? strlen(logfile): 0);
- rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
- ((rep.configlen + 3) & ~3) +
- ((rep.modulelen + 3) & ~3) +
- ((rep.loglen + 3) & ~3) ) >> 2;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.configlen, n);
- swaps(&rep.modulelen, n);
- swaps(&rep.loglen, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
-
- if (rep.configlen)
- WriteToClient(client, rep.configlen, (char *)configfile);
- if (rep.modulelen)
- WriteToClient(client, rep.modulelen, (char *)modulepath);
- if (rep.loglen)
- WriteToClient(client, rep.loglen, (char *)logfile);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscPassMessage(client)
- register ClientPtr client;
-{
- xXF86MiscPassMessageReply rep;
- char *msgtype, *msgval, *retstr;
- int retval, size;
- register int n;
-
- REQUEST(xXF86MiscPassMessageReq);
-
- DEBUG_P("XF86MiscPassMessage");
-
- REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq);
- size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2;
- size+= (stuff->typelen + 3) >> 2;
- size+= (stuff->vallen + 3) >> 2;
- if (client->req_len < size)
- return BadLength;
- if (stuff->typelen) {
- if (!(msgtype = xalloc(stuff->typelen)))
- return BadAlloc;
- strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen);
- } else return BadValue;
- if (stuff->vallen) {
- if (!(msgval = xalloc(stuff->vallen))) {
- xfree(msgtype);
- return BadAlloc;
- }
- strncpy(msgval,(char*)((char*)&stuff[1] + ((stuff->typelen + 3) & ~3)),
- stuff->vallen);
- } else {
- xfree(msgtype);
- return BadValue;
- }
-
- if ((retval = MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) {
- xfree(msgtype);
- xfree(msgval);
- return retval;
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.mesglen = (retstr? strlen(retstr): 0);
- rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
- ((rep.mesglen + 3) & ~3)) >> 2;
- rep.status = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.mesglen, n);
- }
- WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
-
- if (rep.mesglen)
- WriteToClient(client, rep.mesglen, (char *)retstr);
-
- xfree(msgtype);
- xfree(msgval);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86MiscDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XF86MiscQueryVersion:
- return ProcXF86MiscQueryVersion(client);
-#ifdef _XF86MISC_SAVER_COMPAT_
- case X_XF86MiscGetSaver:
- return ProcXF86MiscGetSaver(client);
- case X_XF86MiscSetSaver:
- return ProcXF86MiscSetSaver(client);
-#endif
- case X_XF86MiscGetMouseSettings:
- return ProcXF86MiscGetMouseSettings(client);
- case X_XF86MiscGetKbdSettings:
- return ProcXF86MiscGetKbdSettings(client);
- case X_XF86MiscSetClientVersion:
- return ProcXF86MiscSetClientVersion(client);
- case X_XF86MiscGetFilePaths:
- return ProcXF86MiscGetFilePaths(client);
- case X_XF86MiscPassMessage:
- return ProcXF86MiscPassMessage(client);
- default:
- if (!xf86GetModInDevEnabled())
- return miscErrorBase + XF86MiscModInDevDisabled;
- if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
- switch (stuff->data) {
- case X_XF86MiscSetMouseSettings:
- return ProcXF86MiscSetMouseSettings(client);
- case X_XF86MiscSetKbdSettings:
- return ProcXF86MiscSetKbdSettings(client);
- case X_XF86MiscSetGrabKeysState:
- return ProcXF86MiscSetGrabKeysState(client);
- default:
- return BadRequest;
- }
- } else
- return miscErrorBase + XF86MiscModInDevClientNotLocal;
- }
-}
-
-static int
-SProcXF86MiscQueryVersion(client)
- register ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcXF86MiscQueryVersion(client);
-}
-
-#ifdef _XF86MISC_SAVER_COMPAT_
-static int
-SProcXF86MiscGetSaver(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscGetSaverReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
- swaps(&stuff->screen, n);
- return ProcXF86MiscGetSaver(client);
-}
-
-static int
-SProcXF86MiscSetSaver(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscSetSaverReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
- swaps(&stuff->screen, n);
- swapl(&stuff->suspendTime, n);
- swapl(&stuff->offTime, n);
- return ProcXF86MiscSetSaver(client);
-}
-#endif /* _XF86MISC_SAVER_COMPAT_ */
-
-static int
-SProcXF86MiscGetMouseSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscGetMouseSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
- return ProcXF86MiscGetMouseSettings(client);
-}
-
-static int
-SProcXF86MiscGetKbdSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscGetKbdSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
- return ProcXF86MiscGetKbdSettings(client);
-}
-
-static int
-SProcXF86MiscSetMouseSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscSetMouseSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq);
- swapl(&stuff->mousetype, n);
- swapl(&stuff->baudrate, n);
- swapl(&stuff->samplerate, n);
- swapl(&stuff->resolution, n);
- swapl(&stuff->buttons, n);
- swapl(&stuff->emulate3timeout, n);
- swapl(&stuff->flags, n);
- return ProcXF86MiscSetMouseSettings(client);
-}
-
-static int
-SProcXF86MiscSetKbdSettings(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscSetKbdSettingsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
- swapl(&stuff->kbdtype, n);
- swapl(&stuff->rate, n);
- swapl(&stuff->delay, n);
- return ProcXF86MiscSetKbdSettings(client);
-}
-
-static int
-SProcXF86MiscSetGrabKeysState(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscSetGrabKeysStateReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
- swaps(&stuff->enable, n);
- return ProcXF86MiscSetGrabKeysState(client);
-}
-
-static int
-SProcXF86MiscSetClientVersion(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86MiscSetClientVersionReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
- swaps(&stuff->major, n);
- swaps(&stuff->minor, n);
- return ProcXF86MiscSetClientVersion(client);
-}
-
-static int
-SProcXF86MiscGetFilePaths(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscGetFilePathsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
- return ProcXF86MiscGetFilePaths(client);
-}
-
-static int
-SProcXF86MiscPassMessage(client)
- ClientPtr client;
-{
- register int n;
- REQUEST(xXF86MiscPassMessageReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq);
- return ProcXF86MiscPassMessage(client);
-}
-
-static int
-SProcXF86MiscDispatch (client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XF86MiscQueryVersion:
- return SProcXF86MiscQueryVersion(client);
-#ifdef _XF86MISC_SAVER_COMPAT_
- case X_XF86MiscGetSaver:
- return SProcXF86MiscGetSaver(client);
- case X_XF86MiscSetSaver:
- return SProcXF86MiscSetSaver(client);
-#endif
- case X_XF86MiscGetMouseSettings:
- return SProcXF86MiscGetMouseSettings(client);
- case X_XF86MiscGetKbdSettings:
- return SProcXF86MiscGetKbdSettings(client);
- case X_XF86MiscSetClientVersion:
- return SProcXF86MiscSetClientVersion(client);
- case X_XF86MiscGetFilePaths:
- return SProcXF86MiscGetFilePaths(client);
- case X_XF86MiscPassMessage:
- return SProcXF86MiscPassMessage(client);
- default:
- if (!xf86GetModInDevEnabled())
- return miscErrorBase + XF86MiscModInDevDisabled;
- if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
- switch (stuff->data) {
- case X_XF86MiscSetMouseSettings:
- return SProcXF86MiscSetMouseSettings(client);
- case X_XF86MiscSetKbdSettings:
- return SProcXF86MiscSetKbdSettings(client);
- case X_XF86MiscSetGrabKeysState:
- return SProcXF86MiscSetGrabKeysState(client);
- default:
- return BadRequest;
- }
- } else
- return miscErrorBase + XF86MiscModInDevClientNotLocal;
- }
-}
-
diff --git a/nx-X11/programs/Xserver/Xext/xf86miscproc.h b/nx-X11/programs/Xserver/Xext/xf86miscproc.h
deleted file mode 100644
index 87a251767..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86miscproc.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86miscproc.h,v 1.5 2002/11/20 04:04:58 dawes Exp $ */
-
-/* Prototypes for Pointer/Keyboard functions that the DDX must provide */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _XF86MISCPROC_H_
-#define _XF86MISCPROC_H_
-
-typedef enum {
- MISC_MSE_PROTO,
- MISC_MSE_BAUDRATE,
- MISC_MSE_SAMPLERATE,
- MISC_MSE_RESOLUTION,
- MISC_MSE_BUTTONS,
- MISC_MSE_EM3BUTTONS,
- MISC_MSE_EM3TIMEOUT,
- MISC_MSE_CHORDMIDDLE,
- MISC_MSE_FLAGS
-} MiscExtMseValType;
-
-typedef enum {
- MISC_KBD_TYPE,
- MISC_KBD_RATE,
- MISC_KBD_DELAY,
- MISC_KBD_SERVNUMLOCK
-} MiscExtKbdValType;
-
-typedef enum {
- MISC_RET_SUCCESS,
- MISC_RET_BADVAL,
- MISC_RET_BADMSEPROTO,
- MISC_RET_BADBAUDRATE,
- MISC_RET_BADFLAGS,
- MISC_RET_BADCOMBO,
- MISC_RET_BADKBDTYPE,
- MISC_RET_NOMODULE
-} MiscExtReturn;
-
-typedef enum {
- MISC_POINTER,
- MISC_KEYBOARD
-} MiscExtStructType;
-
-#define MISC_MSEFLAG_CLEARDTR 1
-#define MISC_MSEFLAG_CLEARRTS 2
-#define MISC_MSEFLAG_REOPEN 128
-
-void XFree86MiscExtensionInit(void);
-
-Bool MiscExtGetMouseSettings(pointer *mouse, char **devname);
-int MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype);
-Bool MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value);
-Bool MiscExtGetKbdSettings(pointer *kbd);
-int MiscExtGetKbdValue(pointer kbd, MiscExtKbdValType valtype);
-Bool MiscExtSetKbdValue(pointer kbd, MiscExtKbdValType valtype, int value);
-int MiscExtSetGrabKeysState(ClientPtr client, int enable);
-pointer MiscExtCreateStruct(MiscExtStructType mse_or_kbd);
-void MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd);
-MiscExtReturn MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd);
-Bool MiscExtSetMouseDevice(pointer mouse, char* device);
-Bool MiscExtGetFilePaths(const char **configfile, const char **modulepath,
- const char **logfile);
-int MiscExtPassMessage(int scrn, const char *msgtype, const char *msgval,
- char **retstr);
-
-#endif
-
diff --git a/nx-X11/programs/Xserver/Xext/xf86vmode.c b/nx-X11/programs/Xserver/Xext/xf86vmode.c
deleted file mode 100644
index fa49fcd75..000000000
--- a/nx-X11/programs/Xserver/Xext/xf86vmode.c
+++ /dev/null
@@ -1,2206 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.58 2003/11/06 18:37:57 tsi Exp $ */
-
-/*
-
-Copyright 1995 Kaleb S. KEITHLEY
-
-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 Kaleb S. KEITHLEY 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 Kaleb S. KEITHLEY
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-from Kaleb S. KEITHLEY
-
-*/
-/* $XdotOrg: xc/programs/Xserver/Xext/xf86vmode.c,v 1.8 2005/07/16 03:49:58 kem Exp $ */
-/* $Xorg: xf86vmode.c,v 1.3 2000/08/17 19:47:59 cpqbld Exp $ */
-/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define _XF86VIDMODE_SERVER_
-#include <X11/extensions/xf86vmstr.h>
-#include "swaprep.h"
-#include "xf86.h"
-#include "vidmodeproc.h"
-
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
-
-#define DEFAULT_XF86VIDMODE_VERBOSITY 3
-
-static int VidModeErrorBase;
-static int VidModeGeneration = 0;
-static int VidModeClientPrivateIndex;
-
-/* This holds the client's version information */
-typedef struct {
- int major;
- int minor;
-} VidModePrivRec, *VidModePrivPtr;
-
-#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
-
-static void XF86VidModeResetProc(
- ExtensionEntry* /* extEntry */
-);
-
-static DISPATCH_PROC(ProcXF86VidModeDispatch);
-static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
-static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
-static DISPATCH_PROC(ProcXF86VidModeGetMonitor);
-static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch);
-static DISPATCH_PROC(ProcXF86VidModeAddModeLine);
-static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine);
-static DISPATCH_PROC(ProcXF86VidModeModModeLine);
-static DISPATCH_PROC(ProcXF86VidModeValidateModeLine);
-static DISPATCH_PROC(ProcXF86VidModeQueryVersion);
-static DISPATCH_PROC(ProcXF86VidModeSwitchMode);
-static DISPATCH_PROC(ProcXF86VidModeSwitchToMode);
-static DISPATCH_PROC(ProcXF86VidModeGetViewPort);
-static DISPATCH_PROC(ProcXF86VidModeSetViewPort);
-static DISPATCH_PROC(ProcXF86VidModeGetDotClocks);
-static DISPATCH_PROC(ProcXF86VidModeSetGamma);
-static DISPATCH_PROC(ProcXF86VidModeGetGamma);
-static DISPATCH_PROC(ProcXF86VidModeSetClientVersion);
-static DISPATCH_PROC(ProcXF86VidModeGetGammaRamp);
-static DISPATCH_PROC(ProcXF86VidModeSetGammaRamp);
-static DISPATCH_PROC(ProcXF86VidModeGetGammaRampSize);
-static DISPATCH_PROC(SProcXF86VidModeDispatch);
-static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines);
-static DISPATCH_PROC(SProcXF86VidModeGetModeLine);
-static DISPATCH_PROC(SProcXF86VidModeGetMonitor);
-static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch);
-static DISPATCH_PROC(SProcXF86VidModeAddModeLine);
-static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine);
-static DISPATCH_PROC(SProcXF86VidModeModModeLine);
-static DISPATCH_PROC(SProcXF86VidModeValidateModeLine);
-static DISPATCH_PROC(SProcXF86VidModeQueryVersion);
-static DISPATCH_PROC(SProcXF86VidModeSwitchMode);
-static DISPATCH_PROC(SProcXF86VidModeSwitchToMode);
-static DISPATCH_PROC(SProcXF86VidModeGetViewPort);
-static DISPATCH_PROC(SProcXF86VidModeSetViewPort);
-static DISPATCH_PROC(SProcXF86VidModeGetDotClocks);
-static DISPATCH_PROC(SProcXF86VidModeSetGamma);
-static DISPATCH_PROC(SProcXF86VidModeGetGamma);
-static DISPATCH_PROC(SProcXF86VidModeSetClientVersion);
-static DISPATCH_PROC(SProcXF86VidModeGetGammaRamp);
-static DISPATCH_PROC(SProcXF86VidModeSetGammaRamp);
-static DISPATCH_PROC(SProcXF86VidModeGetGammaRampSize);
-
-#if 0
-static unsigned char XF86VidModeReqCode = 0;
-#endif
-
-/* The XF86VIDMODE_EVENTS code is far from complete */
-
-#ifdef XF86VIDMODE_EVENTS
-static int XF86VidModeEventBase = 0;
-
-static void SXF86VidModeNotifyEvent();
- xXF86VidModeNotifyEvent * /* from */,
- xXF86VidModeNotifyEvent * /* to */
-);
-
-extern WindowPtr *WindowTable;
-
-static RESTYPE EventType; /* resource type for event masks */
-
-typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
-
-typedef struct _XF86VidModeEvent {
- XF86VidModeEventPtr next;
- ClientPtr client;
- ScreenPtr screen;
- XID resource;
- CARD32 mask;
-} XF86VidModeEventRec;
-
-static int XF86VidModeFreeEvents();
-
-typedef struct _XF86VidModeScreenPrivate {
- XF86VidModeEventPtr events;
- Bool hasWindow;
-} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
-
-static int ScreenPrivateIndex;
-
-#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
-#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
-#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
-
-#define New(t) (xalloc (sizeof (t)))
-#endif
-
-#ifdef DEBUG
-# define DEBUG_P(x) ErrorF(x"\n");
-#else
-# define DEBUG_P(x) /**/
-#endif
-
-void
-XFree86VidModeExtensionInit(void)
-{
- ExtensionEntry* extEntry;
- ScreenPtr pScreen;
- int i;
- Bool enabled = FALSE;
-
- DEBUG_P("XFree86VidModeExtensionInit");
-
-#ifdef XF86VIDMODE_EVENTS
- EventType = CreateNewResourceType(XF86VidModeFreeEvents);
- ScreenPrivateIndex = AllocateScreenPrivateIndex ();
-#endif
-
- for(i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
- if (VidModeExtensionInit(pScreen))
- enabled = TRUE;
-#ifdef XF86VIDMODE_EVENTS
- SetScreenPrivate (pScreen, NULL);
-#endif
- }
- /* This means that the DDX doesn't want the vidmode extension enabled */
- if (!enabled)
- return;
-
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (VidModeGeneration != serverGeneration) {
- VidModeClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * VidModePrivRec.
- */
- if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
- ErrorF("XFree86VidModeExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- VidModeGeneration = serverGeneration;
- }
-
- if (
-#ifdef XF86VIDMODE_EVENTS
- EventType && ScreenPrivateIndex != -1 &&
-#endif
- (extEntry = AddExtension(XF86VIDMODENAME,
- XF86VidModeNumberEvents,
- XF86VidModeNumberErrors,
- ProcXF86VidModeDispatch,
- SProcXF86VidModeDispatch,
- XF86VidModeResetProc,
- StandardMinorOpcode))) {
-#if 0
- XF86VidModeReqCode = (unsigned char)extEntry->base;
-#endif
- VidModeErrorBase = extEntry->errorBase;
-#ifdef XF86VIDMODE_EVENTS
- XF86VidModeEventBase = extEntry->eventBase;
- EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
-#endif
- }
-}
-
-/*ARGSUSED*/
-static void
-XF86VidModeResetProc (extEntry)
- ExtensionEntry* extEntry;
-{
-}
-
-static int
-ClientMajorVersion(ClientPtr client)
-{
- VidModePrivPtr pPriv;
-
- pPriv = VMPRIV(client);
- if (!pPriv)
- return 0;
- else
- return pPriv->major;
-}
-
-#ifdef XF86VIDMODE_EVENTS
-static void
-CheckScreenPrivate (pScreen)
- ScreenPtr pScreen;
-{
- SetupScreen (pScreen);
-
- if (!pPriv)
- return;
- if (!pPriv->events && !pPriv->hasWindow) {
- xfree (pPriv);
- SetScreenPrivate (pScreen, NULL);
- }
-}
-
-static XF86VidModeScreenPrivatePtr
-MakeScreenPrivate (pScreen)
- ScreenPtr pScreen;
-{
- SetupScreen (pScreen);
-
- if (pPriv)
- return pPriv;
- pPriv = New (XF86VidModeScreenPrivateRec);
- if (!pPriv)
- return 0;
- pPriv->events = 0;
- pPriv->hasWindow = FALSE;
- SetScreenPrivate (pScreen, pPriv);
- return pPriv;
-}
-
-static unsigned long
-getEventMask (ScreenPtr pScreen, ClientPtr client)
-{
- SetupScreen(pScreen);
- XF86VidModeEventPtr pEv;
-
- if (!pPriv)
- return 0;
- for (pEv = pPriv->events; pEv; pEv = pEv->next)
- if (pEv->client == client)
- return pEv->mask;
- return 0;
-}
-
-static Bool
-setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
-{
- SetupScreen(pScreen);
- XF86VidModeEventPtr pEv, *pPrev;
-
- if (getEventMask (pScreen, client) == mask)
- return TRUE;
- if (!pPriv) {
- pPriv = MakeScreenPrivate (pScreen);
- if (!pPriv)
- return FALSE;
- }
- for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv->client == client)
- break;
- if (mask == 0) {
- *pPrev = pEv->next;
- xfree (pEv);
- CheckScreenPrivate (pScreen);
- } else {
- if (!pEv) {
- pEv = New (ScreenSaverEventRec);
- if (!pEv) {
- CheckScreenPrivate (pScreen);
- return FALSE;
- }
- *pPrev = pEv;
- pEv->next = NULL;
- pEv->client = client;
- pEv->screen = pScreen;
- pEv->resource = FakeClientID (client->index);
- }
- pEv->mask = mask;
- }
- return TRUE;
-}
-
-static int
-XF86VidModeFreeEvents(pointer value, XID id)
-{
- XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
- ScreenPtr pScreen = pOld->screen;
- SetupScreen (pScreen);
- XF86VidModeEventPtr pEv, *pPrev;
-
- if (!pPriv)
- return TRUE;
- for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv == pOld)
- break;
- if (!pEv)
- return TRUE;
- *pPrev = pEv->next;
- xfree (pEv);
- CheckScreenPrivate (pScreen);
- return TRUE;
-}
-
-static void
-SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
-{
- XF86VidModeScreenPrivatePtr pPriv;
- XF86VidModeEventPtr pEv;
- unsigned long mask;
- xXF86VidModeNotifyEvent ev;
- ClientPtr client;
- int kind;
-
- UpdateCurrentTimeIf ();
- mask = XF86VidModeNotifyMask;
- pScreen = screenInfo.screens[pScreen->myNum];
- pPriv = GetScreenPrivate(pScreen);
- if (!pPriv)
- return;
- kind = XF86VidModeModeChange;
- for (pEv = pPriv->events; pEv; pEv = pEv->next)
- {
- client = pEv->client;
- if (client->clientGone)
- continue;
- if (!(pEv->mask & mask))
- continue;
- ev.type = XF86VidModeNotify + XF86VidModeEventBase;
- ev.state = state;
- ev.sequenceNumber = client->sequence;
- ev.timestamp = currentTime.milliseconds;
- ev.root = WindowTable[pScreen->myNum]->drawable.id;
- ev.kind = kind;
- ev.forced = forced;
- WriteEventsToClient (client, 1, (xEvent *) &ev);
- }
-}
-
-static void
-SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
- xXF86VidModeNotifyEvent *to)
-{
- to->type = from->type;
- to->state = from->state;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->root, to->root);
- to->kind = from->kind;
- to->forced = from->forced;
-}
-#endif
-
-static int
-ProcXF86VidModeQueryVersion(ClientPtr client)
-{
- xXF86VidModeQueryVersionReply rep;
- register int n;
-
- DEBUG_P("XF86VidModeQueryVersion");
-
- REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
- rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetModeLine(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetModeLineReq);
- xXF86VidModeGetModeLineReply rep;
- xXF86OldVidModeGetModeLineReply oldrep;
- pointer mode;
- register int n;
- int dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeGetModeline");
-
- ver = ClientMajorVersion(client);
- REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
- rep.type = X_Reply;
- if (ver < 2) {
- rep.length = (SIZEOF(xXF86OldVidModeGetModeLineReply) -
- SIZEOF(xGenericReply)) >> 2;
- } else {
- rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) -
- SIZEOF(xGenericReply)) >> 2;
- }
- rep.sequenceNumber = client->sequence;
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- rep.dotclock = dotClock;
- rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
- rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
- rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
- rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
- rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
- rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
- rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
- rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
- rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
- rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("GetModeLine - scrn: %d clock: %ld\n",
- stuff->screen, (unsigned long)rep.dotclock);
- ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
- rep.hdisplay, rep.hsyncstart,
- rep.hsyncend, rep.htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- rep.vdisplay, rep.vsyncstart, rep.vsyncend,
- rep.vtotal, (unsigned long)rep.flags);
- }
-
- /*
- * Older servers sometimes had server privates that the VidMode
- * extention made available. So to be compatiable pretend that
- * there are no server privates to pass to the client
- */
- rep.privsize = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.dotclock, n);
- swaps(&rep.hdisplay, n);
- swaps(&rep.hsyncstart, n);
- swaps(&rep.hsyncend, n);
- swaps(&rep.htotal, n);
- swaps(&rep.hskew, n);
- swaps(&rep.vdisplay, n);
- swaps(&rep.vsyncstart, n);
- swaps(&rep.vsyncend, n);
- swaps(&rep.vtotal, n);
- swapl(&rep.flags, n);
- swapl(&rep.privsize, n);
- }
- if (ver < 2) {
- oldrep.type = rep.type;
- oldrep.sequenceNumber = rep.sequenceNumber;
- oldrep.length = rep.length;
- oldrep.dotclock = rep.dotclock;
- oldrep.hdisplay = rep.hdisplay;
- oldrep.hsyncstart = rep.hsyncstart;
- oldrep.hsyncend = rep.hsyncend;
- oldrep.htotal = rep.htotal;
- oldrep.vdisplay = rep.vdisplay;
- oldrep.vsyncstart = rep.vsyncstart;
- oldrep.vsyncend = rep.vsyncend;
- oldrep.vtotal = rep.vtotal;
- oldrep.flags = rep.flags;
- oldrep.privsize = rep.privsize;
- WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
- (char *)&oldrep);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
- (char *)&rep);
- }
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetAllModeLinesReq);
- xXF86VidModeGetAllModeLinesReply rep;
- xXF86VidModeModeInfo mdinf;
- xXF86OldVidModeModeInfo oldmdinf;
- pointer mode;
- int modecount, dotClock;
- register int n;
- int ver;
-
- DEBUG_P("XF86VidModeGetAllModelines");
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- ver = ClientMajorVersion(client);
-
- modecount = VidModeGetNumOfModes(stuff->screen);
- if (modecount < 1)
- return (VidModeErrorBase + XF86VidModeExtensionDisabled);
-
- if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- rep.type = X_Reply;
- rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
- SIZEOF(xGenericReply);
- if (ver < 2)
- rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
- else
- rep.length += modecount * sizeof(xXF86VidModeModeInfo);
- rep.length >>= 2;
- rep.sequenceNumber = client->sequence;
- rep.modecount = modecount;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.modecount, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
-
- do {
- mdinf.dotclock = dotClock;
- mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
- mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
- mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
- mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
- mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
- mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
- mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
- mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
- mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
- mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
- mdinf.privsize = 0;
- if (client->swapped) {
- swapl(&mdinf.dotclock, n);
- swaps(&mdinf.hdisplay, n);
- swaps(&mdinf.hsyncstart, n);
- swaps(&mdinf.hsyncend, n);
- swaps(&mdinf.htotal, n);
- swaps(&mdinf.hskew, n);
- swaps(&mdinf.vdisplay, n);
- swaps(&mdinf.vsyncstart, n);
- swaps(&mdinf.vsyncend, n);
- swaps(&mdinf.vtotal, n);
- swapl(&mdinf.flags, n);
- swapl(&mdinf.privsize, n);
- }
- if (ver < 2) {
- oldmdinf.dotclock = mdinf.dotclock;
- oldmdinf.hdisplay = mdinf.hdisplay;
- oldmdinf.hsyncstart = mdinf.hsyncstart;
- oldmdinf.hsyncend = mdinf.hsyncend;
- oldmdinf.htotal = mdinf.htotal;
- oldmdinf.vdisplay = mdinf.vdisplay;
- oldmdinf.vsyncstart = mdinf.vsyncstart;
- oldmdinf.vsyncend = mdinf.vsyncend;
- oldmdinf.vtotal = mdinf.vtotal;
- oldmdinf.flags = mdinf.flags;
- oldmdinf.privsize = mdinf.privsize;
- WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
- (char *)&oldmdinf);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
- }
-
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
-
- return (client->noClientException);
-}
-
-#define MODEMATCH(mode,stuff) \
- (VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
- && VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
- && VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
- && VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
- && VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
- && VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
- && VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
- && VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
- && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
-
-static int
-ProcXF86VidModeAddModeLine(ClientPtr client)
-{
- REQUEST(xXF86VidModeAddModeLineReq);
- xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
- xXF86VidModeAddModeLineReq newstuff;
- pointer mode;
- int len;
- int dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeAddModeline");
-
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- stuff->after_dotclock = oldstuff->after_dotclock;
- stuff->after_hdisplay = oldstuff->after_hdisplay;
- stuff->after_hsyncstart = oldstuff->after_hsyncstart;
- stuff->after_hsyncend = oldstuff->after_hsyncend;
- stuff->after_htotal = oldstuff->after_htotal;
- stuff->after_hskew = 0;
- stuff->after_vdisplay = oldstuff->after_vdisplay;
- stuff->after_vsyncstart = oldstuff->after_vsyncstart;
- stuff->after_vsyncend = oldstuff->after_vsyncend;
- stuff->after_vtotal = oldstuff->after_vtotal;
- stuff->after_flags = oldstuff->after_flags;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("AddModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- ErrorF(" after - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->after_dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->after_hdisplay, stuff->after_hsyncstart,
- stuff->after_hsyncend, stuff->after_htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->after_vdisplay, stuff->after_vsyncstart,
- stuff->after_vsyncend, stuff->after_vtotal,
- (unsigned long)stuff->after_flags);
- }
-
- if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
- len = client->req_len - (sizeof(xXF86OldVidModeAddModeLineReq) >> 2);
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
- }
- if (len != stuff->privsize)
- return BadLength;
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- return BadValue;
-
- if (stuff->after_hsyncstart < stuff->after_hdisplay ||
- stuff->after_hsyncend < stuff->after_hsyncstart ||
- stuff->after_htotal < stuff->after_hsyncend ||
- stuff->after_vsyncstart < stuff->after_vdisplay ||
- stuff->after_vsyncend < stuff->after_vsyncstart ||
- stuff->after_vtotal < stuff->after_vsyncend)
- return BadValue;
-
- if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
- Bool found = FALSE;
- if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
- do {
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
- == dotClock) && MODEMATCH(mode, stuff)) {
- found = TRUE;
- break;
- }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
- }
- if (!found)
- return BadValue;
- }
-
-
- mode = VidModeCreateMode();
- if (mode == NULL)
- return BadValue;
-
- VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
- VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
- VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
- VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
- VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
- VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
- VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
-
- if (stuff->privsize)
- ErrorF("AddModeLine - Privates in request have been ignored\n");
-
- /* Check that the mode is consistent with the monitor specs */
- switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
- case MODE_OK:
- break;
- case MODE_HSYNC:
- case MODE_H_ILLEGAL:
- xfree(mode);
- return VidModeErrorBase + XF86VidModeBadHTimings;
- case MODE_VSYNC:
- case MODE_V_ILLEGAL:
- xfree(mode);
- return VidModeErrorBase + XF86VidModeBadVTimings;
- default:
- xfree(mode);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
- }
-
- /* Check that the driver is happy with the mode */
- if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
- xfree(mode);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
- }
-
- VidModeSetCrtcForMode(stuff->screen, mode);
-
- VidModeAddModeline(stuff->screen, mode);
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("AddModeLine - Succeeded\n");
- return client->noClientException;
-}
-
-static int
-ProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
- REQUEST(xXF86VidModeDeleteModeLineReq);
- xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
- xXF86VidModeDeleteModeLineReq newstuff;
- pointer mode;
- int len, dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeDeleteModeline");
-
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- }
-
- if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
- len = client->req_len - (sizeof(xXF86OldVidModeDeleteModeLineReq) >> 2);
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
- }
- if (len != stuff->privsize) {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
- "len = %d, length = %d\n",
- (unsigned long)client->req_len,
- (int)sizeof(xXF86VidModeDeleteModeLineReq)>>2,
- (unsigned long)stuff->privsize, len, stuff->length);
- }
- return BadLength;
- }
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
- }
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff))
- return BadValue;
-
- if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- do {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
- }
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff)) {
- VidModeDeleteModeline(stuff->screen, mode);
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("DeleteModeLine - Succeeded\n");
- return(client->noClientException);
- }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
-
- return BadValue;
-}
-
-static int
-ProcXF86VidModeModModeLine(ClientPtr client)
-{
- REQUEST(xXF86VidModeModModeLineReq);
- xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
- xXF86VidModeModModeLineReq newstuff;
- pointer mode, modetmp;
- int len, dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeModModeline");
-
- ver = ClientMajorVersion(client);
- if (ver < 2 ) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
- (int)stuff->screen, stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- }
-
- if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
- len = client->req_len - (sizeof(xXF86OldVidModeModModeLineReq) >> 2);
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
- }
- if (len != stuff->privsize)
- return BadLength;
-
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- return BadValue;
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- modetmp = VidModeCreateMode();
- VidModeCopyMode(mode, modetmp);
-
- VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
- VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
- VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
- VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
- VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
- VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
-
- if (stuff->privsize)
- ErrorF("ModModeLine - Privates in request have been ignored\n");
-
- /* Check that the mode is consistent with the monitor specs */
- switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
- case MODE_OK:
- break;
- case MODE_HSYNC:
- case MODE_H_ILLEGAL:
- xfree(modetmp);
- return VidModeErrorBase + XF86VidModeBadHTimings;
- case MODE_VSYNC:
- case MODE_V_ILLEGAL:
- xfree(modetmp);
- return VidModeErrorBase + XF86VidModeBadVTimings;
- default:
- xfree(modetmp);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
- }
-
- /* Check that the driver is happy with the mode */
- if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
- xfree(modetmp);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
- }
- xfree(modetmp);
-
- VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
- VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
- VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
- VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
- VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
- VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
-
- VidModeSetCrtcForMode(stuff->screen, mode);
- VidModeSwitchMode(stuff->screen, mode);
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ModModeLine - Succeeded\n");
- return(client->noClientException);
-}
-
-static int
-ProcXF86VidModeValidateModeLine(ClientPtr client)
-{
- REQUEST(xXF86VidModeValidateModeLineReq);
- xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
- xXF86VidModeValidateModeLineReq newstuff;
- xXF86VidModeValidateModeLineReply rep;
- pointer mode, modetmp = NULL;
- int len, status, dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeValidateModeline");
-
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- }
-
- if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
- len = client->req_len -
- (sizeof(xXF86OldVidModeValidateModeLineReq) >> 2);
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
- }
- if (len != stuff->privsize)
- return BadLength;
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- status = MODE_OK;
-
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- {
- status = MODE_BAD;
- goto status_reply;
- }
-
- if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- modetmp = VidModeCreateMode();
- VidModeCopyMode(mode, modetmp);
-
- VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
- VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
- VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
- VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
- VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
- VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
- if (stuff->privsize)
- ErrorF("ValidateModeLine - Privates in request have been ignored\n");
-
- /* Check that the mode is consistent with the monitor specs */
- if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
- goto status_reply;
-
- /* Check that the driver is happy with the mode */
- status = VidModeCheckModeForDriver(stuff->screen, modetmp);
-
-status_reply:
- if(modetmp)
- xfree(modetmp);
-
- rep.type = X_Reply;
- rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply)
- - SIZEOF(xGenericReply)) >> 2;
- rep.sequenceNumber = client->sequence;
- rep.status = status;
- if (client->swapped) {
- register int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
- return(client->noClientException);
-}
-
-static int
-ProcXF86VidModeSwitchMode(ClientPtr client)
-{
- REQUEST(xXF86VidModeSwitchModeReq);
-
- DEBUG_P("XF86VidModeSwitchMode");
-
- REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeSwitchToMode(ClientPtr client)
-{
- REQUEST(xXF86VidModeSwitchToModeReq);
- xXF86OldVidModeSwitchToModeReq *oldstuff =
- (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
- xXF86VidModeSwitchToModeReq newstuff;
- pointer mode;
- int len, dotClock;
- int ver;
-
- DEBUG_P("XF86VidModeSwitchToMode");
-
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- }
-
- if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
- len = client->req_len - (sizeof(xXF86OldVidModeSwitchToModeReq) >> 2);
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
- len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2);
- }
- if (len != stuff->privsize)
- return BadLength;
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
- && MODEMATCH(mode, stuff))
- return (client->noClientException);
-
- if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- do {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
- }
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff)) {
-
- if (!VidModeSwitchMode(stuff->screen, mode))
- return BadValue;
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("SwitchToMode - Succeeded\n");
- return(client->noClientException);
- }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
-
- return BadValue;
-}
-
-static int
-ProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
- REQUEST(xXF86VidModeLockModeSwitchReq);
-
- REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
-
- DEBUG_P("XF86VidModeLockModeSwitch");
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
- return VidModeErrorBase + XF86VidModeZoomLocked;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetMonitor(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetMonitorReq);
- xXF86VidModeGetMonitorReply rep;
- register int n;
- CARD32 *hsyncdata, *vsyncdata;
- int i, nHsync, nVrefresh;
- pointer monitor;
-
- DEBUG_P("XF86VidModeGetMonitor");
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeGetMonitor(stuff->screen, &monitor))
- return BadValue;
-
- nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
- nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
-
- rep.type = X_Reply;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
- rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VENDOR, 0)).ptr);
- else
- rep.vendorLength = 0;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
- rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_MODEL, 0)).ptr);
- else
- rep.modelLength = 0;
- rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
- (nHsync + nVrefresh) * sizeof(CARD32) +
- ((rep.vendorLength + 3) & ~3) +
- ((rep.modelLength + 3) & ~3)) >> 2;
- rep.sequenceNumber = client->sequence;
- rep.nhsync = nHsync;
- rep.nvsync = nVrefresh;
- hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32));
- if (!hsyncdata) {
- return BadAlloc;
- }
-
- vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32));
- if (!vsyncdata) {
- DEALLOCATE_LOCAL(hsyncdata);
- return BadAlloc;
- }
-
- for (i = 0; i < nHsync; i++) {
- hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_HI, i)).f << 16;
- }
- for (i = 0; i < nVrefresh; i++) {
- vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_HI, i)).f << 16;
- }
-
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
- hsyncdata);
- WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
- vsyncdata);
- if (rep.vendorLength)
- WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
- if (rep.modelLength)
- WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
-
- DEALLOCATE_LOCAL(hsyncdata);
- DEALLOCATE_LOCAL(vsyncdata);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetViewPort(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetViewPortReq);
- xXF86VidModeGetViewPortReply rep;
- int x, y, n;
-
- DEBUG_P("XF86VidModeGetViewPort");
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- VidModeGetViewPort(stuff->screen, &x, &y);
- rep.x = x;
- rep.y = y;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.x, n);
- swapl(&rep.y, n);
- }
- WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeSetViewPort(ClientPtr client)
-{
- REQUEST(xXF86VidModeSetViewPortReq);
-
- DEBUG_P("XF86VidModeSetViewPort");
-
- REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
- return BadValue;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetDotClocks(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetDotClocksReq);
- xXF86VidModeGetDotClocksReply rep;
- register int n;
- int numClocks;
- CARD32 dotclock;
- int *Clocks = NULL;
- Bool ClockProg;
-
- DEBUG_P("XF86VidModeGetDotClocks");
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
-
- rep.type = X_Reply;
- rep.length = (SIZEOF(xXF86VidModeGetDotClocksReply)
- - SIZEOF(xGenericReply) + numClocks) >> 2;
- rep.sequenceNumber = client->sequence;
- rep.clocks = numClocks;
- rep.maxclocks = MAXCLOCKS;
- rep.flags = 0;
-
- if (!ClockProg) {
- Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int));
- if (!Clocks)
- return BadValue;
- if (!VidModeGetClocks(stuff->screen, Clocks)) {
- DEALLOCATE_LOCAL(Clocks);
- return BadValue;
- }
- }
-
- if (ClockProg) {
- rep.flags |= CLKFLAG_PROGRAMABLE;
- }
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.clocks, n);
- swapl(&rep.maxclocks, n);
- swapl(&rep.flags, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
- if (!ClockProg) {
- for (n = 0; n < numClocks; n++) {
- dotclock = *Clocks++;
- if (client->swapped) {
- WriteSwappedDataToClient(client, 4, (char *)&dotclock);
- } else {
- WriteToClient(client, 4, (char *)&dotclock);
- }
- }
- }
-
- DEALLOCATE_LOCAL(Clocks);
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeSetGamma(ClientPtr client)
-{
- REQUEST(xXF86VidModeSetGammaReq);
-
- DEBUG_P("XF86VidModeSetGamma");
-
- REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
- ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
- return BadValue;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetGamma(ClientPtr client)
-{
- REQUEST(xXF86VidModeGetGammaReq);
- xXF86VidModeGetGammaReply rep;
- register int n;
- float red, green, blue;
-
- DEBUG_P("XF86VidModeGetGamma");
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
- return BadValue;
- rep.red = (CARD32)(red * 10000.);
- rep.green = (CARD32)(green * 10000.);
- rep.blue = (CARD32)(blue * 10000.);
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.red, n);
- swapl(&rep.green, n);
- swapl(&rep.blue, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
- CARD16 *r, *g, *b;
- int length;
- REQUEST(xXF86VidModeSetGammaRampReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
-
- length = (stuff->size + 1) & ~1;
-
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
-
- r = (CARD16*)&stuff[1];
- g = r + length;
- b = g + length;
-
- if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
- return BadValue;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
- CARD16 *ramp = NULL;
- int n, length, i;
- xXF86VidModeGetGammaRampReply rep;
- REQUEST(xXF86VidModeGetGammaRampReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
-
- length = (stuff->size + 1) & ~1;
-
- if(stuff->size) {
- if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
- return BadAlloc;
-
- if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
- ramp, ramp + length, ramp + (length * 2)))
- return BadValue;
- }
-
- rep.type = X_Reply;
- rep.length = (length >> 1) * 3;
- rep.sequenceNumber = client->sequence;
- rep.size = stuff->size;
- if(client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.size, n);
- for(i = 0; i < length * 3; i++)
- swaps(&ramp[i],n);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
-
- if(stuff->size) {
- WriteToClient(client, rep.length << 2, (char*)ramp);
- xfree(ramp);
- }
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
- xXF86VidModeGetGammaRampSizeReply rep;
- int n;
- REQUEST(xXF86VidModeGetGammaRampSizeReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.size = VidModeGetGammaRampSize(stuff->screen);
- if(client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.size, n);
- }
- WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeGetPermissions(ClientPtr client)
-{
- xXF86VidModeGetPermissionsReply rep;
- int n;
- REQUEST(xXF86VidModeGetPermissionsReq);
-
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.permissions = XF86VM_READ_PERMISSION;
- if (xf86GetVidModeEnabled() &&
- (xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
- rep.permissions |= XF86VM_WRITE_PERMISSION;
- }
- if(client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.permissions, n);
- }
- WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
-
- return (client->noClientException);
-}
-
-
-static int
-ProcXF86VidModeSetClientVersion(ClientPtr client)
-{
- REQUEST(xXF86VidModeSetClientVersionReq);
-
- VidModePrivPtr pPriv;
-
- DEBUG_P("XF86VidModeSetClientVersion");
-
- REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
-
- if ((pPriv = VMPRIV(client)) == NULL) {
- pPriv = xalloc(sizeof(VidModePrivRec));
- if (!pPriv)
- return BadAlloc;
- VMPRIV(client) = pPriv;
- }
- pPriv->major = stuff->major;
- pPriv->minor = stuff->minor;
-
- return (client->noClientException);
-}
-
-static int
-ProcXF86VidModeDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XF86VidModeQueryVersion:
- return ProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return ProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return ProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return ProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeValidateModeLine:
- return ProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetViewPort:
- return ProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeGetDotClocks:
- return ProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return ProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return ProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return ProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return ProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return ProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
- switch (stuff->data) {
- case X_XF86VidModeAddModeLine:
- return ProcXF86VidModeAddModeLine(client);
- case X_XF86VidModeDeleteModeLine:
- return ProcXF86VidModeDeleteModeLine(client);
- case X_XF86VidModeModModeLine:
- return ProcXF86VidModeModModeLine(client);
- case X_XF86VidModeSwitchMode:
- return ProcXF86VidModeSwitchMode(client);
- case X_XF86VidModeSwitchToMode:
- return ProcXF86VidModeSwitchToMode(client);
- case X_XF86VidModeLockModeSwitch:
- return ProcXF86VidModeLockModeSwitch(client);
- case X_XF86VidModeSetViewPort:
- return ProcXF86VidModeSetViewPort(client);
- case X_XF86VidModeSetGamma:
- return ProcXF86VidModeSetGamma(client);
- case X_XF86VidModeSetGammaRamp:
- return ProcXF86VidModeSetGammaRamp(client);
- default:
- return BadRequest;
- }
- } else
- return VidModeErrorBase + XF86VidModeClientNotLocal;
- }
-}
-
-static int
-SProcXF86VidModeQueryVersion(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcXF86VidModeQueryVersion(client);
-}
-
-static int
-SProcXF86VidModeGetModeLine(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetModeLineReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetModeLine(client);
-}
-
-static int
-SProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetAllModeLinesReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetAllModeLines(client);
-}
-
-static int
-SProcXF86VidModeAddModeLine(ClientPtr client)
-{
- xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
- int ver;
- register int n;
-
- REQUEST(xXF86VidModeAddModeLineReq);
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- swaps(&oldstuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
- swapl(&oldstuff->screen, n);
- swaps(&oldstuff->hdisplay, n);
- swaps(&oldstuff->hsyncstart, n);
- swaps(&oldstuff->hsyncend, n);
- swaps(&oldstuff->htotal, n);
- swaps(&oldstuff->vdisplay, n);
- swaps(&oldstuff->vsyncstart, n);
- swaps(&oldstuff->vsyncend, n);
- swaps(&oldstuff->vtotal, n);
- swapl(&oldstuff->flags, n);
- swapl(&oldstuff->privsize, n);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->hskew, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
- }
- return ProcXF86VidModeAddModeLine(client);
-}
-
-static int
-SProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
- xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
- int ver;
- register int n;
-
- REQUEST(xXF86VidModeDeleteModeLineReq);
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- swaps(&oldstuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
- swapl(&oldstuff->screen, n);
- swaps(&oldstuff->hdisplay, n);
- swaps(&oldstuff->hsyncstart, n);
- swaps(&oldstuff->hsyncend, n);
- swaps(&oldstuff->htotal, n);
- swaps(&oldstuff->vdisplay, n);
- swaps(&oldstuff->vsyncstart, n);
- swaps(&oldstuff->vsyncend, n);
- swaps(&oldstuff->vtotal, n);
- swapl(&oldstuff->flags, n);
- swapl(&oldstuff->privsize, n);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->hskew, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
- }
- return ProcXF86VidModeDeleteModeLine(client);
-}
-
-static int
-SProcXF86VidModeModModeLine(ClientPtr client)
-{
- xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
- int ver;
- register int n;
-
- REQUEST(xXF86VidModeModModeLineReq);
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- swaps(&oldstuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
- swapl(&oldstuff->screen, n);
- swaps(&oldstuff->hdisplay, n);
- swaps(&oldstuff->hsyncstart, n);
- swaps(&oldstuff->hsyncend, n);
- swaps(&oldstuff->htotal, n);
- swaps(&oldstuff->vdisplay, n);
- swaps(&oldstuff->vsyncstart, n);
- swaps(&oldstuff->vsyncend, n);
- swaps(&oldstuff->vtotal, n);
- swapl(&oldstuff->flags, n);
- swapl(&oldstuff->privsize, n);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->hskew, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
- }
- return ProcXF86VidModeModModeLine(client);
-}
-
-static int
-SProcXF86VidModeValidateModeLine(ClientPtr client)
-{
- xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
- int ver;
- register int n;
-
- REQUEST(xXF86VidModeValidateModeLineReq);
- ver = ClientMajorVersion(client);
- if (ver < 2) {
- swaps(&oldstuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
- swapl(&oldstuff->screen, n);
- swaps(&oldstuff->hdisplay, n);
- swaps(&oldstuff->hsyncstart, n);
- swaps(&oldstuff->hsyncend, n);
- swaps(&oldstuff->htotal, n);
- swaps(&oldstuff->vdisplay, n);
- swaps(&oldstuff->vsyncstart, n);
- swaps(&oldstuff->vsyncend, n);
- swaps(&oldstuff->vtotal, n);
- swapl(&oldstuff->flags, n);
- swapl(&oldstuff->privsize, n);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->hskew, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
- }
- return ProcXF86VidModeValidateModeLine(client);
-}
-
-static int
-SProcXF86VidModeSwitchMode(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeSwitchModeReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
- swaps(&stuff->screen, n);
- swaps(&stuff->zoom, n);
- return ProcXF86VidModeSwitchMode(client);
-}
-
-static int
-SProcXF86VidModeSwitchToMode(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeSwitchToModeReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeSwitchToMode(client);
-}
-
-static int
-SProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeLockModeSwitchReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
- swaps(&stuff->screen, n);
- swaps(&stuff->lock, n);
- return ProcXF86VidModeLockModeSwitch(client);
-}
-
-static int
-SProcXF86VidModeGetMonitor(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetMonitorReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetMonitor(client);
-}
-
-static int
-SProcXF86VidModeGetViewPort(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetViewPortReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetViewPort(client);
-}
-
-static int
-SProcXF86VidModeSetViewPort(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeSetViewPortReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
- swaps(&stuff->screen, n);
- swapl(&stuff->x, n);
- swapl(&stuff->y, n);
- return ProcXF86VidModeSetViewPort(client);
-}
-
-static int
-SProcXF86VidModeGetDotClocks(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetDotClocksReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetDotClocks(client);
-}
-
-static int
-SProcXF86VidModeSetClientVersion(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeSetClientVersionReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
- swaps(&stuff->major, n);
- swaps(&stuff->minor, n);
- return ProcXF86VidModeSetClientVersion(client);
-}
-
-static int
-SProcXF86VidModeSetGamma(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeSetGammaReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
- swaps(&stuff->screen, n);
- swapl(&stuff->red, n);
- swapl(&stuff->green, n);
- swapl(&stuff->blue, n);
- return ProcXF86VidModeSetGamma(client);
-}
-
-static int
-SProcXF86VidModeGetGamma(ClientPtr client)
-{
- register int n;
- REQUEST(xXF86VidModeGetGammaReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetGamma(client);
-}
-
-static int
-SProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
- CARD16 *ramp;
- int length, n;
- REQUEST(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->size, n);
- swaps(&stuff->screen, n);
- length = ((stuff->size + 1) & ~1) * 6;
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
- ramp = (CARD16*)&stuff[1];
- while(length--) {
- swaps(ramp, n);
- ramp++;
- }
- return ProcXF86VidModeSetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
- int n;
- REQUEST(xXF86VidModeGetGammaRampReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
- swaps(&stuff->size, n);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
- int n;
- REQUEST(xXF86VidModeGetGammaRampSizeReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetGammaRampSize(client);
-}
-
-static int
-SProcXF86VidModeGetPermissions(ClientPtr client)
-{
- int n;
- REQUEST(xXF86VidModeGetPermissionsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
- swaps(&stuff->screen, n);
- return ProcXF86VidModeGetPermissions(client);
-}
-
-
-static int
-SProcXF86VidModeDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XF86VidModeQueryVersion:
- return SProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return SProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return SProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return SProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeGetViewPort:
- return SProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeValidateModeLine:
- return SProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetDotClocks:
- return SProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return SProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return SProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return SProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return SProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return SProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
- switch (stuff->data) {
- case X_XF86VidModeAddModeLine:
- return SProcXF86VidModeAddModeLine(client);
- case X_XF86VidModeDeleteModeLine:
- return SProcXF86VidModeDeleteModeLine(client);
- case X_XF86VidModeModModeLine:
- return SProcXF86VidModeModModeLine(client);
- case X_XF86VidModeSwitchMode:
- return SProcXF86VidModeSwitchMode(client);
- case X_XF86VidModeSwitchToMode:
- return SProcXF86VidModeSwitchToMode(client);
- case X_XF86VidModeLockModeSwitch:
- return SProcXF86VidModeLockModeSwitch(client);
- case X_XF86VidModeSetViewPort:
- return SProcXF86VidModeSetViewPort(client);
- case X_XF86VidModeSetGamma:
- return SProcXF86VidModeSetGamma(client);
- case X_XF86VidModeSetGammaRamp:
- return SProcXF86VidModeSetGammaRamp(client);
- default:
- return BadRequest;
- }
- } else
- return VidModeErrorBase + XF86VidModeClientNotLocal;
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/xprint.c b/nx-X11/programs/Xserver/Xext/xprint.c
deleted file mode 100644
index 60512d372..000000000
--- a/nx-X11/programs/Xserver/Xext/xprint.c
+++ /dev/null
@@ -1,2760 +0,0 @@
-/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:26 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.
-*/
-/*******************************************************************
-**
-** *********************************************************
-** *
-** * File: xprint.c
-** *
-** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company
-** *
-** * Copyright 1989 by The Massachusetts Institute of Technology
-** *
-** * Permission to use, copy, modify, and distribute this
-** * software and its documentation for any purpose and without
-** * fee is hereby granted, provided that the above copyright
-** * notice appear in all copies and that both that copyright
-** * notice and this permission notice appear in supporting
-** * documentation, and that the name of MIT not be used in
-** * advertising or publicity pertaining to distribution of the
-** * software without specific prior written permission.
-** * M.I.T. makes no representation about the suitability of
-** * this software for any purpose. It is provided "as is"
-** * without any express or implied warranty.
-** *
-** * MIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-** * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-** * NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MIT BE LI-
-** * ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-** * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-** * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-** * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-** * THE USE OR PERFORMANCE OF THIS SOFTWARE.
-** *
-** *********************************************************
-**
-********************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/xprint.c,v 1.14tsi Exp $ */
-
-#define _XP_PRINT_SERVER_
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xos.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#undef NEED_EVENTS
-#include "misc.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include <X11/Xatom.h>
-#include <X11/extensions/Print.h>
-#include <X11/extensions/Printstr.h>
-#include "../Xprint/DiPrint.h"
-#include "../Xprint/attributes.h"
-#include "modinit.h"
-
-static void XpResetProc(ExtensionEntry *);
-
-static int ProcXpDispatch(ClientPtr);
-static int ProcXpSwappedDispatch(ClientPtr);
-
-static int ProcXpQueryVersion(ClientPtr);
-static int ProcXpGetPrinterList(ClientPtr);
-static int ProcXpCreateContext(ClientPtr);
-static int ProcXpSetContext(ClientPtr);
-static int ProcXpGetContext(ClientPtr);
-static int ProcXpDestroyContext(ClientPtr);
-static int ProcXpGetContextScreen(ClientPtr);
-static int ProcXpStartJob(ClientPtr);
-static int ProcXpEndJob(ClientPtr);
-static int ProcXpStartDoc(ClientPtr);
-static int ProcXpEndDoc(ClientPtr);
-static int ProcXpStartPage(ClientPtr);
-static int ProcXpEndPage(ClientPtr);
-static int ProcXpSelectInput(ClientPtr);
-static int ProcXpInputSelected(ClientPtr);
-static int ProcXpPutDocumentData(ClientPtr);
-static int ProcXpGetDocumentData(ClientPtr);
-static int ProcXpGetAttributes(ClientPtr);
-static int ProcXpGetOneAttribute(ClientPtr);
-static int ProcXpSetAttributes(ClientPtr);
-static int ProcXpRehashPrinterList(ClientPtr);
-static int ProcXpQueryScreens(ClientPtr);
-static int ProcXpGetPageDimensions(ClientPtr);
-static int ProcXpSetImageResolution(ClientPtr);
-static int ProcXpGetImageResolution(ClientPtr);
-
-static void SwapXpNotifyEvent(xPrintPrintEvent *, xPrintPrintEvent *);
-static void SwapXpAttributeEvent(xPrintAttributeEvent *, xPrintAttributeEvent *);
-
-static int SProcXpGetPrinterList(ClientPtr);
-static int SProcXpCreateContext(ClientPtr);
-static int SProcXpSetContext(ClientPtr);
-static int SProcXpGetContext(ClientPtr);
-static int SProcXpDestroyContext(ClientPtr);
-static int SProcXpGetContextScreen(ClientPtr);
-static int SProcXpStartJob(ClientPtr);
-static int SProcXpEndJob(ClientPtr);
-static int SProcXpStartDoc(ClientPtr);
-static int SProcXpEndDoc(ClientPtr);
-static int SProcXpStartPage(ClientPtr);
-static int SProcXpEndPage(ClientPtr);
-static int SProcXpSelectInput(ClientPtr);
-static int SProcXpInputSelected(ClientPtr);
-static int SProcXpPutDocumentData(ClientPtr);
-static int SProcXpGetDocumentData(ClientPtr);
-static int SProcXpGetAttributes(ClientPtr);
-static int SProcXpGetOneAttribute(ClientPtr);
-static int SProcXpSetAttributes(ClientPtr);
-static int SProcXpRehashPrinterList(ClientPtr);
-static int SProcXpGetPageDimensions(ClientPtr);
-static int SProcXpSetImageResolution(ClientPtr);
-static int SProcXpGetImageResolution(ClientPtr);
-
-static void SendXpNotify(XpContextPtr, int, int);
-static void SendAttributeNotify(XpContextPtr, int);
-static int XpFreeClient(pointer, XID);
-static int XpFreeContext(pointer, XID);
-static int XpFreePage(pointer, XID);
-static Bool XpCloseScreen(int, ScreenPtr);
-static CARD32 GetAllEventMasks(XpContextPtr);
-static struct _XpClient *CreateXpClient(ClientPtr);
-static void InitContextPrivates(XpContextPtr);
-static void ResetContextPrivates(void);
-static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
-static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
-
-typedef struct _driver {
- struct _driver *next;
- char *name;
- int (* CreateContext)(XpContextPtr);
-} XpDriverRec, *XpDriverPtr;
-
-typedef struct _xpScreen {
- Bool (* CloseScreen)(int, ScreenPtr);
- struct _driver *drivers;
-} XpScreenRec, *XpScreenPtr;
-
-/*
- * Each context has a list of XpClients indicating which clients have
- * associated this context with their connection.
- * Each such client has a RTclient resource allocated for it,
- * and this per-client
- * resource is used to delete the XpClientRec if/when the client closes
- * its connection.
- * The list of XpClients is also walked if/when the context is destroyed
- * so that the ContextPtr can be removed from the client's devPrivates.
- */
-typedef struct _XpClient {
- struct _XpClient *pNext;
- ClientPtr client;
- XpContextPtr context;
- CARD32 eventMask;
- XID contextClientID; /* unneeded sanity check? */
-} XpClientRec, *XpClientPtr;
-
-static void FreeXpClient(XpClientPtr, Bool);
-
-/*
- * Each StartPage request specifies a window which forms the top level
- * window of the page. One of the following structs is created as a
- * RTpage resource with the same ID as the window itself. This enables
- * us to clean up when/if the window is destroyed, and to prevent the
- * same window from being simultaneously referenced in multiple contexts.
- * The page resource is created at the first StartPage on a given window,
- * and is only destroyed when/if the window is destroyed. When the
- * EndPage is recieved (or an EndDoc or EndJob) the context field is
- * set to NULL, but the resource remains alive.
- */
-typedef struct _XpPage {
- XpContextPtr context;
-} XpPageRec, *XpPagePtr;
-
-typedef struct _XpStPageRec {
- XpContextPtr pContext;
- Bool slept;
- XpPagePtr pPage;
- WindowPtr pWin;
-} XpStPageRec, *XpStPagePtr;
-
-typedef struct _XpStDocRec {
- XpContextPtr pContext;
- Bool slept;
- CARD8 type;
-} XpStDocRec, *XpStDocPtr;
-
-#define QUADPAD(x) ((((x)+3)>>2)<<2)
-
-/*
- * Possible bit-mask values in the "state" field of a XpContextRec.
- */
-#define JOB_STARTED (1 << 0)
-#define DOC_RAW_STARTED (1 << 1)
-#define DOC_COOKED_STARTED (1 << 2)
-#define PAGE_STARTED (1 << 3)
-#define GET_DOC_DATA_STARTED (1 << 4)
-#define JOB_GET_DATA (1 << 5)
-
-static XpScreenPtr XpScreens[MAXSCREENS];
-static unsigned char XpReqCode;
-static int XpEventBase;
-static int XpErrorBase;
-static unsigned long XpGeneration = 0;
-static int XpClientPrivateIndex;
-
-/* Variables for the context private machinery.
- * These must be initialized at compile time because
- * main() calls InitOutput before InitExtensions, and the
- * output drivers are likely to call AllocateContextPrivate.
- * These variables are reset at CloseScreen time. CloseScreen
- * is used because it occurs after FreeAllResources, and before
- * the next InitOutput cycle.
- */
-static int contextPrivateCount = 0;
-static int contextPrivateLen = 0;
-static unsigned *contextPrivateSizes = (unsigned *)NULL;
-static unsigned totalContextSize = sizeof(XpContextRec);
-
-/*
- * There are three types of resources involved. One is the resource associated
- * with the context itself, with an ID specified by a printing client. The
- * next is a resource created by us on the client's behalf (and unknown to
- * the client) when a client inits or sets a context which allows us to
- * track each client's interest in events
- * on a particular context, and also allows us to clean up this interest
- * record when/if the client's connection is closed. Finally, there is
- * a resource created for each window that's specified in a StartPage. This
- * resource carries the same ID as the window itself, and enables us to
- * easily prevent the same window being referenced in multiple contexts
- * simultaneously, and enables us to clean up if the window is destroyed
- * before the EndPage.
- */
-static RESTYPE RTclient, RTcontext, RTpage;
-
-/*
- * allEvents is the OR of all the legal event mask bits.
- */
-static CARD32 allEvents = XPPrintMask | XPAttributeMask;
-
-
-/*******************************************************************************
- *
- * ExtensionInit, Driver Init functions, QueryVersion, and Dispatch procs
- *
- ******************************************************************************/
-
-/*
- * XpExtensionInit
- *
- * Called from InitExtensions in main() usually through miinitextension
- *
- */
-
-void
-XpExtensionInit(INITARGS)
-{
- ExtensionEntry *extEntry;
- int i;
-
- RTclient = CreateNewResourceType(XpFreeClient);
- RTcontext = CreateNewResourceType(XpFreeContext);
- RTpage = CreateNewResourceType(XpFreePage);
- if (RTclient && RTcontext && RTpage &&
- (extEntry = AddExtension(XP_PRINTNAME, XP_EVENTS, XP_ERRORS,
- ProcXpDispatch, ProcXpSwappedDispatch,
- XpResetProc, StandardMinorOpcode)))
- {
- XpReqCode = (unsigned char)extEntry->base;
- XpEventBase = extEntry->eventBase;
- XpErrorBase = extEntry->errorBase;
- EventSwapVector[XpEventBase] = (EventSwapPtr) SwapXpNotifyEvent;
- EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
- }
-
- if(XpGeneration != serverGeneration)
- {
- XpClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * We allocate 0 length & simply stuff a pointer to the
- * ContextRec in the DevUnion.
- */
- if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE)
- {
- /* we can't alloc a client private, should we bail??? XXX */
- }
- XpGeneration = serverGeneration;
- }
-
- for(i = 0; i < MAXSCREENS; i++)
- {
- /*
- * If a screen has registered with our extension, then we
- * wrap the screen's CloseScreen function to allow us to
- * reset our ContextPrivate stuff. Note that this
- * requires a printing DDX to call XpRegisterInitFunc
- * _before_ this extension is initialized - i.e. at screen init
- * time, _not_ at root window creation time.
- */
- if(XpScreens[i] != (XpScreenPtr)NULL)
- {
- XpScreens[i]->CloseScreen = screenInfo.screens[i]->CloseScreen;
- screenInfo.screens[i]->CloseScreen = XpCloseScreen;
- }
- }
- DeclareExtensionSecurity(XP_PRINTNAME, TRUE);
-}
-
-static void
-XpResetProc(ExtensionEntry *extEntry)
-{
- /*
- * We can't free up the XpScreens recs here, because extensions are
- * closed before screens, and our CloseScreen function uses the XpScreens
- * recs.
-
- int i;
-
- for(i = 0; i < MAXSCREENS; i++)
- {
- if(XpScreens[i] != (XpScreenPtr)NULL)
- Xfree(XpScreens[i]);
- XpScreens[i] = (XpScreenPtr)NULL;
- }
- */
-}
-
-static Bool
-XpCloseScreen(int index, ScreenPtr pScreen)
-{
- Bool (* CloseScreen)(int, ScreenPtr);
-
- CloseScreen = XpScreens[index]->CloseScreen;
- if(XpScreens[index] != (XpScreenPtr)NULL)
- {
- XpDriverPtr pDriv, nextDriv;
-
- pDriv = XpScreens[index]->drivers;
- while(pDriv != (XpDriverPtr)NULL)
- {
- nextDriv = pDriv->next;
- Xfree(pDriv);
- pDriv = nextDriv;
- }
- Xfree(XpScreens[index]);
- }
- XpScreens[index] = (XpScreenPtr)NULL;
-
- /*
- * It's wasteful to call ResetContextPrivates() at every CloseScreen,
- * but it's the best we know how to do for now. We do this because we
- * have to wait until after all resources have been freed (so we know
- * how to free the ContextRecs), and before the next InitOutput cycle.
- * See dix/main.c for the order of initialization and reset.
- */
- ResetContextPrivates();
- return (*CloseScreen)(index, pScreen);
-}
-
-#if 0 /* NOT USED */
-static void
-FreeScreenEntry(XpScreenPtr pScreenEntry)
-{
- XpDriverPtr pDriver;
-
- pDriver = pScreenEntry->drivers;
- while(pDriver != (XpDriverPtr)NULL)
- {
- XpDriverPtr tmp;
-
- tmp = pDriver->next;
- xfree(pDriver);
- pDriver = tmp;
- }
- xfree(pScreenEntry);
-}
-#endif
-
-/*
- * XpRegisterInitFunc tells the print extension which screens
- * are printers as opposed to displays, and what drivers are
- * supported on each screen. This eliminates the need of
- * allocating print-related private structures on windows on _all_ screens.
- * It also hands the extension a pointer to the routine to be called
- * whenever a context gets created for a particular driver on this screen.
- */
-void
-XpRegisterInitFunc(ScreenPtr pScreen, char *driverName, int (*initContext)(struct _XpContext *))
-{
- XpDriverPtr pDriver;
-
- if(XpScreens[pScreen->myNum] == 0)
- {
- if((XpScreens[pScreen->myNum] =
- (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == 0)
- return;
- XpScreens[pScreen->myNum]->CloseScreen = 0;
- XpScreens[pScreen->myNum]->drivers = 0;
- }
-
- if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == 0)
- return;
- pDriver->next = XpScreens[pScreen->myNum]->drivers;
- pDriver->name = driverName;
- pDriver->CreateContext = initContext;
- XpScreens[pScreen->myNum]->drivers = pDriver;
-}
-
-static int
-ProcXpDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch(stuff->data)
- {
- case X_PrintQueryVersion:
- return ProcXpQueryVersion(client);
- case X_PrintGetPrinterList:
- return ProcXpGetPrinterList(client);
- case X_PrintCreateContext:
- return ProcXpCreateContext(client);
- case X_PrintSetContext:
- return ProcXpSetContext(client);
- case X_PrintGetContext:
- return ProcXpGetContext(client);
- case X_PrintDestroyContext:
- return ProcXpDestroyContext(client);
- case X_PrintGetContextScreen:
- return ProcXpGetContextScreen(client);
- case X_PrintStartJob:
- return ProcXpStartJob(client);
- case X_PrintEndJob:
- return ProcXpEndJob(client);
- case X_PrintStartDoc:
- return ProcXpStartDoc(client);
- case X_PrintEndDoc:
- return ProcXpEndDoc(client);
- case X_PrintStartPage:
- return ProcXpStartPage(client);
- case X_PrintEndPage:
- return ProcXpEndPage(client);
- case X_PrintSelectInput:
- return ProcXpSelectInput(client);
- case X_PrintInputSelected:
- return ProcXpInputSelected(client);
- case X_PrintPutDocumentData:
- return ProcXpPutDocumentData(client);
- case X_PrintGetDocumentData:
- return ProcXpGetDocumentData(client);
- case X_PrintSetAttributes:
- return ProcXpSetAttributes(client);
- case X_PrintGetAttributes:
- return ProcXpGetAttributes(client);
- case X_PrintGetOneAttribute:
- return ProcXpGetOneAttribute(client);
- case X_PrintRehashPrinterList:
- return ProcXpRehashPrinterList(client);
- case X_PrintQueryScreens:
- return ProcXpQueryScreens(client);
- case X_PrintGetPageDimensions:
- return ProcXpGetPageDimensions(client);
- case X_PrintSetImageResolution:
- return ProcXpSetImageResolution(client);
- case X_PrintGetImageResolution:
- return ProcXpGetImageResolution(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-ProcXpSwappedDispatch(ClientPtr client)
-{
- int temp;
- REQUEST(xReq);
-
- switch(stuff->data)
- {
- case X_PrintQueryVersion:
- swaps(&stuff->length, temp);
- return ProcXpQueryVersion(client);
- case X_PrintGetPrinterList:
- return SProcXpGetPrinterList(client);
- case X_PrintCreateContext:
- return SProcXpCreateContext(client);
- case X_PrintSetContext:
- return SProcXpSetContext(client);
- case X_PrintGetContext:
- return SProcXpGetContext(client);
- case X_PrintDestroyContext:
- return SProcXpDestroyContext(client);
- case X_PrintGetContextScreen:
- return SProcXpGetContextScreen(client);
- case X_PrintStartJob:
- return SProcXpStartJob(client);
- case X_PrintEndJob:
- return SProcXpEndJob(client);
- case X_PrintStartDoc:
- return SProcXpStartDoc(client);
- case X_PrintEndDoc:
- return SProcXpEndDoc(client);
- case X_PrintStartPage:
- return SProcXpStartPage(client);
- case X_PrintEndPage:
- return SProcXpEndPage(client);
- case X_PrintSelectInput:
- return SProcXpSelectInput(client);
- case X_PrintInputSelected:
- return SProcXpInputSelected(client);
- case X_PrintPutDocumentData:
- return SProcXpPutDocumentData(client);
- case X_PrintGetDocumentData:
- return SProcXpGetDocumentData(client);
- case X_PrintSetAttributes:
- return SProcXpSetAttributes(client);
- case X_PrintGetAttributes:
- return SProcXpGetAttributes(client);
- case X_PrintGetOneAttribute:
- return SProcXpGetOneAttribute(client);
- case X_PrintRehashPrinterList:
- return SProcXpRehashPrinterList(client);
- case X_PrintQueryScreens:
- swaps(&stuff->length, temp);
- return ProcXpQueryScreens(client);
- case X_PrintGetPageDimensions:
- return SProcXpGetPageDimensions(client);
- case X_PrintSetImageResolution:
- return SProcXpSetImageResolution(client);
- case X_PrintGetImageResolution:
- return SProcXpGetImageResolution(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-ProcXpQueryVersion(ClientPtr client)
-{
- /* REQUEST(xPrintQueryVersionReq); */
- xPrintQueryVersionReply rep;
- register int n;
- long l;
-
- REQUEST_SIZE_MATCH(xPrintQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XP_MAJOR_VERSION;
- rep.minorVersion = XP_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sz_xPrintQueryVersionReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * GetPrinterList : Return a list of all printers associated with this
- * server. Calls XpDiGetPrinterList, which is defined in
- * the device-independent code in Xserver/Xprint.
- *
- ******************************************************************************/
-
-static int
-ProcXpGetPrinterList(ClientPtr client)
-{
- REQUEST(xPrintGetPrinterListReq);
- int totalSize;
- int numEntries;
- XpDiListEntry **pList;
- xPrintGetPrinterListReply *rep;
- int n, i, totalBytes;
- long l;
- char *curByte;
-
- REQUEST_AT_LEAST_SIZE(xPrintGetPrinterListReq);
-
- totalSize = ((sz_xPrintGetPrinterListReq) >> 2) +
- ((stuff->printerNameLen + 3) >> 2) +
- ((stuff->localeLen + 3) >> 2);
- if(totalSize != client->req_len)
- return BadLength;
-
- pList = XpDiGetPrinterList(stuff->printerNameLen, (char *)(stuff + 1),
- stuff->localeLen, (char *)((stuff + 1) +
- QUADPAD(stuff->printerNameLen)));
-
- for(numEntries = 0, totalBytes = sz_xPrintGetPrinterListReply;
- pList[numEntries] != (XpDiListEntry *)NULL;
- numEntries++)
- {
- totalBytes += 2 * sizeof(CARD32);
- totalBytes += QUADPAD(strlen(pList[numEntries]->name));
- totalBytes += QUADPAD(strlen(pList[numEntries]->description));
- }
-
- if((rep = (xPrintGetPrinterListReply *)xalloc(totalBytes)) ==
- (xPrintGetPrinterListReply *)NULL)
- return BadAlloc;
-
- rep->type = X_Reply;
- rep->length = (totalBytes - sz_xPrintGetPrinterListReply) >> 2;
- rep->sequenceNumber = client->sequence;
- rep->listCount = numEntries;
- if (client->swapped) {
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, l);
- swapl(&rep->listCount, l);
- }
-
- for(i = 0, curByte = (char *)(rep + 1); i < numEntries; i++)
- {
- CARD32 *pCrd;
- int len;
-
- pCrd = (CARD32 *)curByte;
- len = strlen(pList[i]->name);
- *pCrd = len;
- if (client->swapped)
- swapl((long *)curByte, l);
- curByte += sizeof(CARD32);
- strncpy(curByte, pList[i]->name, len);
- curByte += QUADPAD(len);
-
- pCrd = (CARD32 *)curByte;
- len = strlen(pList[i]->description);
- *pCrd = len;
- if (client->swapped)
- swapl((long *)curByte, l);
- curByte += sizeof(CARD32);
- strncpy(curByte, pList[i]->description, len);
- curByte += QUADPAD(len);
- }
-
- XpDiFreePrinterList(pList);
-
- WriteToClient(client, totalBytes, (char *)rep);
- xfree(rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * QueryScreens: Returns the list of screens which are associated with
- * print drivers.
- *
- ******************************************************************************/
-
-static int
-ProcXpQueryScreens(ClientPtr client)
-{
- /* REQUEST(xPrintQueryScreensReq); */
- int i, numPrintScreens, totalSize;
- WINDOW *pWinId;
- xPrintQueryScreensReply *rep;
- long l;
-
- REQUEST_SIZE_MATCH(xPrintQueryScreensReq);
-
- rep = (xPrintQueryScreensReply *)xalloc(sz_xPrintQueryScreensReply);
- pWinId = (WINDOW *)(rep + 1);
-
- for(i = 0, numPrintScreens = 0, totalSize = sz_xPrintQueryScreensReply;
- i < MAXSCREENS; i++)
- {
- /*
- * If a screen has registered with our extension, then it's
- * a printer screen.
- */
- if(XpScreens[i] != (XpScreenPtr)NULL)
- {
- numPrintScreens++;
- totalSize += sizeof(WINDOW);
- rep = (xPrintQueryScreensReply *)xrealloc(rep, totalSize);
- /* fix of bug: pWinId should be set again after reallocate rep */
- pWinId = (WINDOW *)(rep + 1);
- *pWinId = WindowTable[i]->drawable.id;
- if (client->swapped)
- swapl((long *)pWinId, l);
- }
- }
-
- rep->type = X_Reply;
- rep->sequenceNumber = client->sequence;
- rep->length = (totalSize - sz_xPrintQueryScreensReply) >> 2;
- rep->listCount = numPrintScreens;
- if (client->swapped)
- {
- int n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, l);
- swapl(&rep->listCount, l);
- }
-
- WriteToClient(client, totalSize, (char *)rep);
- xfree(rep);
- return client->noClientException;
-}
-
-static int
-ProcXpGetPageDimensions(ClientPtr client)
-{
- REQUEST(xPrintGetPageDimensionsReq);
- CARD16 width, height;
- xRectangle rect;
- xPrintGetPageDimensionsReply rep;
- XpContextPtr pContext;
- int result;
-
- REQUEST_SIZE_MATCH(xPrintGetPageDimensionsReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if((pContext->funcs.GetMediumDimensions == 0) ||
- (pContext->funcs.GetReproducibleArea == 0))
- return BadImplementation;
-
- result = pContext->funcs.GetMediumDimensions(pContext, &width, &height);
- if(result != Success)
- return result;
-
- result = pContext->funcs.GetReproducibleArea(pContext, &rect);
- if(result != Success)
- return result;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.width = width;
- rep.height = height;
- rep.rx = rect.x;
- rep.ry = rect.y;
- rep.rwidth = rect.width;
- rep.rheight = rect.height;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.width, n);
- swaps(&rep.height, n);
- swaps(&rep.rx, n);
- swaps(&rep.ry, n);
- swaps(&rep.rwidth, n);
- swaps(&rep.rheight, n);
- }
-
- WriteToClient(client, sz_xPrintGetPageDimensionsReply, (char *)&rep);
- return client->noClientException;
-}
-
-static int
-ProcXpSetImageResolution(ClientPtr client)
-{
- REQUEST(xPrintSetImageResolutionReq);
- xPrintSetImageResolutionReply rep;
- XpContextPtr pContext;
- Bool status;
- int result;
-
- REQUEST_SIZE_MATCH(xPrintSetImageResolutionReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- rep.prevRes = pContext->imageRes;
- if(pContext->funcs.SetImageResolution != 0) {
- result = pContext->funcs.SetImageResolution(pContext,
- (int)stuff->imageRes,
- &status);
- if(result != Success)
- status = FALSE;
- } else
- status = FALSE;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.prevRes, n);
- }
-
- WriteToClient(client, sz_xPrintSetImageResolutionReply, (char *)&rep);
- return client->noClientException;
-}
-
-static int
-ProcXpGetImageResolution(ClientPtr client)
-{
- REQUEST(xPrintGetImageResolutionReq);
- xPrintGetImageResolutionReply rep;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.imageRes = pContext->imageRes;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.imageRes, n);
- }
-
- WriteToClient(client, sz_xPrintGetImageResolutionReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * RehashPrinterList : Cause the server's list of printers to be rebuilt.
- * This allows new printers to be added, or old ones
- * deleted without needing to restart the server.
- *
- ******************************************************************************/
-
-static int
-ProcXpRehashPrinterList(ClientPtr client)
-{
- /* REQUEST(xPrintRehashPrinterListReq); */
-
- REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq);
-
- return XpRehashPrinterList();
-}
-
-/******************************************************************************
- *
- * Context functions: Init, Set, Destroy, FreeContext
- * AllocateContextPrivateIndex, AllocateContextPrivate
- * and supporting functions.
- *
- * Init creates a context, creates a XpClientRec for the calling
- * client, and stores the contextPtr in the client's devPrivates.
- *
- * Set creates a XpClientRec for the calling client, and stores the
- * contextPtr in the client's devPrivates unless the context is None.
- * If the context is None, then the client's connection association
- * with any context is removed.
- *
- * Destroy frees any and all XpClientRecs associated with the context,
- * frees the context itself, and removes the contextPtr from any
- * relevant client devPrivates.
- *
- * FreeContext is called by FreeResource to free up a context.
- *
- ******************************************************************************/
-
-/*
- * CreateContext creates and initializes the memory for the context itself.
- * The driver's CreateContext function
- * is then called.
- */
-static int
-ProcXpCreateContext(ClientPtr client)
-{
- REQUEST(xPrintCreateContextReq);
- XpScreenPtr pPrintScreen;
- WindowPtr pRoot;
- char *driverName;
- XpContextPtr pContext;
- int result = Success;
- XpDriverPtr pDriver;
-
- REQUEST_AT_LEAST_SIZE(xPrintCreateContextReq);
-
- LEGAL_NEW_RESOURCE(stuff->contextID, client);
-
- /*
- * Check to see if the printer name is valid.
- */
- if((pRoot = XpDiValidatePrinter((char *)(stuff + 1), stuff->printerNameLen)) ==
- (WindowPtr)NULL)
- return BadMatch;
-
- pPrintScreen = XpScreens[pRoot->drawable.pScreen->myNum];
-
- /*
- * Allocate and add the context resource.
- */
- if((pContext = (XpContextPtr) xalloc(totalContextSize)) ==
- (XpContextPtr) NULL)
- return BadAlloc;
-
- InitContextPrivates(pContext);
-
- if(AddResource(stuff->contextID, RTcontext, (pointer) pContext)
- != TRUE)
- {
- xfree(pContext);
- return BadAlloc;
- }
-
- pContext->contextID = stuff->contextID;
- pContext->clientHead = (XpClientPtr)NULL;
- pContext->screenNum = pRoot->drawable.pScreen->myNum;
- pContext->state = 0;
- pContext->clientSlept = (ClientPtr)NULL;
- pContext->imageRes = 0;
-
- pContext->funcs.DestroyContext = 0;
- pContext->funcs.StartJob = 0;
- pContext->funcs.EndJob = 0;
- pContext->funcs.StartDoc = 0;
- pContext->funcs.EndDoc = 0;
- pContext->funcs.StartPage = 0;
- pContext->funcs.EndPage = 0;
- pContext->funcs.PutDocumentData = 0;
- pContext->funcs.GetDocumentData = 0;
- pContext->funcs.GetAttributes = 0;
- pContext->funcs.GetOneAttribute = 0;
- pContext->funcs.SetAttributes = 0;
- pContext->funcs.AugmentAttributes = 0;
- pContext->funcs.GetMediumDimensions = 0;
- pContext->funcs.GetReproducibleArea = 0;
- pContext->funcs.SetImageResolution = 0;
-
- if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) ==
- (char *)NULL)
- {
- /* Freeing the context also causes the XpClients to be freed. */
- FreeResource(stuff->contextID, RT_NONE);
- return BadAlloc;
- }
- strncpy(pContext->printerName, (char *)(stuff + 1), stuff->printerNameLen);
- pContext->printerName[stuff->printerNameLen] = (char)'\0';
-
- driverName = XpDiGetDriverName(pRoot->drawable.pScreen->myNum,
- pContext->printerName);
-
- for(pDriver = pPrintScreen->drivers;
- pDriver != (XpDriverPtr)NULL;
- pDriver = pDriver->next)
- {
- if(!strcmp(driverName, pDriver->name))
- {
- if(pDriver->CreateContext != 0)
- pDriver->CreateContext(pContext);
- else
- return BadImplementation;
- break;
- }
- }
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-/*
- * SetContext creates the calling client's contextClient resource,
- * and stashes the contextID in the client's devPrivate.
- */
-static int
-ProcXpSetContext(ClientPtr client)
-{
- REQUEST(xPrintSetContextReq);
-
- XpContextPtr pContext;
- XpClientPtr pPrintClient;
- int result = Success;
-
- REQUEST_AT_LEAST_SIZE(xPrintSetContextReq);
-
- if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) !=
- (pointer)NULL)
- {
- /*
- * Erase this client's knowledge of its old context, if any.
- */
- if((pPrintClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
- {
- XpUnsetFontResFunc(client);
-
- if(pPrintClient->eventMask == 0)
- FreeXpClient(pPrintClient, TRUE);
- }
-
- client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL;
- }
- if(stuff->printContext == None)
- return Success;
-
- /*
- * Check to see that the supplied XID is really a valid print context
- * in this server.
- */
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
- return BadAlloc;
-
- client->devPrivates[XpClientPrivateIndex].ptr = pContext;
-
- XpSetFontResFunc(client);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-XpContextPtr
-XpGetPrintContext(ClientPtr client)
-{
- return (client->devPrivates[XpClientPrivateIndex].ptr);
-}
-
-static int
-ProcXpGetContext(ClientPtr client)
-{
- /* REQUEST(xPrintGetContextReq); */
- xPrintGetContextReply rep;
-
- XpContextPtr pContext;
- register int n;
- register long l;
-
- REQUEST_SIZE_MATCH(xPrintGetContextReq);
-
- if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) ==
- (pointer)NULL)
- rep.printContext = None;
- else
- rep.printContext = pContext->contextID;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.printContext, l);
- }
- WriteToClient(client, sz_xPrintGetContextReply, (char *)&rep);
- return client->noClientException;
-}
-
-
-/*
- * DestroyContext frees the context associated with the calling client.
- * It operates by freeing the context resource ID, thus causing XpFreeContext
- * to be called.
- */
-static int
-ProcXpDestroyContext(ClientPtr client)
-{
- REQUEST(xPrintDestroyContextReq);
-
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintDestroyContextReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityDestroyAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- XpUnsetFontResFunc(client);
-
- FreeResource(pContext->contextID, RT_NONE);
-
- return Success;
-}
-
-static int
-ProcXpGetContextScreen(ClientPtr client)
-{
- REQUEST(xPrintGetContextScreenReq);
- xPrintGetContextScreenReply rep;
- XpContextPtr pContext;
- int n;
- long l;
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadContext;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.rootWindow = WindowTable[pContext->screenNum]->drawable.id;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.rootWindow, l);
- }
-
- WriteToClient(client, sz_xPrintGetContextScreenReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*
- * XpFreeContext is the routine called by dix:FreeResource when a context
- * resource ID is freed.
- * It checks to see if there's a partial job pending on the context, and
- * if so it calls the appropriate End procs with the cancel flag set.
- * It calls the driver's DestroyContext routine to allow the driver to clean
- * up any context-related memory or state.
- * It calls FreeXpClient to free all the
- * associated XpClientRecs and to set all the client->devPrivates to NULL.
- * It frees the printer name string, and frees the context
- * itself.
- */
-static int
-XpFreeContext(pointer data, XID id)
-{
- XpContextPtr pContext = (XpContextPtr)data;
-
- /* Clean up any pending job on this context */
- if(pContext->state != 0)
- {
- if(pContext->state & PAGE_STARTED)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- pContext->funcs.EndPage(pContext, pWin);
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
- pContext->state &= ~PAGE_STARTED;
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
- }
- if((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED))
- {
- pContext->funcs.EndDoc(pContext, TRUE);
- SendXpNotify(pContext, XPEndDocNotify, TRUE);
- pContext->state &= ~DOC_RAW_STARTED;
- pContext->state &= ~DOC_COOKED_STARTED;
- }
- if(pContext->funcs.EndJob != 0)
- {
- pContext->funcs.EndJob(pContext, TRUE);
- SendXpNotify(pContext, XPEndJobNotify, TRUE);
- pContext->state &= ~JOB_STARTED;
- pContext->state &= ~GET_DOC_DATA_STARTED;
- }
- }
-
- /*
- * Tell the driver we're destroying the context
- * This allows the driver to free and ContextPrivate data
- */
- if(pContext->funcs.DestroyContext != 0)
- pContext->funcs.DestroyContext(pContext);
-
- /* Free up all the XpClientRecs */
- while(pContext->clientHead != (XpClientPtr)NULL)
- {
- FreeXpClient(pContext->clientHead, TRUE);
- }
-
- xfree(pContext->printerName);
- xfree(pContext);
- return Success; /* ??? */
-}
-
-/*
- * XpFreeClient is the routine called by dix:FreeResource when a RTclient
- * is freed. It simply calls the FreeXpClient routine to do the work.
- */
-static int
-XpFreeClient(pointer data, XID id)
-{
- FreeXpClient((XpClientPtr)data, TRUE);
- return Success;
-}
-
-/*
- * FreeXpClient
- * frees the ClientRec passed in, and sets the client->devPrivates to NULL
- * if the client->devPrivates points to the same context as the XpClient.
- * Called from XpFreeContext(from FreeResource), and
- * XpFreeClient. The boolean freeResource specifies whether or not to call
- * FreeResource for the XpClientRec's XID. We should free it except if we're
- * called from XpFreeClient (which is itself called from FreeResource for the
- * XpClientRec's XID).
- */
-static void
-FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
-{
- XpClientPtr pCurrent, pPrev;
- XpContextPtr pContext = pXpClient->context;
-
- /*
- * If we're freeing the clientRec associated with the context tied
- * to the client's devPrivates, then we need to clear the devPrivates.
- */
- if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr ==
- pXpClient->context)
- {
- pXpClient->client->devPrivates[XpClientPrivateIndex].ptr =
- (pointer)NULL;
- }
-
- for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead;
- pCurrent != (XpClientPtr)NULL;
- pCurrent = pCurrent->pNext)
- {
- if(pCurrent == pXpClient)
- {
- if(freeResource == TRUE)
- FreeResource (pCurrent->contextClientID, RTclient);
-
- if (pPrev != (XpClientPtr)NULL)
- pPrev->pNext = pCurrent->pNext;
- else
- pContext->clientHead = pCurrent->pNext;
-
- xfree (pCurrent);
- break;
- }
- pPrev = pCurrent;
- }
-}
-
-/*
- * CreateXpClient takes a ClientPtr and returns a pointer to a
- * XpClientRec which it allocates. It also initializes the Rec,
- * including adding a resource on behalf of the client to enable the
- * freeing of the Rec when the client's connection is closed.
- */
-static XpClientPtr
-CreateXpClient(ClientPtr client)
-{
- XpClientPtr pNewPrintClient;
- XID clientResource;
-
- if((pNewPrintClient = (XpClientPtr)xalloc(sizeof(XpClientRec))) ==
- (XpClientPtr)NULL)
- return (XpClientPtr)NULL;
-
- clientResource = FakeClientID(client->index);
- if(!AddResource(clientResource, RTclient, (pointer)pNewPrintClient))
- {
- xfree (pNewPrintClient);
- return (XpClientPtr)NULL;
- }
-
- pNewPrintClient->pNext = (XpClientPtr)NULL;
- pNewPrintClient->client = client;
- pNewPrintClient->context = (XpContextPtr)NULL;
- pNewPrintClient->eventMask = 0;
- pNewPrintClient->contextClientID = clientResource;
-
- return pNewPrintClient;
-}
-
-/*
- * XpFreePage is the routine called by dix:FreeResource to free the page
- * resource built with the same ID as a page window. It checks to see
- * if we're in the middle of a page, and if so calls the driver's EndPage
- * function with 'cancel' set TRUE. It frees the memory associated with
- * the page resource.
- */
-static int
-XpFreePage(pointer data, XID id)
-{
- XpPagePtr page = (XpPagePtr)data;
- int result = Success;
- WindowPtr pWin = (WindowPtr )LookupIDByType(id, RT_WINDOW);
-
- /* Check to see if the window's being deleted in the middle of a page */
- if(page->context != (XpContextPtr)NULL &&
- page->context->state & PAGE_STARTED)
- {
- if(page->context->funcs.EndPage != 0)
- result = page->context->funcs.EndPage(page->context, pWin);
- SendXpNotify(page->context, XPEndPageNotify, (int)TRUE);
- page->context->pageWin = 0; /* None, NULL??? XXX */
- }
-
- xfree(page);
- return result;
-}
-
-/*
- * ContextPrivate machinery.
- * Context privates are intended for use by the drivers, allowing the
- * drivers to maintain context-specific data. The driver should free
- * the associated data at DestroyContext time.
- */
-
-static void
-InitContextPrivates(XpContextPtr context)
-{
- register char *ptr;
- DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
-
- if (totalContextSize == sizeof(XpContextRec))
- ppriv = (DevUnion *)NULL;
- else
- ppriv = (DevUnion *)(context + 1);
-
- context->devPrivates = ppriv;
- sizes = contextPrivateSizes;
- ptr = (char *)(ppriv + contextPrivateLen);
- for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++)
- {
- if ( (size = *sizes) )
- {
- ppriv->ptr = (pointer)ptr;
- ptr += size;
- }
- else
- ppriv->ptr = (pointer)NULL;
- }
-}
-
-static void
-ResetContextPrivates(void)
-{
- contextPrivateCount = 0;
- contextPrivateLen = 0;
- xfree(contextPrivateSizes);
- contextPrivateSizes = (unsigned *)NULL;
- totalContextSize = sizeof(XpContextRec);
-
-}
-
-int
-XpAllocateContextPrivateIndex(void)
-{
- return contextPrivateCount++;
-}
-
-Bool
-XpAllocateContextPrivate(int index, unsigned amount)
-{
- unsigned oldamount;
-
- if (index >= contextPrivateLen)
- {
- unsigned *nsizes;
- nsizes = (unsigned *)xrealloc(contextPrivateSizes,
- (index + 1) * sizeof(unsigned));
- if (!nsizes)
- return FALSE;
- while (contextPrivateLen <= index)
- {
- nsizes[contextPrivateLen++] = 0;
- totalContextSize += sizeof(DevUnion);
- }
- contextPrivateSizes = nsizes;
- }
- oldamount = contextPrivateSizes[index];
- if (amount > oldamount)
- {
- contextPrivateSizes[index] = amount;
- totalContextSize += (amount - oldamount);
- }
- return TRUE;
-}
-
-static XpClientPtr
-AcquireClient(XpContextPtr pContext, ClientPtr client)
-{
- XpClientPtr pXpClient;
-
- if((pXpClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
- return pXpClient;
-
- if((pXpClient = CreateXpClient(client)) == (XpClientPtr)NULL)
- return (XpClientPtr)NULL;
-
- pXpClient->context = pContext;
- pXpClient->pNext = pContext->clientHead;
- pContext->clientHead = pXpClient;
-
- return pXpClient;
-}
-
-static XpClientPtr
-FindClient(XpContextPtr pContext, ClientPtr client)
-{
- XpClientPtr pXpClient;
-
- for(pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- if(pXpClient->client == client) return pXpClient;
- }
- return (XpClientPtr)NULL;
-}
-
-
-/******************************************************************************
- *
- * Start/End Functions: StartJob, EndJob, StartDoc, EndDoc, StartPage, EndPage
- *
- ******************************************************************************/
-
-static int
-ProcXpStartJob(ClientPtr client)
-{
- REQUEST(xPrintStartJobReq);
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintStartJobReq);
-
- /* Check to see that a context has been established by this client. */
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadContext;
-
- if(pContext->state != 0)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->saveData != XPSpool && stuff->saveData != XPGetData)
- {
- client->errorValue = stuff->saveData;
- return BadValue;
- }
-
- if(pContext->funcs.StartJob != 0)
- result = pContext->funcs.StartJob(pContext,
- (stuff->saveData == XPGetData)? TRUE:FALSE,
- client);
- else
- return BadImplementation;
-
- pContext->state = JOB_STARTED;
- if(stuff->saveData == XPGetData)
- pContext->state |= JOB_GET_DATA;
-
- SendXpNotify(pContext, XPStartJobNotify, FALSE);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndJob(ClientPtr client)
-{
- REQUEST(xPrintEndJobReq);
- int result = Success;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintEndJobReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED))
- return XpErrorBase+XPBadSequence;
-
- /* Check for missing EndDoc */
- if((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED))
- {
- if(pContext->state & PAGE_STARTED)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- if(stuff->cancel != TRUE)
- return XpErrorBase+XPBadSequence;
-
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
-
- pContext->state &= ~PAGE_STARTED;
-
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
-
- if(result != Success) return result;
- }
-
- if(pContext->funcs.EndDoc != 0)
- result = pContext->funcs.EndDoc(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
- }
-
- if(pContext->funcs.EndJob != 0)
- result = pContext->funcs.EndJob(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- pContext->state = 0;
-
- SendXpNotify(pContext, XPEndJobNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static Bool
-DoStartDoc(ClientPtr client, XpStDocPtr c)
-{
- XpContextPtr pContext = c->pContext;
-
- if(c->pContext->state & JOB_GET_DATA &&
- !(c->pContext->state & GET_DOC_DATA_STARTED))
- {
- if(!c->slept)
- {
- c->slept = TRUE;
- ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c);
- c->pContext->clientSlept = client;
- }
- return TRUE;
- }
-
- if(pContext->funcs.StartDoc != 0)
- (void) pContext->funcs.StartDoc(pContext, c->type);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- if(c->type == XPDocNormal)
- pContext->state |= DOC_COOKED_STARTED;
- else
- pContext->state |= DOC_RAW_STARTED;
-
- SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
-
- xfree(c);
- return TRUE;
-}
-
-static int
-ProcXpStartDoc(ClientPtr client)
-{
- REQUEST(xPrintStartDocReq);
- int result = Success;
- XpContextPtr pContext;
- XpStDocPtr c;
-
- REQUEST_SIZE_MATCH(xPrintStartDocReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED) ||
- pContext->state & DOC_RAW_STARTED ||
- pContext->state & DOC_COOKED_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->type != XPDocNormal && stuff->type != XPDocRaw)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- c = (XpStDocPtr)xalloc(sizeof(XpStDocRec));
- c->pContext = pContext;
- c->type = stuff->type;
- c->slept = FALSE;
- (void)DoStartDoc(client, c);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndDoc(ClientPtr client)
-{
- REQUEST(xPrintEndDocReq);
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintEndDocReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & DOC_RAW_STARTED) &&
- !(pContext->state & DOC_COOKED_STARTED))
- return XpErrorBase+XPBadSequence;
-
- if(pContext->state & PAGE_STARTED)
- {
- if(stuff->cancel == TRUE)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
-
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
- }
- else
- return XpErrorBase+XPBadSequence;
- if(result != Success)
- return result;
- }
-
- if(pContext->funcs.EndDoc != 0)
- result = pContext->funcs.EndDoc(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- pContext->state &= ~DOC_RAW_STARTED;
- pContext->state &= ~DOC_COOKED_STARTED;
-
- SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static Bool
-DoStartPage(
- ClientPtr client,
- XpStPagePtr c)
-{
- WindowPtr pWin = c->pWin;
- int result = Success;
- XpContextPtr pContext = c->pContext;
- XpPagePtr pPage;
-
- if(c->pContext->state & JOB_GET_DATA &&
- !(c->pContext->state & GET_DOC_DATA_STARTED))
- {
- if(!c->slept)
- {
- c->slept = TRUE;
- ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c);
- c->pContext->clientSlept = client;
- }
- return TRUE;
- }
-
- if(!(pContext->state & DOC_COOKED_STARTED))
- {
- /* Implied StartDoc if it was omitted */
- if(pContext->funcs.StartDoc != 0)
- result = pContext->funcs.StartDoc(pContext, XPDocNormal);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- if(result != Success)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, result);
- return TRUE;
- }
-
- pContext->state |= DOC_COOKED_STARTED;
- SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
- }
-
- /* ensure the window's not already being used as a page */
- if((pPage = (XpPagePtr)LookupIDByType(c->pWin->drawable.id, RTpage)) !=
- (XpPagePtr)NULL)
- {
- if(pPage->context != (XpContextPtr)NULL)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadWindow);
- return TRUE;
- }
- }
- else
- {
- if((pPage = (XpPagePtr)xalloc(sizeof(XpPageRec))) == (XpPagePtr)NULL)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadAlloc);
- return TRUE;
- }
- if(AddResource(c->pWin->drawable.id, RTpage, pPage) == FALSE)
- {
- xfree(pPage);
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadAlloc);
- return TRUE;
- }
- }
-
- pPage->context = pContext;
- pContext->pageWin = c->pWin->drawable.id;
-
- if(pContext->funcs.StartPage != 0)
- result = pContext->funcs.StartPage(pContext, pWin);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- pContext->state |= PAGE_STARTED;
-
- (void)MapWindow(pWin, client);
-
- SendXpNotify(pContext, XPStartPageNotify, (int)FALSE);
-
- return TRUE;
-}
-
-static int
-ProcXpStartPage(ClientPtr client)
-{
- REQUEST(xPrintStartPageReq);
- WindowPtr pWin;
- int result = Success;
- XpContextPtr pContext;
- XpStPagePtr c;
-
- REQUEST_SIZE_MATCH(xPrintStartPageReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED))
- return XpErrorBase+XPBadSequence;
-
- /* can't have pages in a raw documented */
- if(pContext->state & DOC_RAW_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(pContext->state & PAGE_STARTED)
- return XpErrorBase+XPBadSequence;
-
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- SecurityWriteAccess);
- if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum)
- return BadWindow;
-
- if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL)
- return BadAlloc;
- c->pContext = pContext;
- c->slept = FALSE;
- c->pWin = pWin;
-
- (void)DoStartPage(client, c);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndPage(ClientPtr client)
-{
- REQUEST(xPrintEndPageReq);
- int result = Success;
- XpContextPtr pContext;
- XpPagePtr page;
- WindowPtr pWin;
-
- REQUEST_SIZE_MATCH(xPrintEndPageReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & PAGE_STARTED))
- return XpErrorBase+XPBadSequence;
-
- pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW);
-
- /* Call the ddx's EndPage proc. */
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- if((page = (XpPagePtr)LookupIDByType(pContext->pageWin, RTpage)) !=
- (XpPagePtr)NULL)
- page->context = (XpContextPtr)NULL;
-
- pContext->state &= ~PAGE_STARTED;
- pContext->pageWin = 0; /* None, NULL??? XXX */
-
- (void)UnmapWindow(pWin, FALSE);
-
- SendXpNotify(pContext, XPEndPageNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-/*******************************************************************************
- *
- * Document Data Functions: PutDocumentData, GetDocumentData
- *
- ******************************************************************************/
-
-static int
-ProcXpPutDocumentData(ClientPtr client)
-{
- REQUEST(xPrintPutDocumentDataReq);
- XpContextPtr pContext;
- DrawablePtr pDraw;
- int result = Success;
- unsigned totalSize;
- char *pData, *pDoc_fmt, *pOptions;
-
- REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & DOC_RAW_STARTED) &&
- !(pContext->state & DOC_COOKED_STARTED))
- return XpErrorBase+XPBadSequence;
-
- if (stuff->drawable) {
- if (pContext->state & DOC_RAW_STARTED)
- return BadDrawable;
- pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client);
- if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum)
- return BadDrawable;
- } else {
- if (pContext->state & DOC_COOKED_STARTED)
- return BadDrawable;
- pDraw = NULL;
- }
-
- pData = (char *)(&stuff[1]);
-
- totalSize = (stuff->len_data + 3) >> 2;
- pDoc_fmt = pData + (totalSize << 2);
-
- totalSize += (stuff->len_fmt + 3) >> 2;
- pOptions = pData + (totalSize << 2);
-
- totalSize += (stuff->len_options + 3) >> 2;
- if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len)
- return BadLength;
-
- if(pContext->funcs.PutDocumentData != 0)
- {
- result = (*pContext->funcs.PutDocumentData)(pContext, pDraw,
- pData, stuff->len_data,
- pDoc_fmt, stuff->len_fmt,
- pOptions, stuff->len_options,
- client);
- }
- else
- return BadImplementation;
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpGetDocumentData(ClientPtr client)
-{
- REQUEST(xPrintGetDocumentDataReq);
- xPrintGetDocumentDataReply rep;
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintGetDocumentDataReq);
-
- if((pContext = (XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetDocumentData == 0)
- return BadImplementation;
-
- if(!(pContext->state & JOB_GET_DATA) ||
- pContext->state & GET_DOC_DATA_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->maxBufferSize <= 0)
- {
- client->errorValue = stuff->maxBufferSize;
- return BadValue; /* gotta have a positive buffer size */
- }
-
- result = (*pContext->funcs.GetDocumentData)(pContext, client,
- stuff->maxBufferSize);
- if(result != Success)
- {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.dataLen = 0;
- rep.statusCode = 1;
- rep.finishedFlag = TRUE;
- if (client->swapped) {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.statusCode, l); /* XXX Why are these longs??? */
- swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */
- }
- (void)WriteToClient(client,sz_xPrintGetDocumentDataReply,(char *)&rep);
- }
- else
- pContext->state |= GET_DOC_DATA_STARTED;
-
- if(pContext->clientSlept != (ClientPtr)NULL)
- {
- ClientSignal(pContext->clientSlept);
- ClientWakeup(pContext->clientSlept);
- pContext->clientSlept = (ClientPtr)NULL;
- }
-
- return result;
-}
-
-/*******************************************************************************
- *
- * Attribute requests: GetAttributes, SetAttributes, GetOneAttribute
- *
- ******************************************************************************/
-
-static int
-ProcXpGetAttributes(ClientPtr client)
-{
- REQUEST(xPrintGetAttributesReq);
- XpContextPtr pContext;
- char *attrs;
- xPrintGetAttributesReply *pRep;
- int totalSize, n;
- unsigned long l;
-
- REQUEST_SIZE_MATCH(xPrintGetAttributesReq);
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- if(stuff->type != XPServerAttr)
- {
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetAttributes == 0)
- return BadImplementation;
- if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) ==
- (char *)NULL)
- return BadAlloc;
- }
- else
- {
- if((attrs = XpGetAttributes((XpContextPtr)NULL, XPServerAttr)) ==
- (char *)NULL)
- return BadAlloc;
- }
-
- totalSize = sz_xPrintGetAttributesReply + QUADPAD(strlen(attrs));
- if((pRep = (xPrintGetAttributesReply *)malloc(totalSize)) ==
- (xPrintGetAttributesReply *)NULL)
- return BadAlloc;
-
- pRep->type = X_Reply;
- pRep->length = (totalSize - sz_xPrintGetAttributesReply) >> 2;
- pRep->sequenceNumber = client->sequence;
- pRep->stringLen = strlen(attrs);
-
- if (client->swapped) {
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, l);
- swapl(&pRep->stringLen, l);
- }
-
- strncpy((char*)(pRep + 1), attrs, strlen(attrs));
- xfree(attrs);
-
- WriteToClient(client, totalSize, (char *)pRep);
-
- xfree(pRep);
-
- return client->noClientException;
-}
-
-static int
-ProcXpSetAttributes(ClientPtr client)
-{
- REQUEST(xPrintSetAttributesReq);
- int result = Success;
- XpContextPtr pContext;
- char *attr;
-
- REQUEST_AT_LEAST_SIZE(xPrintSetAttributesReq);
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- /*
- * Disallow changing of read-only attribute pools
- */
- if(stuff->type == XPPrinterAttr || stuff->type == XPServerAttr)
- return BadMatch;
-
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.SetAttributes == 0)
- return BadImplementation;
-
- /*
- * Check for attributes being set after their relevant phase
- * has already begun (e.g. Job attributes set after StartJob).
- */
- if((pContext->state & JOB_STARTED) && stuff->type == XPJobAttr)
- return XpErrorBase+XPBadSequence;
- if(((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED)) && stuff->type == XPDocAttr)
- return XpErrorBase+XPBadSequence;
- if((pContext->state & PAGE_STARTED) && stuff->type == XPPageAttr)
- return XpErrorBase+XPBadSequence;
-
- if((attr = (char *)malloc(stuff->stringLen + 1)) == (char *)NULL)
- return BadAlloc;
-
- strncpy(attr, (char *)(stuff + 1), stuff->stringLen);
- attr[stuff->stringLen] = (char)'\0';
-
- if(stuff->rule == XPAttrReplace)
- (*pContext->funcs.SetAttributes)(pContext, stuff->type, attr);
- else if(stuff->rule == XPAttrMerge)
- (*pContext->funcs.AugmentAttributes)(pContext, stuff->type, attr);
- else
- {
- client->errorValue = stuff->rule;
- result = BadValue;
- }
-
- xfree(attr);
-
- SendAttributeNotify(pContext, stuff->type);
-
- return result;
-}
-
-static int
-ProcXpGetOneAttribute(ClientPtr client)
-{
- REQUEST(xPrintGetOneAttributeReq);
- XpContextPtr pContext;
- char *value, *attrName;
- xPrintGetOneAttributeReply *pRep;
- int totalSize;
- int n;
- unsigned long l;
-
- REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq);
-
- totalSize = ((sz_xPrintGetOneAttributeReq) >> 2) +
- ((stuff->nameLen + 3) >> 2);
- if(totalSize != client->req_len)
- return BadLength;
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- if((attrName = (char *)malloc(stuff->nameLen + 1)) == (char *)NULL)
- return BadAlloc;
- strncpy(attrName, (char *)(stuff+1), stuff->nameLen);
- attrName[stuff->nameLen] = (char)'\0';
-
- if(stuff->type != XPServerAttr)
- {
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetOneAttribute == 0)
- return BadImplementation;
- if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type,
- attrName)) == (char *)NULL)
- return BadAlloc;
- }
- else
- {
- if((value = XpGetOneAttribute((XpContextPtr)NULL, XPServerAttr,
- attrName)) == (char *)NULL)
- return BadAlloc;
- }
-
- free(attrName);
-
- totalSize = sz_xPrintGetOneAttributeReply + QUADPAD(strlen(value));
- if((pRep = (xPrintGetOneAttributeReply *)malloc(totalSize)) ==
- (xPrintGetOneAttributeReply *)NULL)
- return BadAlloc;
-
- pRep->type = X_Reply;
- pRep->length = (totalSize - sz_xPrintGetOneAttributeReply) >> 2;
- pRep->sequenceNumber = client->sequence;
- pRep->valueLen = strlen(value);
-
- if (client->swapped) {
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, l);
- swapl(&pRep->valueLen, l);
- }
-
- strncpy((char*)(pRep + 1), value, strlen(value));
-
- WriteToClient(client, totalSize, (char *)pRep);
-
- xfree(pRep);
-
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * Print Event requests: SelectInput InputSelected, SendXpNotify
- *
- ******************************************************************************/
-
-
-static int
-ProcXpSelectInput(ClientPtr client)
-{
- REQUEST(xPrintSelectInputReq);
- int result = Success;
- XpContextPtr pContext;
- XpClientPtr pPrintClient;
-
- REQUEST_SIZE_MATCH(xPrintSelectInputReq);
-
- /*
- * Check to see that the supplied XID is really a valid print context
- * in this server.
- */
- if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(stuff->eventMask & ~allEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue; /* bogus event mask bits */
- }
-
- if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
- return BadAlloc;
-
- pPrintClient->eventMask = stuff->eventMask;
-
- return result;
-}
-
-static int
-ProcXpInputSelected(ClientPtr client)
-{
- REQUEST(xPrintInputSelectedReq);
- xPrintInputSelectedReply rep;
- register int n;
- long l;
- XpClientPtr pXpClient;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintInputSelectedReq);
-
- if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- pXpClient = FindClient(pContext, client);
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.eventMask = (pXpClient != (XpClientPtr)NULL)? pXpClient->eventMask : 0;
- rep.allEventsMask = GetAllEventMasks(pContext);
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.eventMask, l);
- swapl(&rep.allEventsMask, l);
- }
-
- WriteToClient(client, sz_xPrintInputSelectedReply, (char *)&rep);
- return client->noClientException;
-}
-
-static void
-SendAttributeNotify(XpContextPtr pContext, int which)
-{
- XpClientPtr pXpClient;
- xPrintAttributeEvent ae;
- ClientPtr client;
-
- pXpClient = pContext->clientHead;
- if(pXpClient == (XpClientPtr)NULL)
- return; /* Nobody's interested in the events (or this context). */
-
- for (pXpClient = pContext->clientHead;
- pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- client = pXpClient->client;
- if (client == serverClient || client->clientGone ||
- !(pXpClient->eventMask & XPAttributeMask))
- continue;
- ae.type = XPAttributeNotify + XpEventBase;
- ae.detail = which;
- ae.printContext = pContext->contextID;
- ae.sequenceNumber = client->sequence;
- WriteEventsToClient (client, 1, (xEvent *) &ae);
- }
-}
-
-static void
-SendXpNotify(XpContextPtr pContext, int which, int val)
-{
- XpClientPtr pXpClient;
- xPrintPrintEvent pe;
- ClientPtr client;
-
- pXpClient = pContext->clientHead;
- if(pXpClient == (XpClientPtr)NULL)
- return; /* Nobody's interested in the events (or this context). */
-
- for (pXpClient = pContext->clientHead;
- pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- client = pXpClient->client;
- if (client == serverClient || client->clientGone ||
- !(pXpClient->eventMask & XPPrintMask))
- continue;
- pe.type = XPPrintNotify + XpEventBase;
- pe.detail = which;
- pe.printContext = pContext->contextID;
- pe.cancel = (Bool)val;
- pe.sequenceNumber = client->sequence;
- WriteEventsToClient (client, 1, (xEvent *) &pe);
- }
-}
-
-static CARD32
-GetAllEventMasks(XpContextPtr pContext)
-{
- XpClientPtr pPrintClient;
- CARD32 totalMask = (CARD32)0;
-
- for (pPrintClient = pContext->clientHead;
- pPrintClient != (XpClientPtr)NULL;
- pPrintClient = pPrintClient->pNext)
- {
- totalMask |= pPrintClient->eventMask;
- }
- return totalMask;
-}
-
-/*
- * XpContextOfClient - returns the XpContextPtr to the context
- * associated with the specified client, or NULL if the client
- * does not currently have a context set.
- */
-XpContextPtr
-XpContextOfClient(ClientPtr client)
-{
- return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
-}
-
-
-/*******************************************************************************
- *
- * Swap-request functions
- *
- ******************************************************************************/
-
-static int
-SProcXpCreateContext(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintCreateContextReq);
-
- swaps(&stuff->length, i);
- swapl(&stuff->contextID, n);
- swapl(&stuff->printerNameLen, n);
- swapl(&stuff->localeLen, n);
- return ProcXpCreateContext(client);
-}
-
-static int
-SProcXpGetPrinterList(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintGetPrinterListReq);
-
- swaps(&stuff->length, i);
- swapl(&stuff->printerNameLen, n);
- swapl(&stuff->localeLen, n);
- return ProcXpGetPrinterList(client);
-}
-
-static int
-SProcXpRehashPrinterList(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintRehashPrinterListReq);
- swaps(&stuff->length, i);
- return ProcXpRehashPrinterList(client);
-}
-
-static int
-SProcXpSetContext(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintSetContextReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, i);
- return ProcXpSetContext(client);
-}
-
-static int
-SProcXpGetContext(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintGetContextReq);
- swaps(&stuff->length, i);
- return ProcXpGetContext(client);
-}
-
-static int
-SProcXpDestroyContext(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintDestroyContextReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpDestroyContext(client);
-}
-
-static int
-SProcXpGetContextScreen(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintGetContextScreenReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetContextScreen(client);
-}
-
-static int
-SProcXpInputSelected(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintInputSelectedReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpInputSelected(client);
-}
-
-static int
-SProcXpStartJob(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintStartJobReq);
- swaps(&stuff->length, i);
- return ProcXpStartJob(client);
-}
-
-static int
-SProcXpEndJob(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndJobReq);
- swaps(&stuff->length, i);
- return ProcXpEndJob(client);
-}
-
-static int
-SProcXpStartDoc(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintStartDocReq);
- swaps(&stuff->length, i);
- return ProcXpStartDoc(client);
-}
-
-static int
-SProcXpEndDoc(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndDocReq);
- swaps(&stuff->length, i);
- return ProcXpEndDoc(client);
-}
-
-static int
-SProcXpStartPage(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintStartPageReq);
- swaps(&stuff->length, i);
- swapl(&stuff->window, n);
- return ProcXpStartPage(client);
-}
-
-static int
-SProcXpEndPage(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndPageReq);
- swaps(&stuff->length, i);
- return ProcXpEndPage(client);
-}
-
-static int
-SProcXpPutDocumentData(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintPutDocumentDataReq);
- swaps(&stuff->length, i);
- swapl(&stuff->drawable, n);
- swapl(&stuff->len_data, n);
- swaps(&stuff->len_fmt, i);
- swaps(&stuff->len_options, i);
- return ProcXpPutDocumentData(client);
-}
-
-static int
-SProcXpGetDocumentData(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetDocumentDataReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->maxBufferSize, n);
- return ProcXpGetDocumentData(client);
-}
-
-static int
-SProcXpGetAttributes(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetAttributesReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetAttributes(client);
-}
-
-static int
-SProcXpSetAttributes(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSetAttributesReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->stringLen, n);
- return ProcXpSetAttributes(client);
-}
-
-static int
-SProcXpGetOneAttribute(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetOneAttributeReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->nameLen, n);
- return ProcXpGetOneAttribute(client);
-}
-
-static int
-SProcXpSelectInput(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSelectInputReq);
- swaps(&stuff->length, i);
- swapl(&stuff->eventMask, n);
- swapl(&stuff->printContext, n);
- return ProcXpSelectInput(client);
-}
-
-static int
-SProcXpGetPageDimensions(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetPageDimensionsReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetPageDimensions(client);
-}
-
-static int
-SProcXpSetImageResolution(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSetImageResolutionReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swaps(&stuff->imageRes, i);
- return ProcXpSetImageResolution(client);
-}
-
-static int
-SProcXpGetImageResolution(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetImageResolutionReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetImageResolution(client);
-}
-
-static void
-SwapXpNotifyEvent(xPrintPrintEvent *src, xPrintPrintEvent *dst)
-{
- /*
- * Swap the sequence number and context fields.
- */
- cpswaps(src->sequenceNumber, dst->sequenceNumber);
- cpswapl(src->printContext, dst->printContext);
-
- /*
- * Copy the byte-long fields.
- */
- dst->type = src->type;
- dst->detail = src->detail;
- dst->cancel = src->cancel;
-}
-
-static void
-SwapXpAttributeEvent(xPrintAttributeEvent *src, xPrintAttributeEvent *dst)
-{
- /*
- * Swap the sequence number and context fields.
- */
- cpswaps(src->sequenceNumber, dst->sequenceNumber);
- cpswapl(src->printContext, dst->printContext);
-
- /*
- * Copy the byte-long fields.
- */
- dst->type = src->type;
- dst->detail = src->detail;
-}
diff --git a/nx-X11/programs/Xserver/Xext/xres.c b/nx-X11/programs/Xserver/Xext/xres.c
index d13d3368b..ceb9c65d4 100644
--- a/nx-X11/programs/Xserver/Xext/xres.c
+++ b/nx-X11/programs/Xserver/Xext/xres.c
@@ -1,53 +1,41 @@
/*
Copyright (c) 2002 XFree86 Inc
*/
-/* $XFree86: xc/programs/Xserver/Xext/xres.c,v 1.7tsi Exp $ */
-/* $XdotOrg: xc/programs/Xserver/Xext/xres.c,v 1.7 2005/07/03 08:53:36 daniels Exp $ */
-#define NEED_EVENTS
-#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
-#include <X11/extensions/XResproto.h>
+#include <nx-X11/extensions/XResproto.h>
#include "pixmapstr.h"
-#include "modinit.h"
+#include "protocol-versions.h"
static int
ProcXResQueryVersion (ClientPtr client)
{
- REQUEST(xXResQueryVersionReq);
xXResQueryVersionReply rep;
- CARD16 client_major, client_minor; /* not used */
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
- client_major = stuff->client_major;
- client_minor = stuff->client_minor;
- (void) client_major;
- (void) client_minor;
-
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.server_major = XRES_MAJOR_VERSION;
- rep.server_minor = XRES_MINOR_VERSION;
+ rep.server_major = SERVER_XRES_MAJOR_VERSION;
+ rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.server_major, n);
- swaps(&rep.server_minor, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.server_major);
+ swaps(&rep.server_minor);
}
- WriteToClient(client, sizeof (xXResQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof (xXResQueryVersionReply), &rep);
return (client->noClientException);
}
@@ -61,7 +49,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
- current_clients = ALLOCATE_LOCAL((currentMaxClients - 1) * sizeof(int));
+ current_clients = malloc((currentMaxClients - 1) * sizeof(int));
num_clients = 0;
for(i = 1; i < currentMaxClients; i++) {
@@ -76,12 +64,11 @@ ProcXResQueryClients (ClientPtr client)
rep.num_clients = num_clients;
rep.length = rep.num_clients * sz_xXResClient >> 2;
if (client->swapped) {
- int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.num_clients, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.num_clients);
}
- WriteToClient (client, sizeof (xXResQueryClientsReply), (char *) &rep);
+ WriteToClient (client, sizeof (xXResQueryClientsReply), &rep);
if(num_clients) {
xXResClient scratch;
@@ -91,22 +78,21 @@ ProcXResQueryClients (ClientPtr client)
scratch.resource_mask = RESOURCE_ID_MASK;
if(client->swapped) {
- register int n;
- swapl (&scratch.resource_base, n);
- swapl (&scratch.resource_mask, n);
+ swapl (&scratch.resource_base);
+ swapl (&scratch.resource_mask);
}
- WriteToClient (client, sz_xXResClient, (char *) &scratch);
+ WriteToClient (client, sz_xXResClient, &scratch);
}
}
- DEALLOCATE_LOCAL(current_clients);
+ free(current_clients);
return (client->noClientException);
}
static void
-ResFindAllRes (pointer value, XID id, RESTYPE type, pointer cdata)
+ResFindAllRes (void * value, XID id, RESTYPE type, void * cdata)
{
int *counts = (int *)cdata;
@@ -132,7 +118,7 @@ ProcXResQueryClientResources (ClientPtr client)
return BadValue;
}
- counts = ALLOCATE_LOCAL((lastResourceType + 1) * sizeof(int));
+ counts = malloc((lastResourceType + 1) * sizeof(int));
memset(counts, 0, (lastResourceType + 1) * sizeof(int));
@@ -149,12 +135,11 @@ ProcXResQueryClientResources (ClientPtr client)
rep.num_types = num_types;
rep.length = rep.num_types * sz_xXResType >> 2;
if (client->swapped) {
- int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.num_types, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.num_types);
}
- WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep);
+ WriteToClient (client,sizeof(xXResQueryClientResourcesReply),&rep);
if(num_types) {
xXResType scratch;
@@ -172,21 +157,20 @@ ProcXResQueryClientResources (ClientPtr client)
scratch.count = counts[i];
if(client->swapped) {
- register int n;
- swapl (&scratch.resource_type, n);
- swapl (&scratch.count, n);
+ swapl (&scratch.resource_type);
+ swapl (&scratch.count);
}
- WriteToClient (client, sz_xXResType, (char *) &scratch);
+ WriteToClient (client, sz_xXResType, &scratch);
}
}
- DEALLOCATE_LOCAL(counts);
+ free(counts);
return (client->noClientException);
}
static void
-ResFindPixmaps (pointer value, XID id, pointer cdata)
+ResFindPixmaps (void * value, XID id, void * cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
PixmapPtr pix = (PixmapPtr)value;
@@ -216,7 +200,7 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
bytes = 0;
FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
- (pointer)(&bytes));
+ (void *)(&bytes));
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -228,13 +212,12 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
rep.bytes_overflow = 0;
#endif
if (client->swapped) {
- int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- swapl (&rep.bytes, n);
- swapl (&rep.bytes_overflow, n);
+ swaps (&rep.sequenceNumber);
+ swapl (&rep.length);
+ swapl (&rep.bytes);
+ swapl (&rep.bytes_overflow);
}
- WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),(char*)&rep);
+ WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),&rep);
return (client->noClientException);
}
@@ -265,12 +248,7 @@ ProcResDispatch (ClientPtr client)
static int
SProcXResQueryVersion (ClientPtr client)
{
- REQUEST(xXResQueryVersionReq);
- int n;
-
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
- swaps(&stuff->client_major,n);
- swaps(&stuff->client_minor,n);
return ProcXResQueryVersion(client);
}
@@ -278,10 +256,9 @@ static int
SProcXResQueryClientResources (ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
- int n;
REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
- swaps(&stuff->xid,n);
+ swapl(&stuff->xid);
return ProcXResQueryClientResources(client);
}
@@ -289,10 +266,9 @@ static int
SProcXResQueryClientPixmapBytes (ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
- int n;
REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
- swaps(&stuff->xid,n);
+ swapl(&stuff->xid);
return ProcXResQueryClientPixmapBytes(client);
}
@@ -300,9 +276,8 @@ static int
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
- int n;
- swaps(&stuff->length,n);
+ swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:
@@ -320,7 +295,7 @@ SProcResDispatch (ClientPtr client)
}
void
-ResExtensionInit(INITARGS)
+ResExtensionInit(void)
{
(void) AddExtension(XRES_NAME, 0, 0,
ProcResDispatch, SProcResDispatch,
diff --git a/nx-X11/programs/Xserver/Xext/xtest.c b/nx-X11/programs/Xserver/Xext/xtest.c
index 994b0c502..d78efd39b 100644
--- a/nx-X11/programs/Xserver/Xext/xtest.c
+++ b/nx-X11/programs/Xserver/Xext/xtest.c
@@ -1,5 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/xtest.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
-/* $Xorg: xtest.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
/*
Copyright 1992, 1998 The Open Group
@@ -27,15 +25,13 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.10 2003/10/28 23:08:44 tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@@ -46,19 +42,14 @@ from The Open Group.
#include "dixevents.h"
#include "sleepuntil.h"
#define _XTEST_SERVER_
-#include <X11/extensions/XTest.h>
-#include <X11/extensions/xteststr.h>
+#include <nx-X11/extensions/xtestconst.h>
+#include <nx-X11/extensions/xteststr.h>
#ifdef XINPUT
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
+#include <nx-X11/extensions/XI.h>
+#include <nx-X11/extensions/XIproto.h>
#define EXTENSION_EVENT_BASE 64
#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
-
-#include "modinit.h"
#if 0
static unsigned char XTestReqCode;
@@ -93,7 +84,7 @@ static DISPATCH_PROC(SProcXTestGetVersion);
static DISPATCH_PROC(SProcXTestGrabControl);
void
-XTestExtensionInit(INITARGS)
+XTestExtensionInit(void)
{
#if 0
ExtensionEntry *extEntry;
@@ -121,7 +112,6 @@ ProcXTestGetVersion(client)
register ClientPtr client;
{
xXTestGetVersionReply rep;
- register int n;
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
rep.type = X_Reply;
@@ -130,10 +120,10 @@ ProcXTestGetVersion(client)
rep.majorVersion = XTestMajorVersion;
rep.minorVersion = XTestMinorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.minorVersion, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
return(client->noClientException);
}
@@ -145,7 +135,6 @@ ProcXTestCompareCursor(client)
xXTestCompareCursorReply rep;
WindowPtr pWin;
CursorPtr pCursor;
- register int n;
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
pWin = (WindowPtr)LookupWindow(stuff->window, client);
@@ -168,9 +157,9 @@ ProcXTestCompareCursor(client)
rep.sequenceNumber = client->sequence;
rep.same = (wCursor(pWin) == pCursor);
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
+ swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
return(client->noClientException);
}
@@ -180,7 +169,7 @@ ProcXTestFakeInput(client)
{
REQUEST(xXTestFakeInputReq);
int nev;
- int n;
+ int n;
xEvent *ev;
DeviceIntPtr dev = NULL;
WindowPtr root;
@@ -285,7 +274,7 @@ ProcXTestFakeInput(client)
if (client->swapped)
{
(void) XTestSwapFakeInput(client, (xReq *)stuff);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
}
ResetCurrentRequest (client);
client->sequence--;
@@ -402,14 +391,14 @@ ProcXTestFakeInput(client)
int i;
int x = ev->u.keyButtonPointer.rootX + panoramiXdataPtr[0].x;
int y = ev->u.keyButtonPointer.rootY + panoramiXdataPtr[0].y;
- if (!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ if (!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum],
x, y, &box)) {
FOR_NSCREENS(i) {
if (i == pScreen->myNum) continue;
- if (POINT_IN_REGION(pScreen,
+ if (RegionContainsPoint(
&XineramaScreenRegions[i],
x, y, &box)) {
- root = WindowTable[i];
+ root = screenInfo.screens[i]->root;
x -= panoramiXdataPtr[i].x;
y -= panoramiXdataPtr[i].y;
ev->u.keyButtonPointer.rootX = x;
@@ -512,12 +501,11 @@ static int
SProcXTestGetVersion(client)
register ClientPtr client;
{
- register int n;
REQUEST(xXTestGetVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
- swaps(&stuff->minorVersion, n);
+ swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
}
@@ -525,13 +513,12 @@ static int
SProcXTestCompareCursor(client)
register ClientPtr client;
{
- register int n;
REQUEST(xXTestCompareCursorReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
- swapl(&stuff->window, n);
- swapl(&stuff->cursor, n);
+ swapl(&stuff->window);
+ swapl(&stuff->cursor);
return ProcXTestCompareCursor(client);
}
@@ -568,7 +555,7 @@ SProcXTestFakeInput(client)
register int n;
REQUEST(xReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
@@ -579,10 +566,9 @@ static int
SProcXTestGrabControl(client)
register ClientPtr client;
{
- register int n;
REQUEST(xXTestGrabControlReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
diff --git a/nx-X11/programs/Xserver/Xext/xtest1.frags b/nx-X11/programs/Xserver/Xext/xtest1.frags
deleted file mode 100644
index bdf7943b7..000000000
--- a/nx-X11/programs/Xserver/Xext/xtest1.frags
+++ /dev/null
@@ -1,90 +0,0 @@
-There are several code fragments that need to be placed in the device
-dependent part of the server. These are described below. These code
-fragments are device and implementation dependent.
-
-This code fragment should go in your ddx InitInput() routine:
-
-#ifdef XTESTEXT1
-extern KeyCode xtest_command_key;
-#endif
-
-#ifdef XTESTEXT1
- xtest_command_key = <whatever-is-a-good-keycode-for-your-keyboard>;
-#endif
-
-This code fragment should go at the front of the file that handles
-keyboards:
-
-#ifdef XTESTEXT1
-/*
- * defined in xtestext1di.c
- */
-extern int on_steal_input;
-extern Bool XTestStealKeyData();
-#endif XTESTEXT1
-
-This code fragment should go in the function that parses input from the
-keyboard or pointer after you know what input action has occurred, but before
-you have told the server about it. If conditionalizes the actual function
-call to pass the information on:
-
-#ifdef XTESTEXT1
- if (!on_steal_input ||
- XTestStealKeyData(code, direction, dev_type, x, y))
-#endif /* XTESTEXT1 */
- handle_device_event(...);
-
-This code fragment should go in the function that handles mouse motion after
-you have figured out how much the mouse has moved:
-
-#ifdef XTESTEXT1
- if (on_steal_input)
- XTestStealMotionData(dx, dy, dev, x, y);
-#endif XTESTEXT1
-
-
-This code fragment should go at the front of the os-specific code where
-you wait (by doing a select on the socket in our implementation) for
-something to happen:
-
-#ifdef XTESTEXT1
-extern int playback_on;
-void XTestComputeWaitTime();
-#endif XTESTEXT1
-
-These code fragments should go in the os-specific code on both sides of
-where you wait (by doing a select on the socket in our implementation)
-for something to happen:
-
-#ifdef XTESTEXT1
- if (playback_on)
- XTestComputeWaitTime(wt = &waittime);
-#endif XTESTEXT1
- ... code to do select ...
- WakeupHandler(i, LastSelectMask);
-#ifdef XTESTEXT1
- if (playback_on)
- i = XTestProcessInputAction(i, &waittime);
-#endif XTESTEXT1
-
-
-You also need to implement the following routines (documentation
-is needed; for now, see server/ddx/hp/hp/x_hil.c):
-
-void
-XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
- int dev_type;
- int keycode;
- int keystate;
- int mousex;
- int mousey;
-
-void
-XTestGetPointerPos(fmousex, fmousey)
- short *fmousex, *fmousey;
-
-void
-XTestJumpPointer(jx, jy, dev_type)
- int jx;
- int jy;
- int dev_type;
diff --git a/nx-X11/programs/Xserver/Xext/xtest1dd.c b/nx-X11/programs/Xserver/Xext/xtest1dd.c
index 81d283c36..e3a7aa07e 100644
--- a/nx-X11/programs/Xserver/Xext/xtest1dd.c
+++ b/nx-X11/programs/Xserver/Xext/xtest1dd.c
@@ -1,4 +1,3 @@
-/* $Xorg: xtest1dd.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
/*
* File: xtest1dd.c
*
@@ -52,28 +51,24 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
-/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.6 2003/10/28 23:08:44 tsi Exp $ */
/***************************************************************
* include files
***************************************************************/
-#define NEED_EVENTS
-#define NEED_REPLIES
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
+#include <nx-X11/Xos.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xmd.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#define XTestSERVER_SIDE
-#include <X11/extensions/xtestext1.h>
+#include <nx-X11/extensions/xtestext1.h>
#include "xtest1dd.h"
@@ -1613,5 +1608,5 @@ ClientPtr client;
rep.size_return = ACTION_ARRAY_SIZE;
WriteReplyToClient(client,
sizeof(xTestQueryInputSizeReply),
- (pointer) &rep);
+ (void *) &rep);
}
diff --git a/nx-X11/programs/Xserver/Xext/xtest1dd.h b/nx-X11/programs/Xserver/Xext/xtest1dd.h
index 3130c7075..5a3ee1781 100644
--- a/nx-X11/programs/Xserver/Xext/xtest1dd.h
+++ b/nx-X11/programs/Xserver/Xext/xtest1dd.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.h,v 3.2 2001/08/01 00:44:44 tsi Exp $ */
/************************************************************
Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
diff --git a/nx-X11/programs/Xserver/Xext/xtest1di.c b/nx-X11/programs/Xserver/Xext/xtest1di.c
index d95b30612..b1d69ef47 100644
--- a/nx-X11/programs/Xserver/Xext/xtest1di.c
+++ b/nx-X11/programs/Xserver/Xext/xtest1di.c
@@ -1,5 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/xtest1di.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
-/* $Xorg: xtest1di.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
/*
* File: xtest1di.c
*
@@ -53,22 +51,18 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
-/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.5 2003/09/13 21:33:03 dawes Exp $ */
/*****************************************************************************
* include files
****************************************************************************/
-#define NEED_EVENTS
-#define NEED_REPLIES
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "gcstruct.h"
@@ -76,8 +70,7 @@ University of California.
#include "dixstruct.h"
#include "opaque.h"
#define XTestSERVER_SIDE
-#include <X11/extensions/xtestext1.h>
-#include "modinit.h"
+#include <nx-X11/extensions/xtestext1.h>
#include "xtest1dd.h"
@@ -152,7 +145,7 @@ static void SEventXTestDispatch(
);
static int XTestCurrentClientGone(
- pointer /* value */,
+ void * /* value */,
XID /* id */
);
@@ -167,7 +160,7 @@ static int XTestCurrentClientGone(
* (other than the core errors).
*/
void
-XTestExtension1Init(INITARGS)
+XTestExtension1Init(void)
{
/*
* holds the pointer to the extension entry structure
@@ -319,10 +312,6 @@ SProcTestFakeInput(client)
register ClientPtr client;
{
/*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
- /*
* index counter
*/
int i;
@@ -339,8 +328,8 @@ SProcTestFakeInput(client)
/*
* byte-swap the fields in the request
*/
- swaps(&stuff->length, n);
- swapl(&stuff->ack, n);
+ swaps(&stuff->length);
+ swapl(&stuff->ack);
/*
* have to parse and then byte-swap the input action list here
*/
@@ -363,7 +352,7 @@ SProcTestFakeInput(client)
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -373,7 +362,7 @@ SProcTestFakeInput(client)
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -383,15 +372,15 @@ SProcTestFakeInput(client)
/*
* byte-swap the jumpx field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx));
/*
* byte-swap the jumpy field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy));
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -409,7 +398,7 @@ SProcTestFakeInput(client)
/*
* byte-swap the delay_time field
*/
- swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
+ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -440,17 +429,12 @@ static int
SProcTestGetInput(client)
register ClientPtr client;
{
- /*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
-
REQUEST(xTestGetInputReq);
/*
* byte-swap the fields in the request
*/
- swaps(&stuff->length, n);
- swapl(&stuff->mode, n);
+ swaps(&stuff->length);
+ swapl(&stuff->mode);
return(ProcTestGetInput(client));
}
@@ -464,16 +448,11 @@ static int
SProcTestStopInput(client)
register ClientPtr client;
{
- /*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
-
REQUEST(xTestStopInputReq);
/*
* byte-swap the length field in the request
*/
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return(ProcTestStopInput(client));
}
@@ -487,16 +466,11 @@ static int
SProcTestReset(client)
register ClientPtr client;
{
- /*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
-
REQUEST(xTestResetReq);
/*
* byte-swap the length field in the request
*/
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return(ProcTestReset(client));
}
@@ -510,16 +484,11 @@ static int
SProcTestQueryInputSize(client)
register ClientPtr client;
{
- /*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
-
REQUEST(xTestQueryInputSizeReq);
/*
* byte-swap the length field in the request
*/
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return(ProcTestQueryInputSize(client));
}
@@ -752,7 +721,7 @@ XTestResetProc(unused)
/*ARGSUSED*/
static int
XTestCurrentClientGone(value, id)
- pointer value;
+ void * value;
XID id;
{
/*
@@ -781,10 +750,6 @@ SReplyXTestDispatch(client_ptr, size, reply_ptr)
char *reply_ptr;
{
/*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
- /*
* pointer to xTestQueryInputSizeReply
*/
xTestQueryInputSizeReply *rep_ptr;
@@ -793,9 +758,9 @@ SReplyXTestDispatch(client_ptr, size, reply_ptr)
* there is only one reply in this extension, so byte-swap it
*/
rep_ptr = (xTestQueryInputSizeReply *) reply_ptr;
- swaps(&(rep_ptr->sequenceNumber), n);
- swapl(&(rep_ptr->length), n);
- swapl(&(rep_ptr->size_return), n);
+ swaps(&(rep_ptr->sequenceNumber));
+ swapl(&(rep_ptr->length));
+ swapl(&(rep_ptr->size_return));
/*
* now write the swapped reply to the client
*/
@@ -814,10 +779,6 @@ SEventXTestDispatch(from, to)
xEvent *to;
{
/*
- * used in the swaps and swapl macros for temporary storage space
- */
- register char n;
- /*
* index counter
*/
int i;
@@ -845,7 +806,7 @@ SEventXTestDispatch(from, to)
/*
* byte-swap the sequence number in the "to" event
*/
- swaps(&(((xTestInputActionEvent *) to)->sequenceNumber), n);
+ swaps(&(((xTestInputActionEvent *) to)->sequenceNumber));
/*
* If the event is an xTestInputActionEvent, then it needs more
* processing. Otherwise, it is an xTestFakeAckEvent, which
@@ -886,7 +847,7 @@ SEventXTestDispatch(from, to)
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -896,7 +857,7 @@ SEventXTestDispatch(from, to)
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -906,15 +867,15 @@ SEventXTestDispatch(from, to)
/*
* byte-swap the jumpx field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx));
/*
* byte-swap the jumpy field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy));
/*
* byte-swap the delay_time field
*/
- swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
@@ -932,7 +893,7 @@ SEventXTestDispatch(from, to)
/*
* byte-swap the delay_time field
*/
- swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
+ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time));
/*
* advance to the next input action
*/
diff --git a/nx-X11/programs/Xserver/Xext/xvdisp.c b/nx-X11/programs/Xserver/Xext/xvdisp.c
index 21ab0b6a0..b33bfa493 100644
--- a/nx-X11/programs/Xserver/Xext/xvdisp.c
+++ b/nx-X11/programs/Xserver/Xext/xvdisp.c
@@ -1,4 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/xvdisp.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
@@ -22,7 +21,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.27 2003/07/16 01:38:31 dawes Exp $ */
/*
** File:
@@ -52,8 +50,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <string.h>
+
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
@@ -63,16 +63,12 @@ SOFTWARE.
#include "resource.h"
#include "opaque.h"
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
+#include <nx-X11/extensions/Xv.h>
+#include <nx-X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef MITSHM
#define _XSHM_SERVER_
-#include <X11/extensions/shmstr.h>
-#endif
-
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
+#include <X11/extensions/shmproto.h>
#endif
#include "xvdisp.h"
@@ -160,59 +156,59 @@ static int SWriteImageFormatInfo(ClientPtr, xvImageFormatInfo*);
#define _WriteQueryAdaptorsReply(_c,_d) \
if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryAdaptorsReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryAdaptorsReply, _d)
#define _WriteQueryExtensionReply(_c,_d) \
if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryExtensionReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryExtensionReply, _d)
#define _WriteQueryEncodingsReply(_c,_d) \
if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryEncodingsReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryEncodingsReply, _d)
#define _WriteAdaptorInfo(_c,_d) \
if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \
- else WriteToClient(_c, sz_xvAdaptorInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvAdaptorInfo, _d)
#define _WriteAttributeInfo(_c,_d) \
if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \
- else WriteToClient(_c, sz_xvAttributeInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvAttributeInfo, _d)
#define _WriteEncodingInfo(_c,_d) \
if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \
- else WriteToClient(_c, sz_xvEncodingInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvEncodingInfo, _d)
#define _WriteFormat(_c,_d) \
if ((_c)->swapped) SWriteFormat(_c, _d); \
- else WriteToClient(_c, sz_xvFormat, (char*)_d)
+ else WriteToClient(_c, sz_xvFormat, _d)
#define _WriteGrabPortReply(_c,_d) \
if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \
- else WriteToClient(_c, sz_xvGrabPortReply, (char*)_d)
+ else WriteToClient(_c, sz_xvGrabPortReply, _d)
#define _WriteGetPortAttributeReply(_c,_d) \
if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \
- else WriteToClient(_c, sz_xvGetPortAttributeReply, (char*)_d)
+ else WriteToClient(_c, sz_xvGetPortAttributeReply, _d)
#define _WriteQueryBestSizeReply(_c,_d) \
if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryBestSizeReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryBestSizeReply, _d)
#define _WriteQueryPortAttributesReply(_c,_d) \
if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryPortAttributesReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryPortAttributesReply, _d)
#define _WriteQueryImageAttributesReply(_c,_d) \
if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryImageAttributesReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryImageAttributesReply, _d)
#define _WriteListImageFormatsReply(_c,_d) \
if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); \
- else WriteToClient(_c, sz_xvListImageFormatsReply,(char*) _d)
+ else WriteToClient(_c, sz_xvListImageFormatsReply, _d)
#define _WriteImageFormatInfo(_c,_d) \
if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
- else WriteToClient(_c, sz_xvImageFormatInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvImageFormatInfo, _d)
#define _AllocatePort(_i,_p) \
((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
@@ -224,6 +220,8 @@ static int SWriteImageFormatInfo(ClientPtr, xvImageFormatInfo*);
**
*/
+#if !defined(NXAGENT_SERVER) || defined(__sun) || defined(__CYGWIN__)
+
int
ProcXvDispatch(ClientPtr client)
{
@@ -351,6 +349,8 @@ SProcXvDispatch(ClientPtr client)
}
}
}
+#endif /* !defined(NXAGENT_SERVER) || defined(__sun) || defined(__CYGWIN__) */
+
static int
ProcXvQueryExtension(ClientPtr client)
@@ -1201,7 +1201,6 @@ ProcXvShmPutImage(ClientPtr client)
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
- ev.sequenceNumber = client->sequence;
ev.minorEvent = xv_ShmPutImage;
ev.majorEvent = XvReqCode;
ev.shmseg = stuff->shmseg;
@@ -1254,7 +1253,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
num_planes = pImage->num_planes;
- if(!(offsets = xalloc(num_planes << 3)))
+ if(!(offsets = malloc(num_planes << 3)))
return BadAlloc;
pitches = offsets + num_planes;
@@ -1275,9 +1274,9 @@ ProcXvQueryImageAttributes(ClientPtr client)
_WriteQueryImageAttributesReply(client, &rep);
if(client->swapped)
SwapLongs((CARD32*)offsets, rep.length);
- WriteToClient(client, rep.length << 2, (char*)offsets);
+ WriteToClient(client, rep.length << 2, offsets);
- xfree(offsets);
+ free(offsets);
return Success;
}
@@ -1345,154 +1344,154 @@ ProcXvListImageFormats(ClientPtr client)
static int
SProcXvQueryExtension(ClientPtr client)
{
- register char n;
REQUEST(xvQueryExtensionReq);
- swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xvQueryExtensionReq);
+ swaps(&stuff->length);
return ProcXvQueryExtension(client);
}
static int
SProcXvQueryAdaptors(ClientPtr client)
{
- register char n;
REQUEST(xvQueryAdaptorsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
+ REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
return ProcXvQueryAdaptors(client);
}
static int
SProcXvQueryEncodings(ClientPtr client)
{
- register char n;
REQUEST(xvQueryEncodingsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
+ REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
return ProcXvQueryEncodings(client);
}
static int
SProcXvGrabPort(ClientPtr client)
{
- register char n;
REQUEST(xvGrabPortReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->time, n);
+ REQUEST_SIZE_MATCH(xvGrabPortReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->time);
return ProcXvGrabPort(client);
}
static int
SProcXvUngrabPort(ClientPtr client)
{
- register char n;
REQUEST(xvUngrabPortReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->time, n);
+ REQUEST_SIZE_MATCH(xvUngrabPortReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->time);
return ProcXvUngrabPort(client);
}
static int
SProcXvPutVideo(ClientPtr client)
{
- register char n;
REQUEST(xvPutVideoReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swaps(&stuff->vid_x, n);
- swaps(&stuff->vid_y, n);
- swaps(&stuff->vid_w, n);
- swaps(&stuff->vid_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
+ REQUEST_SIZE_MATCH(xvPutVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
return ProcXvPutVideo(client);
}
static int
SProcXvPutStill(ClientPtr client)
{
- register char n;
REQUEST(xvPutStillReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swaps(&stuff->vid_x, n);
- swaps(&stuff->vid_y, n);
- swaps(&stuff->vid_w, n);
- swaps(&stuff->vid_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
+ REQUEST_SIZE_MATCH(xvPutStillReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
return ProcXvPutStill(client);
}
static int
SProcXvGetVideo(ClientPtr client)
{
- register char n;
REQUEST(xvGetVideoReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swaps(&stuff->vid_x, n);
- swaps(&stuff->vid_y, n);
- swaps(&stuff->vid_w, n);
- swaps(&stuff->vid_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
+ REQUEST_SIZE_MATCH(xvGetVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
return ProcXvGetVideo(client);
}
static int
SProcXvGetStill(ClientPtr client)
{
- register char n;
REQUEST(xvGetStillReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swaps(&stuff->vid_x, n);
- swaps(&stuff->vid_y, n);
- swaps(&stuff->vid_w, n);
- swaps(&stuff->vid_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
+ REQUEST_SIZE_MATCH(xvGetStillReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
return ProcXvGetStill(client);
}
static int
SProcXvPutImage(ClientPtr client)
{
- register char n;
REQUEST(xvPutImageReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swapl(&stuff->id, n);
- swaps(&stuff->src_x, n);
- swaps(&stuff->src_y, n);
- swaps(&stuff->src_w, n);
- swaps(&stuff->src_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
+ REQUEST_AT_LEAST_SIZE(xvPutImageReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swapl(&stuff->id);
+ swaps(&stuff->src_x);
+ swaps(&stuff->src_y);
+ swaps(&stuff->src_w);
+ swaps(&stuff->src_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
return ProcXvPutImage(client);
}
@@ -1500,25 +1499,25 @@ SProcXvPutImage(ClientPtr client)
static int
SProcXvShmPutImage(ClientPtr client)
{
- register char n;
REQUEST(xvShmPutImageReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->gc, n);
- swapl(&stuff->shmseg, n);
- swapl(&stuff->id, n);
- swaps(&stuff->src_x, n);
- swaps(&stuff->src_y, n);
- swaps(&stuff->src_w, n);
- swaps(&stuff->src_h, n);
- swaps(&stuff->drw_x, n);
- swaps(&stuff->drw_y, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
- swaps(&stuff->offset, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
+ REQUEST_SIZE_MATCH(xvShmPutImageReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->id);
+ swapl(&stuff->offset);
+ swaps(&stuff->src_x);
+ swaps(&stuff->src_y);
+ swaps(&stuff->src_w);
+ swaps(&stuff->src_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
return ProcXvShmPutImage(client);
}
#endif
@@ -1527,99 +1526,101 @@ SProcXvShmPutImage(ClientPtr client)
static int
SProcXvSelectVideoNotify(ClientPtr client)
{
- register char n;
REQUEST(xvSelectVideoNotifyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->drawable, n);
+ REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->drawable);
return ProcXvSelectVideoNotify(client);
}
static int
SProcXvSelectPortNotify(ClientPtr client)
{
- register char n;
REQUEST(xvSelectPortNotifyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
+ REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
return ProcXvSelectPortNotify(client);
}
static int
SProcXvStopVideo(ClientPtr client)
{
- register char n;
REQUEST(xvStopVideoReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->drawable, n);
+ REQUEST_SIZE_MATCH(xvStopVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
return ProcXvStopVideo(client);
}
static int
SProcXvSetPortAttribute(ClientPtr client)
{
- register char n;
REQUEST(xvSetPortAttributeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->attribute, n);
+ REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->attribute);
+ swapl(&stuff->value);
return ProcXvSetPortAttribute(client);
}
static int
SProcXvGetPortAttribute(ClientPtr client)
{
- register char n;
REQUEST(xvGetPortAttributeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swapl(&stuff->attribute, n);
+ REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->attribute);
return ProcXvGetPortAttribute(client);
}
static int
SProcXvQueryBestSize(ClientPtr client)
{
- register char n;
REQUEST(xvQueryBestSizeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
- swaps(&stuff->vid_w, n);
- swaps(&stuff->vid_h, n);
- swaps(&stuff->drw_w, n);
- swaps(&stuff->drw_h, n);
+ REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
return ProcXvQueryBestSize(client);
}
static int
SProcXvQueryPortAttributes(ClientPtr client)
{
- register char n;
REQUEST(xvQueryPortAttributesReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
+ REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
return ProcXvQueryPortAttributes(client);
}
static int
SProcXvQueryImageAttributes(ClientPtr client)
{
- register char n;
REQUEST(xvQueryImageAttributesReq);
- swaps(&stuff->length, n);
- swapl(&stuff->id, n);
- swaps(&stuff->width, n);
- swaps(&stuff->width, n);
+ REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->id);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
return ProcXvQueryImageAttributes(client);
}
static int
SProcXvListImageFormats(ClientPtr client)
{
- register char n;
REQUEST(xvListImageFormatsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->port, n);
+ REQUEST_SIZE_MATCH(xvListImageFormatsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
return ProcXvListImageFormats(client);
}
@@ -1629,14 +1630,12 @@ SWriteQueryExtensionReply(
ClientPtr client,
xvQueryExtensionReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->version, n);
- swaps(&rep->revision, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->version);
+ swaps(&rep->revision);
- (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryExtensionReply, &rep);
return Success;
}
@@ -1646,13 +1645,11 @@ SWriteQueryAdaptorsReply(
ClientPtr client,
xvQueryAdaptorsReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_adaptors, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_adaptors);
- (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryAdaptorsReply, &rep);
return Success;
}
@@ -1662,13 +1659,11 @@ SWriteQueryEncodingsReply(
ClientPtr client,
xvQueryEncodingsReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_encodings, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_encodings);
- (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryEncodingsReply, &rep);
return Success;
}
@@ -1678,14 +1673,12 @@ SWriteAdaptorInfo(
ClientPtr client,
xvAdaptorInfo *pAdaptor
){
- register char n;
-
- swapl(&pAdaptor->base_id, n);
- swaps(&pAdaptor->name_size, n);
- swaps(&pAdaptor->num_ports, n);
- swaps(&pAdaptor->num_formats, n);
+ swapl(&pAdaptor->base_id);
+ swaps(&pAdaptor->name_size);
+ swaps(&pAdaptor->num_ports);
+ swaps(&pAdaptor->num_formats);
- (void)WriteToClient(client, sz_xvAdaptorInfo, (char *)pAdaptor);
+ WriteToClient(client, sz_xvAdaptorInfo, pAdaptor);
return Success;
}
@@ -1695,15 +1688,13 @@ SWriteEncodingInfo(
ClientPtr client,
xvEncodingInfo *pEncoding
){
- register char n;
-
- swapl(&pEncoding->encoding, n);
- swaps(&pEncoding->name_size, n);
- swaps(&pEncoding->width, n);
- swaps(&pEncoding->height, n);
- swapl(&pEncoding->rate.numerator, n);
- swapl(&pEncoding->rate.denominator, n);
- (void)WriteToClient(client, sz_xvEncodingInfo, (char *)pEncoding);
+ swapl(&pEncoding->encoding);
+ swaps(&pEncoding->name_size);
+ swaps(&pEncoding->width);
+ swaps(&pEncoding->height);
+ swapl(&pEncoding->rate.numerator);
+ swapl(&pEncoding->rate.denominator);
+ WriteToClient(client, sz_xvEncodingInfo, pEncoding);
return Success;
}
@@ -1713,10 +1704,8 @@ SWriteFormat(
ClientPtr client,
xvFormat *pFormat
){
- register char n;
-
- swapl(&pFormat->visual, n);
- (void)WriteToClient(client, sz_xvFormat, (char *)pFormat);
+ swapl(&pFormat->visual);
+ WriteToClient(client, sz_xvFormat, pFormat);
return Success;
}
@@ -1726,13 +1715,11 @@ SWriteAttributeInfo(
ClientPtr client,
xvAttributeInfo *pAtt
){
- register char n;
-
- swapl(&pAtt->flags, n);
- swapl(&pAtt->size, n);
- swapl(&pAtt->min, n);
- swapl(&pAtt->max, n);
- (void)WriteToClient(client, sz_xvAttributeInfo, (char *)pAtt);
+ swapl(&pAtt->flags);
+ swapl(&pAtt->size);
+ swapl(&pAtt->min);
+ swapl(&pAtt->max);
+ WriteToClient(client, sz_xvAttributeInfo, pAtt);
return Success;
}
@@ -1742,23 +1729,21 @@ SWriteImageFormatInfo(
ClientPtr client,
xvImageFormatInfo *pImage
){
- register char n;
-
- swapl(&pImage->id, n);
- swapl(&pImage->red_mask, n);
- swapl(&pImage->green_mask, n);
- swapl(&pImage->blue_mask, n);
- swapl(&pImage->y_sample_bits, n);
- swapl(&pImage->u_sample_bits, n);
- swapl(&pImage->v_sample_bits, n);
- swapl(&pImage->horz_y_period, n);
- swapl(&pImage->horz_u_period, n);
- swapl(&pImage->horz_v_period, n);
- swapl(&pImage->vert_y_period, n);
- swapl(&pImage->vert_u_period, n);
- swapl(&pImage->vert_v_period, n);
-
- (void)WriteToClient(client, sz_xvImageFormatInfo, (char *)pImage);
+ swapl(&pImage->id);
+ swapl(&pImage->red_mask);
+ swapl(&pImage->green_mask);
+ swapl(&pImage->blue_mask);
+ swapl(&pImage->y_sample_bits);
+ swapl(&pImage->u_sample_bits);
+ swapl(&pImage->v_sample_bits);
+ swapl(&pImage->horz_y_period);
+ swapl(&pImage->horz_u_period);
+ swapl(&pImage->horz_v_period);
+ swapl(&pImage->vert_y_period);
+ swapl(&pImage->vert_u_period);
+ swapl(&pImage->vert_v_period);
+
+ WriteToClient(client, sz_xvImageFormatInfo, pImage);
return Success;
}
@@ -1770,12 +1755,10 @@ SWriteGrabPortReply(
ClientPtr client,
xvGrabPortReply *rep
){
- register char n;
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
-
- (void)WriteToClient(client, sz_xvGrabPortReply, (char *)&rep);
+ WriteToClient(client, sz_xvGrabPortReply, &rep);
return Success;
}
@@ -1785,13 +1768,11 @@ SWriteGetPortAttributeReply(
ClientPtr client,
xvGetPortAttributeReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->value, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->value);
- (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)&rep);
+ WriteToClient(client, sz_xvGetPortAttributeReply, &rep);
return Success;
}
@@ -1801,14 +1782,12 @@ SWriteQueryBestSizeReply(
ClientPtr client,
xvQueryBestSizeReply *rep
){
- register char n;
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->actual_width);
+ swaps(&rep->actual_height);
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->actual_width, n);
- swaps(&rep->actual_height, n);
-
- (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryBestSizeReply, &rep);
return Success;
}
@@ -1818,14 +1797,12 @@ SWriteQueryPortAttributesReply(
ClientPtr client,
xvQueryPortAttributesReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->num_attributes, n);
- swapl(&rep->text_size, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_attributes);
+ swapl(&rep->text_size);
- (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryPortAttributesReply, &rep);
return Success;
}
@@ -1835,16 +1812,14 @@ SWriteQueryImageAttributesReply(
ClientPtr client,
xvQueryImageAttributesReply *rep
){
- register char n;
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_planes);
+ swapl(&rep->data_size);
+ swaps(&rep->width);
+ swaps(&rep->height);
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->num_planes, n);
- swapl(&rep->data_size, n);
- swaps(&rep->width, n);
- swaps(&rep->height, n);
-
- (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)&rep);
+ WriteToClient(client, sz_xvQueryImageAttributesReply, &rep);
return Success;
}
@@ -1855,13 +1830,11 @@ SWriteListImageFormatsReply(
ClientPtr client,
xvListImageFormatsReply *rep
){
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->num_formats, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_formats);
- (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)&rep);
+ WriteToClient(client, sz_xvListImageFormatsReply, &rep);
return Success;
}
@@ -1881,11 +1854,11 @@ XineramaXvStopVideo(ClientPtr client)
REQUEST_SIZE_MATCH(xvStopVideoReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
FOR_NSCREENS_BACKWARD(i) {
@@ -1909,7 +1882,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
FOR_NSCREENS_BACKWARD(i) {
@@ -1935,15 +1908,15 @@ XineramaXvShmPutImage(ClientPtr client)
REQUEST_SIZE_MATCH(xvShmPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1982,15 +1955,15 @@ XineramaXvPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -2027,15 +2000,15 @@ XineramaXvPutVideo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -2072,15 +2045,15 @@ XineramaXvPutStill(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
- client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
return BadDrawable;
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ client, stuff->gc, XRT_GC, DixReadAccess)))
return BadGC;
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
- client, stuff->port, XvXRTPort, SecurityReadAccess)))
+ client, stuff->port, XvXRTPort, DixReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -2199,7 +2172,7 @@ void XineramifyXv(void)
/* now create a resource for each port */
for(j = 0; j < refAdapt->nPorts; j++) {
- if(!(port = xalloc(sizeof(PanoramiXRes))))
+ if(!(port = malloc(sizeof(PanoramiXRes))))
break;
port->info[0].id = MatchingAdaptors[0]->base_id + j;
AddResource(port->info[0].id, XvXRTPort, port);
diff --git a/nx-X11/programs/Xserver/Xext/xvdisp.h b/nx-X11/programs/Xserver/Xext/xvdisp.h
index 00af9858b..75cacddcc 100644
--- a/nx-X11/programs/Xserver/Xext/xvdisp.h
+++ b/nx-X11/programs/Xserver/Xext/xvdisp.h
@@ -1,3 +1 @@
-/* $XFree86$ */
-
extern void XineramifyXv(void);
diff --git a/nx-X11/programs/Xserver/Xext/xvdix.h b/nx-X11/programs/Xserver/Xext/xvdix.h
index 99d918406..973c39b76 100644
--- a/nx-X11/programs/Xserver/Xext/xvdix.h
+++ b/nx-X11/programs/Xserver/Xext/xvdix.h
@@ -21,7 +21,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/xvdix.h,v 1.7 2001/05/07 21:37:51 tsi Exp $ */
#ifndef XVDIX_H
#define XVDIX_H
@@ -54,7 +53,7 @@ SOFTWARE.
*/
#include "scrnintstr.h"
-#include <X11/extensions/Xvproto.h>
+#include <nx-X11/extensions/Xvproto.h>
extern int XvScreenIndex;
extern unsigned long XvExtensionGeneration;
@@ -220,7 +219,7 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
- Bool (* ddCloseScreen)(int, ScreenPtr);
+ Bool (* ddCloseScreen)(ScreenPtr);
int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
diff --git a/nx-X11/programs/Xserver/Xext/xvmain.c b/nx-X11/programs/Xserver/Xext/xvmain.c
index 8934f77f2..397f8dc81 100644
--- a/nx-X11/programs/Xserver/Xext/xvmain.c
+++ b/nx-X11/programs/Xserver/Xext/xvmain.c
@@ -1,4 +1,3 @@
-/* $XdotOrg: xc/programs/Xserver/Xext/xvmain.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
@@ -22,7 +21,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/xvmain.c,v 1.15tsi Exp $ */
/*
** File:
@@ -79,8 +77,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <string.h>
+
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "scrnintstr.h"
@@ -95,14 +95,10 @@ SOFTWARE.
#define GLOBAL
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
+#include <nx-X11/extensions/Xv.h>
+#include <nx-X11/extensions/Xvproto.h>
#include "xvdix.h"
-#ifdef EXTMODULE
-#include "xf86_ansic.h"
-#endif
-
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -135,16 +131,16 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
-static Bool XvCloseScreen(int, ScreenPtr);
+static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry*);
-static int XvdiDestroyGrab(pointer, XID);
-static int XvdiDestroyEncoding(pointer, XID);
-static int XvdiDestroyVideoNotify(pointer, XID);
-static int XvdiDestroyPortNotify(pointer, XID);
-static int XvdiDestroyVideoNotifyList(pointer, XID);
-static int XvdiDestroyPort(pointer, XID);
+static int XvdiDestroyGrab(void *, XID);
+static int XvdiDestroyEncoding(void *, XID);
+static int XvdiDestroyVideoNotify(void *, XID);
+static int XvdiDestroyPortNotify(void *, XID);
+static int XvdiDestroyVideoNotifyList(void *, XID);
+static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
@@ -288,14 +284,14 @@ XvScreenInit(ScreenPtr pScreen)
/* ALLOCATE SCREEN PRIVATE RECORD */
- pxvs = (XvScreenPtr) xalloc (sizeof (XvScreenRec));
+ pxvs = (XvScreenPtr) malloc (sizeof (XvScreenRec));
if (!pxvs)
{
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
return BadAlloc;
}
- pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs;
+ pScreen->devPrivates[XvScreenIndex].ptr = (void *)pxvs;
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
@@ -311,7 +307,6 @@ XvScreenInit(ScreenPtr pScreen)
static Bool
XvCloseScreen(
- int ii,
ScreenPtr pScreen
){
@@ -323,13 +318,13 @@ XvCloseScreen(
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
- (* pxvs->ddCloseScreen)(ii, pScreen);
+ (* pxvs->ddCloseScreen)(pScreen);
- xfree(pxvs);
+ free(pxvs);
- pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
+ pScreen->devPrivates[XvScreenIndex].ptr = (void *)NULL;
- return (*pScreen->CloseScreen)(ii, pScreen);
+ return (*pScreen->CloseScreen)(pScreen);
}
@@ -479,20 +474,20 @@ XvdiVideoStopped(XvPortPtr pPort, int reason)
}
static int
-XvdiDestroyPort(pointer pPort, XID id)
+XvdiDestroyPort(void * pPort, XID id)
{
return (* ((XvPortPtr)pPort)->pAdaptor->ddFreePort)(pPort);
}
static int
-XvdiDestroyGrab(pointer pGrab, XID id)
+XvdiDestroyGrab(void * pGrab, XID id)
{
((XvGrabPtr)pGrab)->client = (ClientPtr)NULL;
return Success;
}
static int
-XvdiDestroyVideoNotify(pointer pn, XID id)
+XvdiDestroyVideoNotify(void * pn, XID id)
{
/* JUST CLEAR OUT THE client POINTER FIELD */
@@ -501,7 +496,7 @@ XvdiDestroyVideoNotify(pointer pn, XID id)
}
static int
-XvdiDestroyPortNotify(pointer pn, XID id)
+XvdiDestroyPortNotify(void * pn, XID id)
{
/* JUST CLEAR OUT THE client POINTER FIELD */
@@ -510,7 +505,7 @@ XvdiDestroyPortNotify(pointer pn, XID id)
}
static int
-XvdiDestroyVideoNotifyList(pointer pn, XID id)
+XvdiDestroyVideoNotifyList(void * pn, XID id)
{
XvVideoNotifyPtr npn,cpn;
@@ -522,14 +517,14 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
{
npn = cpn->next;
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
- xfree(cpn);
+ free(cpn);
cpn = npn;
}
return Success;
}
static int
-XvdiDestroyEncoding(pointer value, XID id)
+XvdiDestroyEncoding(void * value, XID id)
{
return Success;
}
@@ -941,12 +936,12 @@ XvdiSelectVideoNotify(
if (!pn)
{
- if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
+ if (!(tpn = (XvVideoNotifyPtr)malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = (XvVideoNotifyPtr)NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
{
- xfree(tpn);
+ free(tpn);
return BadAlloc;
}
}
@@ -979,7 +974,7 @@ XvdiSelectVideoNotify(
}
else
{
- if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
+ if (!(tpn = (XvVideoNotifyPtr)malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = pn->next;
pn->next = tpn;
@@ -1037,7 +1032,7 @@ XvdiSelectPortNotify(
if (!tpn)
{
- if (!(tpn = (XvPortNotifyPtr)xalloc(sizeof(XvPortNotifyRec))))
+ if (!(tpn = (XvPortNotifyPtr)malloc(sizeof(XvPortNotifyRec))))
return BadAlloc;
tpn->next = pPort->pNotify;
pPort->pNotify = tpn;
diff --git a/nx-X11/programs/Xserver/Xext/xvmc.c b/nx-X11/programs/Xserver/Xext/xvmc.c
index 37fb153ab..fcd170efd 100644
--- a/nx-X11/programs/Xserver/Xext/xvmc.c
+++ b/nx-X11/programs/Xserver/Xext/xvmc.c
@@ -1,13 +1,12 @@
-/* $XFree86: xc/programs/Xserver/Xext/xvmc.c,v 1.8 2003/07/16 01:38:31 dawes Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <string.h>
+
+#include <nx-X11/X.h>
+#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@@ -15,22 +14,17 @@
#include "scrnintstr.h"
#include "extnsionst.h"
#include "servermd.h"
-#include <X11/Xfuncproto.h>
+#include <nx-X11/Xfuncproto.h>
#include "xvdix.h"
-#include <X11/extensions/XvMC.h>
-#include <X11/extensions/Xvproto.h>
-#include <X11/extensions/XvMCproto.h>
+#include <nx-X11/extensions/XvMC.h>
+#include <nx-X11/extensions/Xvproto.h>
+#include <nx-X11/extensions/XvMCproto.h>
#include "xvmcext.h"
#ifdef HAS_XVMCSHM
-#ifndef Lynx
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
-#else
-#include <ipc.h>
-#include <shm.h>
-#endif /* Lynx */
#endif /* HAS_XVMCSHM */
@@ -66,7 +60,7 @@ typedef struct {
static int
-XvMCDestroyContextRes(pointer data, XID id)
+XvMCDestroyContextRes(void * data, XID id)
{
XvMCContextPtr pContext = (XvMCContextPtr)data;
@@ -75,39 +69,39 @@ XvMCDestroyContextRes(pointer data, XID id)
if(!pContext->refcnt) {
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
- xfree(pContext);
+ free(pContext);
}
return Success;
}
static int
-XvMCDestroySurfaceRes(pointer data, XID id)
+XvMCDestroySurfaceRes(void * data, XID id)
{
XvMCSurfacePtr pSurface = (XvMCSurfacePtr)data;
XvMCContextPtr pContext = pSurface->context;
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface);
- xfree(pSurface);
+ free(pSurface);
- XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
+ XvMCDestroyContextRes((void *)pContext, pContext->context_id);
return Success;
}
static int
-XvMCDestroySubpictureRes(pointer data, XID id)
+XvMCDestroySubpictureRes(void * data, XID id)
{
XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr)data;
XvMCContextPtr pContext = pSubpict->context;
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict);
- xfree(pSubpict);
+ free(pSubpict);
- XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
+ XvMCDestroyContextRes((void *)pContext, pContext->context_id);
return Success;
}
@@ -129,7 +123,7 @@ ProcXvMCQueryVersion(ClientPtr client)
rep.length = 0;
rep.major = XvMCVersion;
rep.minor = XvMCRevision;
- WriteToClient(client, sizeof(xvmcQueryVersionReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
return Success;
}
@@ -169,7 +163,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
rep.num = (adaptor) ? adaptor->num_surfaces : 0;
rep.length = rep.num * sizeof(xvmcSurfaceInfo) >> 2;
- WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
for(i = 0; i < rep.num; i++) {
surface = adaptor->surfaces[i];
@@ -181,7 +175,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
- WriteToClient(client, sizeof(xvmcSurfaceInfo), (char*)&info);
+ WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
}
return Success;
@@ -242,7 +236,7 @@ ProcXvMCCreateContext(ClientPtr client)
(stuff->height > surface->max_height))
return BadValue;
- if(!(pContext = xalloc(sizeof(XvMCContextRec)))) {
+ if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
return BadAlloc;
}
@@ -259,7 +253,7 @@ ProcXvMCCreateContext(ClientPtr client)
result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
if(result != Success) {
- xfree(pContext);
+ free(pContext);
return result;
}
@@ -270,13 +264,13 @@ ProcXvMCCreateContext(ClientPtr client)
rep.flags_return = pContext->flags;
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateContextReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
if(data)
- xfree(data);
+ free(data);
return Success;
}
@@ -313,7 +307,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- if(!(pSurface = xalloc(sizeof(XvMCSurfaceRec))))
+ if(!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
@@ -324,7 +318,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pSurface, &dwords, &data);
if(result != Success) {
- xfree(pSurface);
+ free(pSurface);
return result;
}
@@ -332,13 +326,13 @@ ProcXvMCCreateSurface(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
if(data)
- xfree(data);
+ free(data);
pContext->refcnt++;
@@ -408,7 +402,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
(stuff->height > surface->subpicture_max_height))
return BadValue;
- if(!(pSubpicture = xalloc(sizeof(XvMCSubpictureRec))))
+ if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
@@ -427,7 +421,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
pSubpicture, &dwords, &data);
if(result != Success) {
- xfree(pSubpicture);
+ free(pSubpicture);
return result;
}
@@ -443,13 +437,13 @@ ProcXvMCCreateSubpicture(ClientPtr client)
rep.component_order[3] = pSubpicture->component_order[3];
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
if(data)
- xfree(data);
+ free(data);
pContext->refcnt++;
@@ -525,7 +519,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
rep.length = rep.num * sizeof(xvImageFormatInfo) >> 2;
- WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
for(i = 0; i < rep.num; i++) {
pImage = NULL;
@@ -561,7 +555,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
- WriteToClient(client, sizeof(xvImageFormatInfo), (char*)&info);
+ WriteToClient(client, sizeof(xvImageFormatInfo), &info);
}
return Success;
@@ -631,7 +625,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply),
- (char*)&rep);
+ &rep);
if (rep.length) {
WriteToClient(client, rep.nameLen,
pScreenPriv->clientDriverName);
@@ -702,15 +696,15 @@ XvMCExtensionInit()
}
static Bool
-XvMCCloseScreen (int i, ScreenPtr pScreen)
+XvMCCloseScreen (ScreenPtr pScreen)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
- xfree(pScreenPriv);
+ free(pScreenPriv);
- return (*pScreen->CloseScreen)(i, pScreen);
+ return (*pScreen->CloseScreen)(pScreen);
}
@@ -726,10 +720,10 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
XvMCGeneration = serverGeneration;
}
- if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec))))
+ if(!(pScreenPriv = (XvMCScreenPtr)malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
- pScreen->devPrivates[XvMCScreenIndex].ptr = (pointer)pScreenPriv;
+ pScreen->devPrivates[XvMCScreenIndex].ptr = (void *)pScreenPriv;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
diff --git a/nx-X11/programs/Xserver/Xext/xvmcext.h b/nx-X11/programs/Xserver/Xext/xvmcext.h
index c7eba30ad..c1826b44c 100644
--- a/nx-X11/programs/Xserver/Xext/xvmcext.h
+++ b/nx-X11/programs/Xserver/Xext/xvmcext.h
@@ -1,8 +1,7 @@
-/* $XFree86: xc/programs/Xserver/Xext/xvmcext.h,v 1.1 2001/04/07 11:04:21 alanh Exp $ */
#ifndef _XVMC_H
#define _XVMC_H
-#include <X11/extensions/Xv.h>
+#include <nx-X11/extensions/Xv.h>
#include "xvdix.h"
typedef struct {
@@ -32,15 +31,15 @@ typedef struct {
unsigned short height;
CARD32 flags;
int refcnt;
- pointer port_priv;
- pointer driver_priv;
+ void * port_priv;
+ void * driver_priv;
} XvMCContextRec, *XvMCContextPtr;
typedef struct {
XID surface_id;
int surface_type_id;
XvMCContextPtr context;
- pointer driver_priv;
+ void * driver_priv;
} XvMCSurfaceRec, *XvMCSurfacePtr;
@@ -53,7 +52,7 @@ typedef struct {
int entry_bytes;
char component_order[4];
XvMCContextPtr context;
- pointer driver_priv;
+ void * driver_priv;
} XvMCSubpictureRec, *XvMCSubpicturePtr;
typedef int (*XvMCCreateContextProcPtr) (
diff --git a/nx-X11/programs/Xserver/Xext/xvmod.c b/nx-X11/programs/Xserver/Xext/xvmod.c
deleted file mode 100644
index 7899f3a75..000000000
--- a/nx-X11/programs/Xserver/Xext/xvmod.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xvmod.c,v 1.1 1998/08/13 14:45:36 dawes Exp $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "scrnintstr.h"
-#include "gc.h"
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-#include "xvdix.h"
-#include "xvmodproc.h"
-
-void
-XvRegister()
-{
- XvScreenInitProc = XvScreenInit;
- XvGetScreenIndexProc = XvGetScreenIndex;
- XvGetRTPortProc = XvGetRTPort;
- XvMCScreenInitProc = XvMCScreenInit;
-}
-
diff --git a/nx-X11/programs/Xserver/Xext/xvmodproc.h b/nx-X11/programs/Xserver/Xext/xvmodproc.h
deleted file mode 100644
index b284e3f4e..000000000
--- a/nx-X11/programs/Xserver/Xext/xvmodproc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.2 2001/03/05 04:51:55 mvojkovi Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xvmcext.h"
-
-extern int (*XvGetScreenIndexProc)(void);
-extern unsigned long (*XvGetRTPortProc)(void);
-extern int (*XvScreenInitProc)(ScreenPtr);
-extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
-
-extern void XvRegister(void);