aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xext
diff options
context:
space:
mode:
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/Imakefile97
-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/cup.c367
-rw-r--r--nx-X11/programs/Xserver/Xext/dgaproc.h144
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/Imakefile74
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/modinit.c81
-rw-r--r--nx-X11/programs/Xserver/Xext/extmod/modinit.h51
-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/panoramiXSwap.c4
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiXprocs.c6
-rw-r--r--nx-X11/programs/Xserver/Xext/sampleEVI.c121
-rw-r--r--nx-X11/programs/Xserver/Xext/security.c40
-rw-r--r--nx-X11/programs/Xserver/Xext/vidmodeproc.h78
-rw-r--r--nx-X11/programs/Xserver/Xext/xcmisc.c8
-rw-r--r--nx-X11/programs/Xserver/Xext/xevie.c719
-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
28 files changed, 35 insertions, 11070 deletions
diff --git a/nx-X11/programs/Xserver/Xext/EVI.c b/nx-X11/programs/Xserver/Xext/EVI.c
deleted file mode 100644
index 1eca62693..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 <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <nx-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 199e59f1d..2c9798639 100644
--- a/nx-X11/programs/Xserver/Xext/Imakefile
+++ b/nx-X11/programs/Xserver/Xext/Imakefile
@@ -30,42 +30,16 @@ XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.43 2003/04/21 18:56:48 sv
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(XorgServer) && XorgServer)
- VIDMODESRCS = xf86vmode.c
- VIDMODEOBJS = xf86vmode.o
-#endif
-
-#if BuildXF86MiscExt && \
- (defined(XorgServer) && XorgServer)
-XF86MISCSRCS = xf86misc.c
-XF86MISCOBJS = xf86misc.o
-#endif
-
#if BuildXF86BigfontExt
XF86BIGFSRCS = xf86bigfont.c
XF86BIGFOBJS = xf86bigfont.o
@@ -74,14 +48,6 @@ 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
XVSRCS = xvmain.c xvdisp.c xvmc.c
XVOBJS = xvmain.o xvdisp.o xvmc.o
@@ -92,20 +58,12 @@ 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
@@ -116,38 +74,22 @@ XF86BIGFOBJS = xf86bigfont.o
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
-
- 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) $(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) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
- $(XEVIEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
+ 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)
- SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) \
+ SOBJS = $(SHMOBJS) $(SECURITYOBJS) \
shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
- $(XEVIEOBJS) \
$(XF86BIGFOBJS)
#if defined(NXAgentServer) && NXAgentServer
@@ -160,8 +102,9 @@ NX_DEFINES = -DNXAGENT_SERVER
XF86INCLUDES = -I$(XF86COMSRC)
#endif
INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(PNRXINCLUDES) $(XF86INCLUDES) \
- $(FONTCACHEINCLUDES) $(DMXINCLUDES) \
+ $(PNRXINCLUDES) \
+ $(XF86INCLUDES) \
+ $(DMXINCLUDES) \
`pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
@@ -173,13 +116,6 @@ 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))
@@ -210,6 +146,5 @@ 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 1dd4f1ae5..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/Xagstr.h>
-#include <nx-X11/extensions/Xagsrv.h>
-#define _SECURITY_SERVER
-#include <nx-X11/extensions/security.h>
-#include <nx-X11/Xfuncproto.h>
-
-#define XSERV_t
-#include <nx-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(
- void * 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,
- void * nulldata,
- void * 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 ((void *) 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 ((void *)pAppGrp, (XID)0);
- return ret;
- }
- if (pAppGrp->single_screen) {
- CreateConnectionInfo (pAppGrp);
- if (!pAppGrp->ConnectionInfo)
- return BadAlloc;
- }
- if (!AddResource (stuff->app_group, RT_APPGROUP, (void *)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, (void *)&clientinfo);
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/appgroup.h b/nx-X11/programs/Xserver/Xext/appgroup.h
deleted file mode 100644
index 2a8feb585..000000000
--- a/nx-X11/programs/Xserver/Xext/appgroup.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $XFree86$ */
-
-void XagClientStateChange(
- CallbackListPtr* pcbl,
- void * nulldata,
- void * calldata);
-int ProcXagCreate (
- register ClientPtr client);
-int ProcXagDestroy(
- register ClientPtr client);
diff --git a/nx-X11/programs/Xserver/Xext/cup.c b/nx-X11/programs/Xserver/Xext/cup.c
deleted file mode 100644
index 9b6d25c21..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/Xcupstr.h>
-#include <nx-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 4d3f224e6..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 <nx-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/extmod/Imakefile b/nx-X11/programs/Xserver/Xext/extmod/Imakefile
index 45f3f39d7..f5aceb507 100644
--- a/nx-X11/programs/Xserver/Xext/extmod/Imakefile
+++ b/nx-X11/programs/Xserver/Xext/extmod/Imakefile
@@ -4,52 +4,18 @@ 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
@@ -65,57 +31,33 @@ LinkSourceFile(xvmc.c,..)
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)
+ SRCS = shape.c \
+ bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c \
+ $(DPMSSRCS) \
+ $(XVSRCS) $(MODINITSRCS) $(XRESSRCS)
- MOBJS = $(MODINITOBJS) shape.o $(MULTIBUFOBJ) mitmisc.o \
+ MOBJS = $(MODINITOBJS) shape.o \
bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o \
- $(VIDMODEOBJS) $(XF86MISCOBJS) $(XF86DGAOBJS) \
- $(CUPOBJS) $(DPMSOBJS) $(FONTCACHEOBJS) \
- $(EVIOBJS) $(XVOBJS) $(XRESOBJS)
+ $(DPMSOBJS) \
+ $(XVOBJS) $(XRESOBJS)
DEFINES = -DEXTMODULE $(EXT_DEFINES)
XF86INCLUDES = -I$(XF86COMSRC)
INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- $(XF86INCLUDES) $(FONTCACHEINCLUDES)
+ $(XF86INCLUDES)
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))
diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.c b/nx-X11/programs/Xserver/Xext/extmod/modinit.c
index 162f76ad8..6969148a3 100644
--- a/nx-X11/programs/Xserver/Xext/extmod/modinit.c
+++ b/nx-X11/programs/Xserver/Xext/extmod/modinit.c
@@ -53,24 +53,6 @@ ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef MULTIBUFFER
- {
- MultibufferExtensionInit,
- MULTIBUFFER_PROTOCOL_NAME,
- &noMultibufferExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef MITMISC
- {
- MITMiscExtensionInit,
- MITMISCNAME,
- &noMITMiscExtension,
- NULL,
- NULL
- },
-#endif
#ifdef notyet
{
XTestExtensionInit,
@@ -107,42 +89,6 @@ ExtensionModule extensionModules[] = {
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,
@@ -152,33 +98,6 @@ ExtensionModule extensionModules[] = {
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,
diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.h b/nx-X11/programs/Xserver/Xext/extmod/modinit.h
index 672586fdd..96a349add 100644
--- a/nx-X11/programs/Xserver/Xext/extmod/modinit.h
+++ b/nx-X11/programs/Xserver/Xext/extmod/modinit.h
@@ -15,18 +15,6 @@ extern void ShapeExtensionInit(INITARGS);
#include <nx-X11/extensions/shapestr.h>
#endif
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#include <nx-X11/extensions/multibufst.h>
-#endif
-
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#define _MITMISC_SERVER_
-#include <nx-X11/extensions/mitmiscstr.h>
-#endif
-
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#define _XTEST_SERVER_
@@ -60,50 +48,11 @@ extern void XCMiscExtensionInit(INITARGS);
#include <nx-X11/extensions/xcmiscstr.h>
#endif
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit(INITARGS);
-#define _XF86VIDMODE_SERVER_
-#include <nx-X11/extensions/xf86vmstr.h>
-#endif
-
-#ifdef XF86MISC
-extern void XFree86MiscExtensionInit(INITARGS);
-#define _XF86MISC_SERVER_
-#define _XF86MISC_SAVER_COMPAT_
-#include <nx-X11/extensions/xf86mscstr.h>
-#endif
-
-#ifdef XFreeXDGA
-extern void XFree86DGAExtensionInit(INITARGS);
-extern void XFree86DGARegister(INITARGS);
-#define _XF86DGA_SERVER_
-#include <nx-X11/extensions/xf86dgastr.h>
-#endif
-
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#include <nx-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 <nx-X11/extensions/Xcupstr.h>
-#endif
-
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#define _XEVI_SERVER_
-#include <nx-X11/extensions/XEVIstr.h>
-#endif
-
#ifdef XV
extern void XvExtensionInit(INITARGS);
extern void XvMCExtensionInit(INITARGS);
diff --git a/nx-X11/programs/Xserver/Xext/fontcache.c b/nx-X11/programs/Xserver/Xext/fontcache.c
deleted file mode 100644
index 0956f9be9..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 <nx-X11/X.h>
-#include <nx-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 <nx-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 5379f2656..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 <nx-X11/X.h>
-#include <nx-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 <nx-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 (
- void * /* 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 (
- void * /* 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 (
- void * /* 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 (
- void * /* 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 = (void *) 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;
-{
- void *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] = (void *) background.pixel;
- gcvalues[1] = (void *) FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0] = (void *) FillTiled;
- gcvalues[1] = (void *) background.pixmap;
- gcvalues[2] = (void *)(long) ts_x_origin;
- gcvalues[3] = (void *)(long) ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- gcvalues[0] = (void *) 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, (void *) 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, (void *) pMultibuffer))
- break;
- pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth);
- if (!pMultibuffer->pPixmap)
- break;
- if (!AddResource (ids[i], MultibufferDrawableResType, (void *) 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 = (void *) 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((void *) 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), (void *) &rep);
- WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (void *) pInfo);
- DEALLOCATE_LOCAL ((void *) 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;
- RegionInit(&region, &box, 1);
- MultibufferExpose(pMultibuffer, &region);
- RegionUninit(&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.
- */
- RegionTranslate(pWinSize,
- -pWin->drawable.x, -pWin->drawable.y);
- RegionIntersect(pExposed,
- pExposed, pWinSize);
- RegionDestroy(pWinSize);
- MultibufferExpose (pPrevMultibuffer, pExposed);
- RegionDestroy(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 && !RegionNil(pRegion))
- {
- xEvent *pEvent;
- PixmapPtr pPixmap;
- register xEvent *pe;
- register BoxPtr pBox;
- register int i;
- int numRects;
-
- pPixmap = pMultibuffer->pPixmap;
- RegionTranslate(pRegion,
- -pPixmap->drawable.x, -pPixmap->drawable.y);
- /* XXX MultibufferExpose "knows" the region representation */
- numRects = RegionNumRects(pRegion);
- pBox = RegionRects(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,
- (void *) pMultibuffer->pPixmap);
- }
- /*
- * make the new association
- */
- pMultibuffer = &pMultibuffers->buffers[i];
- ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
- MultibufferDrawableResType,
- (void *) 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,
- (void *) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- return TRUE;
-}
-
-/* Resource delete func for MultibufferDrawableResType */
-/*ARGSUSED*/
-static int
-MultibufferDrawableDelete (value, id)
- void *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)
- void *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)
- void *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)
- void *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, (void *) 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 359fb63aa..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 <nx-X11/X.h>
-#include <nx-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 <nx-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 = (void *) 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;
- RegionInit(&pMBPriv->backBuffer, &box, 1);
- RegionInit(&pMBPriv->subtractRgn, &box, 1);
- RegionNull(&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 = (void *) RegionCreate(0,0);
- if (!pMBWindow->devPrivate.ptr)
- return(0);
- RegionCopy((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,
- (void *) 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);
- RegionSubtract(&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];
-
- RegionDestroy((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;
- RegionInit(&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);
- }
-
- RegionIntersect(&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
- RegionUninit(&reg);
- if (pBSReg)
- RegionDestroy(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
- */
-
- RegionUninit(&pMBPriv->backBuffer);
- RegionUninit(&pMBPriv->subtractRgn);
- RegionUninit(&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 (RegionNumRects(prgn) == 0)
- return;
-
- pDrawable = (DrawablePtr) selectPlane.ptr;
- pGC = GetScratchGC (pDrawable->depth, pScreen);
- if (!pGC)
- return;
-
- prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) *
- sizeof(xRectangle));
- if (!prect)
- {
- FreeScratchGC(pGC);
- return;
- }
-
- value = (XID) bufferNum;
- DoChangeGC(pGC, GCForeground, &value, 0);
- ValidateGC(pDrawable, pGC);
-
- numRects = RegionNumRects(prgn);
- pbox = RegionRects(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)
- RegionUnion(backBuffer, backBuffer,
- &pWin->clipList);
- else
- RegionSubtract(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;
- RegionValidate(pSubtractRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: subtractRgn overlaps");
-#endif
- RegionValidate(pUnionRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: unionRgn overlaps");
-#endif
-
- /* Update backBuffer: subtract must come before union */
- RegionSubtract(&pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pSubtractRgn);
- RegionUnion(&pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pUnionRgn);
-
- /* Paint gained and lost backbuffer areas in select plane */
- RegionNull(&exposed);
- RegionSubtract(&exposed, pSubtractRgn, pUnionRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, FRONT_BUFFER);
-
- RegionSubtract(&exposed, pUnionRgn, pSubtractRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, BACK_BUFFER);
-
- RegionUninit(&exposed);
- RegionEmpty(pSubtractRgn);
- RegionEmpty(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 (! RegionEqual(pOldClipList, &pWin->clipList))
- {
- if (pMBWindow->displayedMultibuffer == BACK_BUFFER)
- {
- pMBPriv->rgnChanged = TRUE;
- RegionAppend(&pMBPriv->subtractRgn, pOldClipList);
- RegionAppend(&pMBPriv->unionRgn, &pWin->clipList);
- }
-
- RegionCopy(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 && !RegionNil(prgn));
-
- /* miWindowExposures munges prgn and other_exposed. */
- if (handleBuffers)
- {
- RegionNull(&tmp_rgn);
- RegionCopy(&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);
- }
-
- RegionUninit(&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. */
- RegionTranslate(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 3d28d3ff3..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 <nx-X11/X.h>
-#include <nx-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 <nx-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 = (void *) 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,
- (void *) 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 = RegionNumRects(pRegion);
- BoxPtr pbox = RegionRects(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.
- */
- RegionTranslate(pWinSize,
- -pWin->drawable.x,
- -pWin->drawable.y);
- RegionIntersect(pExposed, pExposed, pWinSize);
- RegionDestroy(pWinSize);
- MultibufferExpose (pPrevMBBuffer, pExposed);
- RegionDestroy(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;
- RegionInit(&exposedRegion, &box, 1);
- if (pWin->bitGravity != ForgetGravity)
- {
- RegionRec preservedRegion;
- box.x1 = destx;
- box.y1 = desty;
- box.x2 = destx + savewidth;
- box.y2 = desty + saveheight;
- RegionInit(&preservedRegion, &box, 1);
- RegionSubtract(&exposedRegion, &exposedRegion, &preservedRegion);
- RegionUninit(&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,
- (void *) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- if (clear)
- RegionUninit(&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;
-
- RegionInit(&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);
-
- RegionUninit(&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 5c5183e69..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 <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#define _MITMISC_SERVER_
-#include <nx-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/panoramiXSwap.c b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
index 955b81ed1..76346fa34 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c
@@ -30,8 +30,8 @@ Equipment Corporation.
#endif
#include <stdio.h>
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
diff --git a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
index 8078e2bd0..17fe6d6c6 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c
@@ -33,10 +33,10 @@ Equipment Corporation.
#endif
#include <stdio.h>
-#include <nx-X11/X.h>
+#include <X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
-#include <nx-X11/Xproto.h>
+#include <X11/Xproto.h>
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
@@ -1113,7 +1113,7 @@ int PanoramiXCopyArea(ClientPtr client)
FOR_NSCREENS_BACKWARD(j) {
if(pRgn[j]) {
if(srcIsRoot) {
- RegionTranslate(pRgn[j],
+ RegionTranslate(pRgn[j],
panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
}
RegionAppend(&totalReg, pRgn[j]);
diff --git a/nx-X11/programs/Xserver/Xext/sampleEVI.c b/nx-X11/programs/Xserver/Xext/sampleEVI.c
deleted file mode 100644
index 961c108f9..000000000
--- a/nx-X11/programs/Xserver/Xext/sampleEVI.c
+++ /dev/null
@@ -1,121 +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 <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <nx-X11/extensions/XEVIstr.h>
-#include "EVIstruct.h"
-#include "scrnintstr.h"
-
-#include <stdint.h>
-
-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/security.c b/nx-X11/programs/Xserver/Xext/security.c
index ccf80b401..13da54386 100644
--- a/nx-X11/programs/Xserver/Xext/security.c
+++ b/nx-X11/programs/Xserver/Xext/security.c
@@ -60,14 +60,6 @@ in this Software without prior written authorization from The Open Group.
#include <nx-X11/extensions/securstr.h>
#include <assert.h>
#include <stdarg.h>
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <nx-X11/extensions/XLbx.h>
-extern unsigned char LbxReqCode;
-#endif
-#ifdef XAPPGROUP
-#include <nx-X11/extensions/Xagsrv.h>
-#endif
#include <stdio.h> /* for file reading operations */
#include <nx-X11/Xatom.h> /* for XA_STRING */
@@ -1165,10 +1157,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 +1219,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);
}
@@ -1343,22 +1319,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
diff --git a/nx-X11/programs/Xserver/Xext/vidmodeproc.h b/nx-X11/programs/Xserver/Xext/vidmodeproc.h
deleted file mode 100644
index 1f7c6cd04..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 {
- void * ptr;
- int i;
- float f;
-} vidMonitorValue;
-
-void XFree86VidModeExtensionInit(void);
-
-Bool VidModeAvailable(int scrnIndex);
-Bool VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock);
-Bool VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock);
-Bool VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock);
-Bool VidModeDeleteModeline(int scrnIndex, void * 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, void * mode);
-Bool VidModeLockZoom(int scrnIndex, Bool lock);
-Bool VidModeGetMonitor(int scrnIndex, void **monitor);
-int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
-Bool VidModeGetClocks(int scrnIndex, int *Clocks);
-ModeStatus VidModeCheckModeForMonitor(int scrnIndex, void * mode);
-ModeStatus VidModeCheckModeForDriver(int scrnIndex, void * mode);
-void VidModeSetCrtcForMode(int scrnIndex, void * mode);
-Bool VidModeAddModeline(int scrnIndex, void * 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);
-void * VidModeCreateMode(void);
-void VidModeCopyMode(void * modefrom, void * modeto);
-int VidModeGetModeValue(void * mode, int valtyp);
-void VidModeSetModeValue(void * mode, int valtyp, int val);
-vidMonitorValue VidModeGetMonitorValue(void * 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 e353d65ac..ee7d69fc3 100644
--- a/nx-X11/programs/Xserver/Xext/xcmisc.c
+++ b/nx-X11/programs/Xserver/Xext/xcmisc.c
@@ -34,8 +34,8 @@ from The Open Group.
#include <dix-config.h>
#endif
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@@ -44,7 +44,11 @@ from The Open Group.
#include <nx-X11/extensions/xcmiscstr.h>
#include "modinit.h"
+#if HAVE_STDINT_H
#include <stdint.h>
+#elif !defined(UINT32_MAX)
+#define UINT32_MAX 0xffffffffU
+#endif
#if 0
static unsigned char XCMiscCode;
diff --git a/nx-X11/programs/Xserver/Xext/xevie.c b/nx-X11/programs/Xserver/Xext/xevie.c
deleted file mode 100644
index eb38d9223..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/Xeviestr.h>
-#include <nx-X11/Xfuncproto.h>
-#include "input.h"
-#include "inputstr.h"
-#include "windowstr.h"
-#include "cursorstr.h"
-#include <nx-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, void * nulldata,
- void * calldata);
-static void XevieServerGrabStateCallback(CallbackListPtr *pcbl,
- void * nulldata,
- void * calldata);
-
-static Bool XevieAdd(DeviceIntPtr device, void * data);
-static void XevieWrap(DeviceIntPtr device, ProcessInputProc proc);
-static Bool XevieRemove(DeviceIntPtr device, void * 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, void * nulldata,
- void * calldata)
-{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
- ClientPtr client = pci->client;
- if (client->clientState == ClientStateGone
- || client->clientState == ClientStateRetained)
- XevieEnd(client->index);
-}
-
-static void
-XevieServerGrabStateCallback(CallbackListPtr *pcbl, void * nulldata,
- void * 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, void * 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,void * 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= (void *)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/xf86dga.c b/nx-X11/programs/Xserver/Xext/xf86dga.c
deleted file mode 100644
index 074118c18..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/xf86dga.h>
-#include <nx-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 c2b64b048..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/xf86dga.h>
-#include <nx-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*, void *, void *);
-
-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,
- void * nulldata,
- void * 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, (void *)(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 ccf983fae..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 <nx-X11/X.h>
-#include <nx-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 <nx-X11/extensions/xf86mscstr.h>
-#include "swaprep.h"
-#include "xf86.h"
-#include <nx-X11/Xfuncproto.h>
-#include "xf86miscproc.h"
-
-#if 0
-#include <nx-X11/Xtrans/Xtrans.h>
-#include "../os/osdep.h"
-#include <nx-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;
- void * 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;
- void * 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;
- void * 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)) == (void *) 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;
- void * 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)) == (void *) 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 5eefa02a3..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(void **mouse, char **devname);
-int MiscExtGetMouseValue(void * mouse, MiscExtMseValType valtype);
-Bool MiscExtSetMouseValue(void * mouse, MiscExtMseValType valtype, int value);
-Bool MiscExtGetKbdSettings(void **kbd);
-int MiscExtGetKbdValue(void * kbd, MiscExtKbdValType valtype);
-Bool MiscExtSetKbdValue(void * kbd, MiscExtKbdValType valtype, int value);
-int MiscExtSetGrabKeysState(ClientPtr client, int enable);
-void * MiscExtCreateStruct(MiscExtStructType mse_or_kbd);
-void MiscExtDestroyStruct(void * structure, MiscExtStructType mse_or_kbd);
-MiscExtReturn MiscExtApply(void * structure, MiscExtStructType mse_or_kbd);
-Bool MiscExtSetMouseDevice(void * 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 0595343c9..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 <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define _XF86VIDMODE_SERVER_
-#include <nx-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 = (void *) 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(void * 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;
- void * 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;
- void * 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;
- void * 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;
- void * 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;
- void * 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;
- void * 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;
- void * 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;
- void * 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;
- }
-}