aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/Imakefile10
-rw-r--r--nx-X11/programs/Xserver/XTrap/Imakefile27
-rw-r--r--nx-X11/programs/Xserver/XTrap/module/Imakefile26
-rw-r--r--nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c51
-rw-r--r--nx-X11/programs/Xserver/XTrap/xtrapddmi.c188
-rw-r--r--nx-X11/programs/Xserver/XTrap/xtrapdi.c2157
-rw-r--r--nx-X11/programs/Xserver/XTrap/xtrapdiswp.c1010
-rw-r--r--nx-X11/programs/Xserver/XTrap/xtrapditbl.c242
-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
-rw-r--r--nx-X11/programs/Xserver/dix/colormap.c102
-rw-r--r--nx-X11/programs/Xserver/dix/devices.c9
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c66
-rw-r--r--nx-X11/programs/Xserver/dix/dixfonts.c7
-rw-r--r--nx-X11/programs/Xserver/dix/events.c176
-rw-r--r--nx-X11/programs/Xserver/dix/extension.c17
-rw-r--r--nx-X11/programs/Xserver/dix/property.c43
-rw-r--r--nx-X11/programs/Xserver/dix/swaprep.c6
-rw-r--r--nx-X11/programs/Xserver/dix/window.c68
-rw-r--r--nx-X11/programs/Xserver/include/cursorstr.h3
-rw-r--r--nx-X11/programs/Xserver/include/dix.h4
-rw-r--r--nx-X11/programs/Xserver/include/dixstruct.h6
-rw-r--r--nx-X11/programs/Xserver/include/globals.h44
-rw-r--r--nx-X11/programs/Xserver/include/os.h11
-rw-r--r--nx-X11/programs/Xserver/include/propertyst.h8
-rw-r--r--nx-X11/programs/Xserver/include/swaprep.h11
-rw-r--r--nx-X11/programs/Xserver/include/windowstr.h4
-rw-r--r--nx-X11/programs/Xserver/mi/Imakefile4
-rw-r--r--nx-X11/programs/Xserver/mi/miinitext.c155
-rw-r--r--nx-X11/programs/Xserver/os/access.c4
-rw-r--r--nx-X11/programs/Xserver/os/connection.c174
-rw-r--r--nx-X11/programs/Xserver/os/io.c80
-rw-r--r--nx-X11/programs/Xserver/os/osdep.h26
-rw-r--r--nx-X11/programs/Xserver/os/utils.c35
60 files changed, 42 insertions, 15837 deletions
diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile
index a2a3f7ced..ca9a6b88d 100644
--- a/nx-X11/programs/Xserver/Imakefile
+++ b/nx-X11/programs/Xserver/Imakefile
@@ -105,10 +105,6 @@ INSTPGMFLAGS =
#if BuildRECORD || BuildRECORDlib
RECORDDIR = record
#endif
-#if BuildXTrap
- XTRAPEXT = XTrap/LibraryTargetName(xtrap)
- XTRAPDIR = XTrap
-#endif
#ifdef SiteExtensionLibs
SITEEXTS = SiteExtensionLibs
#endif
@@ -153,7 +149,7 @@ INSTPGMFLAGS =
#if DoLoadableServer
EXTENSIONS = $(COMPOSITELIB) $(DAMAGELIB) $(DAMAGE) $(FIXESLIB) $(CW) \
$(OTHEREXTS) $(RANDRLIB) $(RENDERLIB)
- LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT) $(XTRAPEXT)
+ LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT)
MISCEXT = Xext/LibraryTargetName(ext)
OTHEREXTS = Xext/LibraryTargetName(exts) $(XKBEXT) $(XINPUTEXT) \
$(SITEEXTS)
@@ -161,11 +157,11 @@ INSTPGMFLAGS =
EXTENSIONS = $(COMPOSITELIB) $(DAMAGELIB) $(DAMAGE) $(FIXESLIB) $(CW) \
$(OTHEREXTS) $(GLXEXT) $(RANDRLIB) $(RENDERLIB)
OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \
- $(DBEEXT) $(RECORDEXT) $(SITEEXTS) $(XTRAPEXT)
+ $(DBEEXT) $(RECORDEXT) $(SITEEXTS)
#endif
EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(GLXDIR) \
$(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) \
- $(RANDRDIR) $(RENDERDIR) $(XTRAPDIR) $(XPCONFIGDIR) \
+ $(RANDRDIR) $(RENDERDIR) $(XPCONFIGDIR) \
$(FIXESDIR) $(DAMAGEDIR) $(CWDIR) $(COMPOSITEDIR)
OS = os/LibraryTargetName(os) $(DEPXAUTHLIB)
BSDEMUL = $(DEPXBSDLIB)
diff --git a/nx-X11/programs/Xserver/XTrap/Imakefile b/nx-X11/programs/Xserver/XTrap/Imakefile
deleted file mode 100644
index c61712f1d..000000000
--- a/nx-X11/programs/Xserver/XTrap/Imakefile
+++ /dev/null
@@ -1,27 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/XTrap/Imakefile,v 1.1 2001/11/02 23:29:29 dawes Exp $
-
-#if DoLoadableServer
-#define IHaveSubdirs
-#endif
-
-#include <Server.tmpl>
-
-#if DoLoadableServer
- SUBDIRS = module
-#endif
- SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c
- OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o
- INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext `pkg-config --cflags-only-I pixman-1`
-
-NormalLibraryTarget(xtrap,$(OBJS))
-LintLibraryTarget(xtrap,$(SRCS))
-NormalLintTarget($(SRCS))
-
-NormalLibraryObjectRule()
-
-#if DoLoadableServer
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-#endif
-
-DependTarget()
diff --git a/nx-X11/programs/Xserver/XTrap/module/Imakefile b/nx-X11/programs/Xserver/XTrap/module/Imakefile
deleted file mode 100644
index 8f8a77ba2..000000000
--- a/nx-X11/programs/Xserver/XTrap/module/Imakefile
+++ /dev/null
@@ -1,26 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/XTrap/module/Imakefile,v 1.2 2002/01/23 03:31:40 dawes Exp $
-
-#define IHaveModules
-#include <Server.tmpl>
-
- SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c xf86XTrapModule.c
- OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o xf86XTrapModule.o
- INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \
- -I$(SERVERSRC)/Xext
- DEFINES = -DEXTMODULE
-
-LinkSourceFile(xf86XTrapModule.c,..)
-LinkSourceFile(xtrapddmi.c,..)
-LinkSourceFile(xtrapdi.c,..)
-LinkSourceFile(xtrapdiswp.c,..)
-LinkSourceFile(xtrapditbl.c,..)
-
-ModuleObjectRule()
-LibraryModuleTarget(xtrap,$(OBJS))
-
-InstallLibraryModule(xtrap,$(MODULEDIR),extensions)
-
-DependTarget()
-
-InstallDriverSDKLibraryModule(xtrap,$(DRIVERSDKMODULEDIR),extensions)
-
diff --git a/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c b/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c
deleted file mode 100644
index a3e1d08c6..000000000
--- a/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86$ */
-/* This is the xf86 module code for the DEC_XTRAP extension.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xf86Module.h"
-
-#include <nx-X11/extensions/xtrapdi.h>
-
-extern void DEC_XTRAPInit(INITARGS);
-
-#ifdef XFree86LOADER
-
-static MODULESETUPPROTO(xtrapSetup);
-
-ExtensionModule xtrapExt =
-{
- DEC_XTRAPInit,
- XTrapExtName,
- NULL,
- NULL,
- NULL
-};
-
-static XF86ModuleVersionInfo xtrapVersRec =
-{
- "xtrap",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION, /* needs the server extension ABI */
- ABI_EXTENSION_VERSION,
- MOD_CLASS_EXTENSION,
- {0,0,0,0}
-};
-
-XF86ModuleData xtrapModuleData = { &xtrapVersRec, xtrapSetup, NULL };
-
-static void *
-xtrapSetup(void * module, void * opts, int *errmaj, int *errmin) {
- LoadExtension(&xtrapExt, FALSE);
- /* Need a non-NULL return value to indicate success */
- return (void *)1;
-}
-
-#endif /* XFree86LOADER */
diff --git a/nx-X11/programs/Xserver/XTrap/xtrapddmi.c b/nx-X11/programs/Xserver/XTrap/xtrapddmi.c
deleted file mode 100644
index 1b4be39cd..000000000
--- a/nx-X11/programs/Xserver/XTrap/xtrapddmi.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $XFree86: xc/programs/Xserver/XTrap/xtrapddmi.c,v 1.1 2001/11/02 23:29:29 dawes Exp $ */
-/*****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-*****************************************************************************/
-/*
- * ABSTRACT:
- *
- * This module is the platform-specific but conditionally independent
- * code for the XTrap extension (usually I/O or platform setup).
- * This is shared code and is subject to change only by team approval.
- *
- * CONTRIBUTORS:
- *
- * Dick Annicchiarico
- * Robert Chesler
- * Gene Durso
- * Marc Evans
- * Alan Jamison
- * Mark Henry
- * Ken Miller
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef EXTMODULE
-#include <errno.h>
-#include <nx-X11/Xos.h>
-#ifdef PC
-# include "fcntl.h"
-# include "io.h"
-# define O_NDELAY 0L
-#endif
-#else
-#include "xf86_ansic.h"
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <nx-X11/X.h> /* From library include environment */
-#include "input.h" /* From server include env. (must be before Xlib.h!) */
-#ifdef PC
-# include "scrintst.h" /* Screen struct */
-# include "extnsist.h"
-#else
-# include "extnsionst.h" /* Server ExtensionEntry definitions */
-# include "scrnintstr.h" /* Screen struct */
-#endif
-
-#include <nx-X11/extensions/xtrapdi.h>
-#include <nx-X11/extensions/xtrapddmi.h>
-#include <nx-X11/extensions/xtrapproto.h>
-
-extern int XETrapErrorBase;
-extern xXTrapGetAvailReply XETrap_avail;
-extern DevicePtr XETrapKbdDev;
-extern DevicePtr XETrapPtrDev;
-
-/*
- * DESCRIPTION:
- *
- * This function performs the platform specific setup for server
- * extension implementations.
- */
-void XETrapPlatformSetup()
-{
-}
-
-
-#if !defined _XINPUT
-/*
- * DESCRIPTION:
- *
- * This routine processes the simulation of some input event.
- *
- */
-int XETrapSimulateXEvent(register xXTrapInputReq *request,
- register ClientPtr client)
-{
- ScreenPtr pScr = NULL;
- int status = Success;
- xEvent xev;
- register int x = request->input.x;
- register int y = request->input.y;
- DevicePtr keydev = LookupKeyboardDevice();
- DevicePtr ptrdev = LookupPointerDevice();
-
- if (request->input.screen < screenInfo.numScreens)
- {
- pScr = screenInfo.screens[request->input.screen];
- }
- else
- { /* Trying to play bogus events to this WS! */
-#ifdef VERBOSE
- ErrorF("%s: Trying to send events to screen %d!\n", XTrapExtName,
- request->input.screen);
-#endif
- status = XETrapErrorBase + BadScreen;
- }
- /* Fill in the event structure with the information
- * Note: root, event, child, eventX, eventY, state, and sameScreen
- * are all updated by FixUpEventFromWindow() when the events
- * are delivered via DeliverDeviceEvents() or whatever. XTrap
- * needs to only concern itself with type, detail, time, rootX,
- * and rootY.
- */
- if (status == Success)
- {
- xev.u.u.type = request->input.type;
- xev.u.u.detail = request->input.detail;
- xev.u.keyButtonPointer.time = GetTimeInMillis();
- xev.u.keyButtonPointer.rootX = x;
- xev.u.keyButtonPointer.rootY = y;
-
- if (request->input.type == MotionNotify)
- { /* Set new cursor position on screen */
- XETrap_avail.data.cur_x = x;
- XETrap_avail.data.cur_y = y;
- NewCurrentScreen (pScr, x, y); /* fix from amnonc@mercury.co.il */
- if (!(*pScr->SetCursorPosition)(pScr, x, y, xFalse))
- {
- status = BadImplementation;
- }
- }
- }
- if (status == Success)
- {
- switch(request->input.type)
- { /* Now process the event appropriately */
- case KeyPress:
- case KeyRelease:
- (*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L);
- break;
- case MotionNotify:
- case ButtonPress:
- case ButtonRelease:
- (*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L);
- break;
- default:
- status = BadValue;
- break;
- }
- }
- return(status);
-}
-#endif /* _XINPUT */
-
-#if defined vms && !defined LINKED_IN
-/* Used by swapping code not visible from VMS (from main.c) */
-#ifndef BLADE
-void
-NotImplemented()
-{
- FatalError("Not implemented");
-}
-#endif
-
-int
-#ifdef __STDC__
-ProcBadRequest( ClientPtr client)
-#else
-ProcBadRequest(client)
- ClientPtr client;
-#endif
-{
- return (BadRequest);
-}
-
-#endif /* vms && ! LINKED_IN */
diff --git a/nx-X11/programs/Xserver/XTrap/xtrapdi.c b/nx-X11/programs/Xserver/XTrap/xtrapdi.c
deleted file mode 100644
index 987d54e4f..000000000
--- a/nx-X11/programs/Xserver/XTrap/xtrapdi.c
+++ /dev/null
@@ -1,2157 +0,0 @@
-/* $XdotOrg: xc/programs/Xserver/XTrap/xtrapdi.c,v 1.5 2005/07/03 08:53:36 daniels Exp $ */
-/* $XFree86: xc/programs/Xserver/XTrap/xtrapdi.c,v 1.6tsi Exp $ */
-/*****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
-
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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.
-
-*****************************************************************************/
-/*
- * ABSTRACT:
- *
- * This module is the main module for extension initialization and setup.
- * It is called by the server and by clients using the extension.
- * This is shared code and is subject to change only by team approval.
- *
- * CONTRIBUTORS:
- *
- * Dick Annicchiarico
- * Robert Chesler
- * Gene Durso
- * Marc Evans
- * Alan Jamison
- * Mark Henry
- * Ken Miller
- *
- * CHANGES:
- *
- * Robert Chesler - grab-impreviousness patch to improve grab behavior
- * Robert Chesler - add client arg to swapping routines for X11R6 port
- *
- */
-
-/*-----------------*
- * Include Files *
- *-----------------*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef EXTMODULE
-#include <stdio.h>
-#include <errno.h>
-#include <nx-X11/Xos.h>
-#else
-#include "xf86_ansic.h"
-#endif
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "input.h" /* Server DevicePtr definitions */
-#include "misc.h" /* Server swapping macros */
-#include "dixstruct.h" /* Server ClientRec definitions */
-#include "resource.h" /* Used with the MakeAtom call */
-#ifdef PC
-# include "scrintst.h" /* Screen struct */
-# include "extnsist.h"
-#else
-# include "extnsionst.h" /* Server ExtensionEntry definitions */
-# include "scrnintstr.h" /* Screen struct */
-#endif
-#include "pixmapstr.h" /* DrawableRec */
-#include "windowstr.h" /* Drawable Lookup structures */
-#include <nx-X11/extensions/xtrapdi.h>
-#include <nx-X11/extensions/xtrapddmi.h>
-#include <nx-X11/extensions/xtrapproto.h>
-#include "colormapst.h"
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#include "cursor.h"
-#endif
-
-
-/*----------------------------*
- * Global Data Declarations *
- *----------------------------*/
-
-DevicePtr XETrapKbdDev = NULL;
-DevicePtr XETrapPtrDev = NULL;
-int XETrapErrorBase = 0L;
-xXTrapGetAvailReply XETrap_avail; /* What's available to clients */
-
-globalref int_function XETrapDispatchVector[10L]; /* Vector of XTrap Rtns */
-globalref int_function XETSwDispatchVector[10L]; /* Swapped XTrap Rtns */
-
-globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */
- /* The "real" EventVector (XTrap creates it till events
- * truly become vectored
- */
-#ifndef VECTORED_EVENTS
-globalref int_function EventProcVector[XETrapCoreEvents];
-#else
-extern WindowPtr GetCurrentRootWindow();
-globalref int_function EventProcVector[128L];
-#endif
-static int_function keybd_process_inp = NULL; /* Used for VECTORED_EVENTS */
- /* The "shadowed" Event Vector */
-globalref int_function XETrapEventProcVector[XETrapCoreEvents];
-
-globalref void_function XETSwProcVector[256L];/* Vector of Req swapping rtns */
-
-/* This macro returns a true/false indicator based on whether it changes the
- * environment state bits local to the server extension. This is based on the
- * idea that if a valid flag is set and the corresponding data bit is not in
- * the same state as desired, then true is returned, otherwise false is
- * returned.
- */
-#define _CheckChangeBit(valid,data,local,bit) \
- (BitIsFalse(valid,bit) ? 0L : \
- (((BitIsTrue(data,bit) && BitIsTrue(local,bit)) || \
- (BitIsFalse(data,bit) && BitIsFalse(local,bit))) ? 0L : \
- (BitToggle(local,bit), 1L)))
-
-/* This macro is designed to return the number of elements in an
- * automatically allocated array.
- */
-#ifndef ASIZE
-#define ASIZE(array) (sizeof(array)/sizeof(array[0L]))
-#endif
-
-/* This macro is designed to return the number of long words beyond
- * XETrapMinRepSize contained in a data structure.
- */
-#ifndef XEXTRA
-#define XEXTRA(s) \
- ((sizeof(s)+(sizeof(CARD32)-1L)-XETrapMinRepSize)/sizeof(CARD32))
-#endif
-
-/* Static Declarations known to XTrap Only
- * All XTrap clients refer to these single copies!
- */
-/* This carries all of the information XTrap uses for internal information */
-static XETrapEnv *XETenv[MAXCLIENTS] = {NULL};
-#ifndef RESTYPE
-#define RESTYPE unsigned long
-#endif
-static RESTYPE XETrapClass = 0L; /* Resource class for this extension */
-static RESTYPE XETrapType = 0L; /* Resource type for this extension */
-static Bool gate_closed = False; /* The global "gatekeeper" */
-static Bool key_ignore = False; /* The global "keymaster" */
-static Bool ignore_grabs = False;
-static CARD8 next_key = XEKeyIsClear; /* Echo, Clear, or Other */
-#ifdef VECTORED_EVENTS
-static INT16 current_screen = -1L; /* Current screen for events */
-#endif
-static INT16 vectored_requests[256L] = {0L}; /* cnt of vectoring clients */
-static INT16 vectored_events[KeyPress+MotionNotify] = {0L};
-typedef struct _client_list
-{
- struct _client_list *next;
- ClientPtr client;
-} ClientList;
-static ClientList io_clients; /* Linked-list of clients currently doing I/O */
-static ClientList stats_clients; /* Linked-list of clients collecting stats */
-static ClientList cmd_clients; /* Linked-list of clients using command key */
-
-/*----------------------------*
- * Forward Declarations
- *----------------------------*/
-static void _SwapProc (int (**f1 )(), int (**f2 )());
-static void sXETrapEvent (xETrapDataEvent *from , xETrapDataEvent *to );
-static int add_accelerator_node (ClientPtr client , ClientList *accel );
-static void remove_accelerator_node (ClientPtr client , ClientList *accel );
-static void update_protocol (xXTrapGetReq *reqptr , ClientPtr client );
-#ifdef COLOR_REPLIES
-static void GetSendColorRep (ClientPtr client , xResourceReq *req );
-static void GetSendNamedColorRep (ClientPtr client , xResourceReq *req );
-static void GetSendColorCellsRep (ClientPtr client , xResourceReq *req );
-static void GetSendColorPlanesRep (ClientPtr client , xResourceReq *req );
-#endif
-
-/*
- * DESCRIPTION:
- *
- * This routine is called by the server when a given client
- * goes away (as identified by the first argument). All
- * memory allocations, misc. values specific to a given
- * client would be reset here.
- *
- */
-int XETrapDestroyEnv(void * value, XID id)
-{
- xXTrapReq request;
- XETrapEnv *penv = XETenv[(long)value];
-
- XETrapReset(&request,penv->client);
- /* Free any memory malloc'd for a particular client here */
- /* In case stop I/O wasn't received for this client */
- if (penv->stats)
- { /* Remove from client accelerator list */
- remove_accelerator_node(penv->client, &stats_clients);
- Xfree(penv->stats); /* Free the stats buckets */
- }
- if (cmd_clients.next == NULL)
- { /* No more command key clients! Let's reset the gate */
- gate_closed = False;
- key_ignore = False;
- next_key = XEKeyIsClear;
- }
-
-#ifdef VECTORED_EVENTS
- current_screen = -1L; /* Invalidate current screen */
-#endif
-
-#ifdef VERBOSE
- ErrorF("%s: Client '%d' Disconnected\n", XTrapExtName,
- penv->client->index);
-#endif
-
- Xfree(penv);
- XETenv[(long)value] = NULL;
-
- return 0;
-}
-
-/*
- * DESCRIPTION:
- *
- * This routine is called by the server when the last client
- * (the session manager in most cases) goes away. This is server
- * reset. When the server comes back up, this extension will not
- * be loaded unless this routine makes the proper arrangements.
- *
- * The real concern here is to unload the extension
- * and possibly make arragements to be called upon
- * server restart.
- *
- */
-void XETrapCloseDown(ExtensionEntry *extEntry)
-{
- long i;
-
- for (i=0L; i<MAXCLIENTS; i++)
- {
- if (XETenv[i] != NULL)
- {
- XETrapDestroyEnv((void *)i,0L);
- }
- }
- ignore_grabs = False;
- return;
-}
-
-/*
- *
- * DESCRIPTION:
- *
- * This routine has been created because of the initialization
- * order that X uses, such that extensions are initialized before
- * devices. This means that this extension must perform a second
- * level of initialization to obtain the device references at some
- * point after they have been initialized. It is assumed that when
- * a client establishes communication with the extension that the
- * devices havae been initialized, and therefore this function can
- * obtain the information it needs.
- *
- * In obtaining the information, this function also places its own
- * functions in place of the *standard* functions. The original
- * functions are retained for vectoring purposes.
- */
-
-Bool XETrapRedirectDevices()
-{
- Bool retval = True;
-
- /* Do we need to redirect the keyboard device? */
- if (XETrapKbdDev == NULL)
- {
- if ((XETrapKbdDev = LookupKeyboardDevice()) == NULL)
- {
- retval = False;
- }
- else
- {
- EventProcVector[KeyPress] =
- (int_function)XETrapKbdDev->realInputProc;
- EventProcVector[KeyRelease] =
- (int_function)XETrapKbdDev->realInputProc;
- }
-#ifdef VECTORED_EVENTS
- keybd_process_inp = EventProcVector[KeyPress];
- EventProcVector[KeyPress] = EventProcVector[KeyRelease] = NULL;
- XETrapEventProcVector[KeyPress] = XETrapEventVector;
- XETrapEventProcVector[KeyRelease] = XETrapEventVector;
-#else /* !VECTORED_EVENTS */
- XETrapEventProcVector[KeyPress] = XETrapKeyboard;
- XETrapEventProcVector[KeyRelease] = XETrapKeyboard;
-#endif /* !VECTORED_EVENTS */
- }
- /* Do we need to redirect the pointer device? */
-#ifndef VECTORED_EVENTS
- if (XETrapPtrDev == NULL)
- {
- if ((XETrapPtrDev = LookupPointerDevice()) == 0L)
- {
- retval = False;
- }
- else
- {
- EventProcVector[ButtonPress] =
- (int_function)XETrapPtrDev->realInputProc;
- EventProcVector[ButtonRelease] =
- (int_function)XETrapPtrDev->realInputProc;
- EventProcVector[MotionNotify] =
- (int_function)XETrapPtrDev->realInputProc;
- }
- XETrapEventProcVector[ButtonPress] = XETrapPointer;
- XETrapEventProcVector[ButtonRelease] = XETrapPointer;
- XETrapEventProcVector[MotionNotify] = XETrapPointer;
- }
-#endif /* !VECTORED_EVENTS */
- return(retval);
-}
-
-/*
- *
- * DESCRIPTION:
- *
- * This routine is the main entry point for the Xtrap extension. It is
- * called by the server to inititalize the Xtrap extension. Once the
- * extension is initialized, life is controlled by the XtrapDispatch
- * routine by the requests it will handle.
- *
- * Initializes all the XTrap data structures with the proper
- * addresses of defined routines that will help control the extension.
- * It is vital that the extension state be kept accurate so that only
- * one call to this routine be made.
- *
- */
-
-void DEC_XTRAPInit()
-{
- register ExtensionEntry *extEntry;
- unsigned int i;
- Atom a;
-
- /* Make the extension known to the server. Must be done every time
- * DEC_XTRAPInit is called, else server will think it failed.
- */
- if ((extEntry = AddExtension(XTrapExtName,XETrapNumEvents,
- XETrapNumErrors,XETrapDispatch,sXETrapDispatch,XETrapCloseDown
- ,StandardMinorOpcode)) == NULL)
- {
- ErrorF("%s: AddExtension Failed!\n", XTrapExtName);
- return;
- }
-#ifdef VERBOSE
- ErrorF("%s: AddExtension assigned Major Opcode '%d'\n",
- XTrapExtName, extEntry->base);
-#endif
- XETrap_avail.data.major_opcode = extEntry->base;
- XETrapErrorBase = extEntry->errorBase;
- XETrap_avail.data.event_base = extEntry->eventBase;
-
- /* Set up our swapped reply vector */
- ReplySwapVector[XETrap_avail.data.major_opcode] =
- (void_function) sReplyXTrapDispatch;
-
- /* Set up our swapped event vector */
- EventSwapVector[extEntry->eventBase + XETrapData] =
- (EventSwapPtr) sXETrapEvent;
-
- /* make an atom saying that the extension is present. The
- * adding of the resource occurs during XETrapCreateEnv().
- */
- if ((a = MakeAtom(XTrapExtName,strlen(XTrapExtName),1L)) == None ||
- (XETrapType = CreateNewResourceType(XETrapDestroyEnv)) == 0L)
- {
- ErrorF("%s: Setup can't create new resource type (%d,%d,%d)\n",
- XTrapExtName, (int)a,(int)XETrapClass,(int)XETrapType);
- return;
- }
- /* initialize the GetAvailable info reply here */
- XETrap_avail.hdr.type = X_Reply;
- XETrap_avail.hdr.length = XEXTRA(xXTrapGetAvailReply);
- XETrap_avail.data.xtrap_release = XETrapRelease;
- XETrap_avail.data.xtrap_version = XETrapVersion;
- XETrap_avail.data.xtrap_revision = XETrapRevision;
- XETrap_avail.data.pf_ident = XETrapPlatform;
- XETrap_avail.data.max_pkt_size = 0xFFFF; /* very large number */
- for (i=0L; i<ASIZE(XETrap_avail.data.valid); i++)
- {
- XETrap_avail.data.valid[i] = 0L; /* Clear bits initially */
- }
- BitTrue(XETrap_avail.data.valid,XETrapTimestamp);
- BitTrue(XETrap_avail.data.valid,XETrapCmd);
- BitTrue(XETrap_avail.data.valid,XETrapCmdKeyMod);
- BitTrue(XETrap_avail.data.valid,XETrapRequest);
- BitTrue(XETrap_avail.data.valid,XETrapEvent);
- BitTrue(XETrap_avail.data.valid,XETrapMaxPacket);
- BitTrue(XETrap_avail.data.valid,XETrapStatistics);
- BitTrue(XETrap_avail.data.valid,XETrapWinXY);
- /* Not yet implemented */
- BitFalse(XETrap_avail.data.valid,XETrapCursor);
-#ifndef _XINPUT
- BitFalse(XETrap_avail.data.valid,XETrapXInput);
-#else
- BitTrue(XETrap_avail.data.valid,XETrapXInput);
-#endif
-#ifndef VECTORED_EVENTS
- BitFalse(XETrap_avail.data.valid,XETrapVectorEvents);
-#else
- BitTrue(XETrap_avail.data.valid,XETrapVectorEvents);
-#endif /* VECTORED_EVENTS */
-#ifndef COLOR_REPLIES
- BitFalse(XETrap_avail.data.valid,XETrapColorReplies);
-#else
- BitTrue(XETrap_avail.data.valid,XETrapColorReplies);
-#endif /* COLOR_REPLIES */
- BitTrue(XETrap_avail.data.valid,XETrapGrabServer);
- /* initialize multi-client accelerator lists */
- io_clients.next = NULL;
- stats_clients.next = NULL;
- cmd_clients.next = NULL;
- for (i=0L; i<256L; i++)
- {
- vectored_requests[i] = 0L;
- }
- for (i=KeyPress; i<=MotionNotify; i++)
- {
- vectored_events[i] = 0L;
- }
- gate_closed = False;
- key_ignore = False;
- next_key = XEKeyIsClear;
-
- XETrapPlatformSetup();
- /* Initialize any local memory we use */
- for (i=0L; i<ASIZE(EventProcVector); i++)
- {
- EventProcVector[i] = NULL;
-#ifndef VECTORED_EVENTS
- XETrapEventProcVector[i] = NULL;
-#else
- XETrapEventProcVector[i] = XETrapEventVector;
-#endif
- }
- XETrapKbdDev = NULL;
- XETrapPtrDev = NULL;
- for (i=0L; i<ASIZE(XETrapProcVector); i++)
- {
- XETrapProcVector[i] = XETrapRequestVector;
- }
- for (i=128L; i<=255L; i++)
- { /* Extension "swapped" requests are not implemented */
- XETSwProcVector[i] = NotImplemented;
- }
-#ifdef VERBOSE
- ErrorF("%s: Vers. %d.%d-%d successfully loaded\n", XTrapExtName,
- XETrap_avail.data.xtrap_release,
- XETrap_avail.data.xtrap_version,
- XETrap_avail.data.xtrap_revision);
-#endif
-
- return;
-}
-
-/*
- * DESCRIPTION:
- *
- * This procedure is called upon dispatch to allocate an
- * environment structure for a new XTrap client. The XETenv[]
- * entry is allocated and initialized with default values.
- * XETrapDestroyEnv() is responsible for deallocating this memory
- * upon client termination.
- *
- * Note: the status of this routine is returned to the caller of
- * the Dispatch routine which will in turn SendErrorToClient if
- * necessary.
- *
- */
-
-int XETrapCreateEnv(ClientPtr client)
-{
- XETrapEnv *penv = NULL;
- int status = Success;
-
- if (client->index > MAXCLIENTS)
- {
- status = BadImplementation;
- }
- else if ((XETenv[client->index] = (XETrapEnv *)Xcalloc(sizeof(XETrapEnv)))
- == NULL)
- {
- status = BadAlloc;
- }
- if (status == Success)
- {
- penv = XETenv[client->index];
- penv->client = client;
- penv->protocol = 31; /* default to backwards compatibility */
- /* prep for client's departure (for memory dealloc, cleanup) */
- AddResource(FakeClientID(client->index),XETrapType,
- (void *)(long)(client->index));
- if (XETrapRedirectDevices() == False)
- {
- status = XETrapErrorBase + BadDevices;
- }
- /* Initialize the current state */
- if (status == Success)
- {
- status = XETrapReset(NULL, penv->client);
- }
- }
-
-#ifdef VECTORED_EVENTS
- current_screen = -1L; /* Invalidate current screen */
-#endif
-
-#ifdef VERBOSE
- if (status == Success)
- {
- ErrorF("%s: Client '%d' Connection Accepted\n", XTrapExtName,
- penv->client->index);
- }
-#endif
-
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This procedure is defined for the call to AddExtension()
- * in which it is expected to be a parameter of the call.
- *
- * This routine will be called by the server dispatcher
- * when a client makes a request that is handled
- * by the extension and the byte ordering of the client is the
- * SAME as that of the extension.
- *
- * Note: the status of the requests is returned to the caller of
- * the Dispatch routine which will in turn SendErrorToClient if
- * necessary.
- */
-
-int XETrapDispatch(ClientPtr client)
-{
-
- REQUEST(xXTrapReq);
- register int status = Success;
-
- REQUEST_AT_LEAST_SIZE(xXTrapReq);
-
- /* Have we seen this client before? */
- if (XETenv[client->index] == NULL)
- {
- status = XETrapCreateEnv(client);
- }
- /* Do we have a valid request? */
- if (status == Success)
- {
- if (stuff->minor_opcode < ASIZE(XETrapDispatchVector))
- {
- /* Then vector to the pointed to function */
- status =
- (*(XETrapDispatchVector[stuff->minor_opcode]))(stuff,client);
- }
- else
- {
- status = BadRequest;
- }
- }
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This procedure is defined for the call to AddExtension()
- * in which it is expected to be a parameter of the call.
- *
- * This routine would ordinarily be called by the server
- * dispatcher when a client makes a request that is handled
- * by the extension and the byte ordering of the client is
- * DIFFERENT than that of the extension.
- */
-
-int sXETrapDispatch(ClientPtr client)
-{
-
- REQUEST(xXTrapReq);
- register int status = Success;
-
- REQUEST_AT_LEAST_SIZE(xXTrapReq);
-
- /* Have we seen this client before? */
- if (XETenv[client->index] == NULL)
- {
- status = XETrapCreateEnv(client);
- }
- /* Do we have a valid request? */
- if (status == Success)
- {
- if (stuff->minor_opcode < ASIZE(XETSwDispatchVector))
- {
- /* Then vector to the pointed to function */
- status =
- (*(XETSwDispatchVector[stuff->minor_opcode]))(stuff,client);
- }
- else
- {
- status = BadRequest;
- }
- }
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This routine will place the extension in a steady and known
- * state. Any current state will be reset. This is called either
- * by a client request (dispatched) or when a new client environment
- * is created.
- *
- */
-int XETrapReset(xXTrapReq *request, ClientPtr client)
-{
- static xXTrapConfigReq DummyReq;
- register int i;
- register int status = Success;
- XETrapEnv *penv = XETenv[client->index];
-
- /* in case any i/o's pending */
- (void)XETrapStopTrap((xXTrapReq *)NULL, client);
- penv->cur.hdr.type = X_Reply;
- penv->cur.hdr.length = XEXTRA(xXTrapGetCurReply);
- /* Fill in a dummy config request to clear all elements */
- for (i=0L; i<ASIZE(DummyReq.config_flags_valid); i++)
- {
- DummyReq.config_flags_valid[i] = 0xFFL; /* set all the valid flags */
- DummyReq.config_flags_data[i] = 0L; /* clear all data flags */
- }
- /* Don't reset grab server arbitrarily, it must be explicitly
- * de-configured.
- */
- BitSet(DummyReq.config_flags_data, XETrapGrabServer, ignore_grabs);
- for (i=0L; i< ASIZE(DummyReq.config_flags_req); i++)
- {
- DummyReq.config_flags_req[i] = 0xFF; /* Clear all protocol requests */
- }
- for (i=0L; i< ASIZE(DummyReq.config_flags_event); i++)
- {
- DummyReq.config_flags_event[i] = 0xFF; /* Clear all protocol events */
- }
- /* Call config routine to clear all configurable fields */
- status = XETrapConfig(&DummyReq, client);
- /* reset the environment */
- for (i=0L; i<ASIZE(penv->cur.data_state_flags); i++)
- {
- penv->cur.data_state_flags[i] = 0L; /* Clear all env flags */
- }
- penv->cur.data_config_max_pkt_size = XETrap_avail.data.max_pkt_size;
-
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sends a reply back to the requesting client indicating
- * the available states of the extension can be configured for.
- */
-int XETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
-{
- XETrapEnv *penv = XETenv[client->index];
- update_protocol(request, client);
- /* Initialize the reply as needed */
- XETrap_avail.data.xtrap_protocol = penv->protocol;
- XETrap_avail.hdr.detail = XETrap_GetAvailable;
- XETrap_avail.hdr.sequenceNumber = client->sequence;
- WriteReplyToClient(client, sizeof(xXTrapGetAvailReply), &XETrap_avail);
- return(Success);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sends a reply back to the requesting client indicating
- * the current state of the extension.
- */
-int XETrapGetCurrent(xXTrapReq *request, ClientPtr client)
-{
- XETrapEnv *penv = XETenv[client->index];
- int rep_size = (penv->protocol == 31 ? 284 : sz_xXTrapGetCurReply);
- penv->cur.hdr.length = (rep_size - 32L) / SIZEOF(CARD32);
-
- /* Initialize the reply as needed */
- penv->cur.hdr.detail = XETrap_GetCurrent;
- penv->cur.hdr.sequenceNumber = client->sequence;
- WriteReplyToClient(client, rep_size, &(penv->cur));
-
- return(Success);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sends a reply back to the requesting client dumping
- * statistics (counts) of requests and events. If stat's isn't
- * configured, return failure.
- */
-int XETrapGetStatistics(xXTrapReq *request, ClientPtr client)
-{
- int status = Success;
- XETrapEnv *penv = XETenv[client->index];
-
- if ((BitIsTrue(penv->cur.data_config_flags_data, XETrapStatistics)) &&
- (penv->stats))
- {
- /* Initialize the reply as needed */
- int rep_size = sizeof(xXTrapGetStatsReply);
- penv->stats->detail = XETrap_GetStatistics;
- penv->stats->sequenceNumber = client->sequence;
- if (penv->protocol == 31)
- {
- xXTrapGetStatsReply rep_stats;
- rep_stats = *penv->stats;
-#ifndef VECTORED_EVENTS
- rep_size = 1060;
-#else
- rep_size = 1544;
-#endif
- rep_stats.length = (rep_size - 32L) / SIZEOF(CARD32);
- /*
- * Now we need to shift the data *into* the header area
- * for bug compatibility.
- */
- memcpy(&(rep_stats.pad0),&(penv->stats->data),
- sizeof(XETrapGetStatsRep));
- WriteReplyToClient(client, rep_size, &rep_stats);
- }
- else
- {
- WriteReplyToClient(client, rep_size, penv->stats);
- }
- }
- else
- {
- status = XETrapErrorBase + BadStatistics;
- }
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function is dispatched when a client requests the extension to
- * be configured in some manner.
- */
-int XETrapConfig(xXTrapConfigReq *request, ClientPtr client)
-{
- UByteP vflags = request->config_flags_valid;
- UByteP dflags = request->config_flags_data;
- UByteP req_flags = request->config_flags_req;
- UByteP event_flags = request->config_flags_event;
- XETrapEnv *penv = XETenv[client->index];
- UByteP bit_flags = penv->cur.data_config_flags_data;
- int status = Success;
- CARD32 i = 0L;
-
- /* Check events and swap if desired */
- if (BitIsTrue(vflags,XETrapEvent))
- { /* Loop through all of the events */
- for (i=0L; i<ASIZE(EventProcVector); i++)
- {
- if (BitIsTrue(event_flags,i) && /* Do we care about this one? */
- (BitValue(dflags,XETrapEvent) ^ /* Exclusive Or */
- (BitValue(penv->cur.data_config_flags_event,i))))
- { /* At this point we *know* there's a change. The
- * only question remaining is are there any more
- * clients interested in this specific event. If
- * so, *don't* swap this process!
- */
- if (BitIsTrue(dflags,XETrapEvent))
- { /* Client wants the XTrap rtn */
- if (++(vectored_events[i]) <= 1L)
- { /* first client, so do it */
- _SwapProc(&(XETrapEventProcVector[i]),
- &(EventProcVector[i]));
- }
- }
- else
- { /* Client wants the *real* rtn */
- if (--(vectored_events[i]) <= 0L)
- { /* No more clients using, so do it */
- _SwapProc(&(XETrapEventProcVector[i]),
- &(EventProcVector[i]));
- }
- }
- switch(i)
- {
- case KeyPress: /* needed for command key processing */
- case KeyRelease:
- XETrapKbdDev->processInputProc =
- (void_function)(EventProcVector[i] ?
- (void_function)EventProcVector[i] :
- (void_function)keybd_process_inp);
- XETrapKbdDev->realInputProc =
- (void_function)(EventProcVector[i] ?
- (void_function)EventProcVector[i] :
- (void_function)keybd_process_inp);
- break;
-#ifndef VECTORED_EVENTS
- case ButtonPress: /* hack until events become vectored */
- case ButtonRelease:
- case MotionNotify:
- XETrapPtrDev->processInputProc =
- (void_function)EventProcVector[i];
- XETrapPtrDev->realInputProc =
- (void_function)EventProcVector[i];
- break;
- default:
- status = BadImplementation;
- break;
-#endif /* !VECTORED_EVENTS */
- }
- BitToggle(penv->cur.data_config_flags_event,i);
- }
- }
- }
- if ((status == Success) &&
- (_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmd)))
- {
- if (BitIsTrue(dflags, XETrapCmd))
- { /* Add accelerator entry to cmd_clients list iff necessary */
- penv->cur.data_config_cmd_key = request->config_cmd_key;
- status = add_accelerator_node(penv->client, &cmd_clients);
- }
- else
- {
- penv->cur.data_config_cmd_key = 0L; /* default no KeyCode */
- remove_accelerator_node(penv->client, &cmd_clients);
- }
- }
- if ((status == Success) &&
- (_CheckChangeBit(vflags,dflags,bit_flags,XETrapMaxPacket)))
- {
- if (BitIsTrue(dflags,XETrapMaxPacket))
- { /* Set size to what's passed in */
- if (request->config_max_pkt_size < XETrapMinPktSize)
- { /* Tell them the value is too small */
- status = BadValue;
- }
- else
- {
- penv->cur.data_config_max_pkt_size =
- request->config_max_pkt_size;
- }
- }
- else
- { /* Set it to the default (a *very* big number) */
- penv->cur.data_config_max_pkt_size = 0xFFFF;
- }
- }
- /* If the valid flag is set for requests, then each of the
- * requests is swapped if it's different from current state.
- */
- if (BitIsTrue(vflags,XETrapRequest) && status == Success)
- { /* Loop through all of the core requests */
- for (i=0L; i<ASIZE(XETrapProcVector); i++)
- {
- if (BitIsTrue(req_flags,i) && /* Do we care about this one? */
- (BitValue(dflags,XETrapRequest) ^ /* Exclusive Or */
- (BitValue(penv->cur.data_config_flags_req,i))))
- { /* At this point we *know* there's a change. The
- * only question remaining is are there any more
- * clients interested in this specific request. If
- * so, *don't* swap this process!
- */
- if (BitIsTrue(dflags,XETrapRequest))
- { /* Client wants the XTrap rtn */
- if (++(vectored_requests[i]) <= 1L)
- { /* first client, so do it */
- _SwapProc(&(XETrapProcVector[i]), &(ProcVector[i]));
- }
- }
- else
- { /* Client wants the *real* rtn */
- if (--(vectored_requests[i]) <= 0L)
- { /* No more clients using, so do it */
- _SwapProc(&(XETrapProcVector[i]), &(ProcVector[i]));
- }
- }
- if (status == Success)
- {
- BitToggle(penv->cur.data_config_flags_req,i);
- }
- }
- }
- }
- /* Check & Set the boolean flags */
- if (status == Success)
- {
- _CheckChangeBit(vflags,dflags,bit_flags,XETrapCmdKeyMod);
- _CheckChangeBit(vflags,dflags,bit_flags,XETrapTimestamp);
- _CheckChangeBit(vflags,dflags,bit_flags,XETrapWinXY);
-/* _CheckChangeBit(vflags,dflags,bit_flags,XETrapCursor); */
-#ifdef COLOR_REPLIES
- _CheckChangeBit(vflags,dflags,bit_flags,XETrapColorReplies);
-#endif /* COLOR_REPLIES */
- if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapGrabServer))
- { /* Let any client uncoditionally set/clear Grabs */
- ignore_grabs = BitValue(dflags, XETrapGrabServer);
- }
- }
- /* The statistics vflag/dflag mechanism is a little different
- * from most. The dflag is initially set to 0 to indicate no
- * statistics. When a config request comes in to request
- * statistics, memory's allocated and the dflag is set.
- * Thereafter, whenever a client wants to clear the counters, he
- * simply sets the vflag and clears the dflag. Multiple requests
- * for statistics configuration are ignored, and the stats memory is
- * free'd only when the client disconnects.
- */
- if (status == Success)
- {
- if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapStatistics))
- {
- if (BitIsTrue(dflags,XETrapStatistics))
- { /* Do we need to allocate memory? */
- if (penv->stats == NULL && (penv->stats =
- (xXTrapGetStatsReply *)Xcalloc(sizeof(xXTrapGetStatsReply)))
- != NULL)
- { /* Set up the reply header */
- penv->stats->type = X_Reply;
- penv->stats->length = XEXTRA(xXTrapGetStatsReply);
- /* add accelerator node for stats clients list */
- status = add_accelerator_node(penv->client, &stats_clients);
- }
- else if (penv->stats == NULL)
- { /* No Memory! */
- status = BadAlloc;
- }
- }
- else
- { /* Zero out counters */
- (void)memset(penv->stats->data.requests, 0L,
- sizeof(penv->stats->data.requests));
- (void)memset(penv->stats->data.events, 0L,
- sizeof(penv->stats->data.events));
- /* Re-cock the Stat's flag so that it'll
- * sense a change for next zero'ing out
- * of the counters.
- */
- BitTrue(penv->cur.data_config_flags_data, XETrapStatistics);
- }
- }
- }
- return(status);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sets the XETrapTrapActive bit to indicate that Trapping
- * of requests and/or core events to the client may take place.
- *
- */
-int XETrapStartTrap(xXTrapReq *request, ClientPtr client)
-{
- XETrapEnv *penv = XETenv[client->index];
- int status = add_accelerator_node(penv->client, &io_clients);
- if (status == Success)
- {
- BitTrue(penv->cur.data_state_flags, XETrapTrapActive);
- }
- return(status);
-}
-/*
- * DESCRIPTION:
- *
- * This function clears the XETrapTrapActive bit to indicate that Trapping
- * of requests and/or core events to the client may *not* take place.
- *
- */
-int XETrapStopTrap(xXTrapReq *request, ClientPtr client)
-{
- XETrapEnv *penv = XETenv[client->index];
-
- remove_accelerator_node(penv->client, &io_clients);
- BitFalse(penv->cur.data_state_flags, XETrapTrapActive);
- return(Success);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sends a reply back to the requesting client indicating
- * the specific XTrap version of this extension.
- */
-int XETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
-{
- xXTrapGetVersReply ver_rep;
- XETrapEnv *penv = XETenv[client->index];
-
- update_protocol(request,client); /* to agree on protocol version */
- /* Initialize the reply as needed */
- ver_rep.hdr.type = X_Reply;
- ver_rep.hdr.detail = XETrap_GetVersion;
- ver_rep.hdr.sequenceNumber = client->sequence;
- ver_rep.hdr.length = XEXTRA(xXTrapGetVersReply);
- ver_rep.data.xtrap_release = XETrap_avail.data.xtrap_release;
- ver_rep.data.xtrap_version = XETrap_avail.data.xtrap_version;
- ver_rep.data.xtrap_revision = XETrap_avail.data.xtrap_revision;
- ver_rep.data.xtrap_protocol = penv->protocol; /* return agreed protocol */
- WriteReplyToClient(client, sizeof(xXTrapGetVersReply), &ver_rep);
- return(Success);
-}
-
-/*
- * DESCRIPTION:
- *
- * This function sends a reply back to the requesting client indicating
- * the specific XTrap version of this extension.
- */
-int XETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
-{
- xXTrapGetLITimReply tim_rep;
- XETrapEnv *penv = XETenv[client->index];
-
- /* Initialize the reply as needed */
- tim_rep.hdr.type = X_Reply;
- tim_rep.hdr.detail = XETrap_GetLastInpTime;
- tim_rep.hdr.sequenceNumber = client->sequence;
- tim_rep.hdr.length = XEXTRA(xXTrapGetLITimReply);
- tim_rep.data_last_time = penv->last_input_time;
- WriteReplyToClient(client, sizeof(xXTrapGetLITimReply), &tim_rep);
- return(Success);
-}
-
-/*
- * DESCRIPTION:
- *
- * This routine is swapped in for the server's output request vectors.
- * After writing the request to one (or more) XTrap client(s), this
- * routine ALWAYS returns by calling the REAL output request vector rtn.
- *
- * Note: Swapped Requests are handled automatically since the unswapped
- * vectored routine is called after the request has been swapped.
- * IOW, all requests are directed through ProcVector eventually and are
- * "unswapped" at that point. It is necessary to swap the data
- * back if writing to a swapped client, however, and this is done
- * by calling the appropriate XETSwProcVector[] routine.
- */
-int XETrapRequestVector(ClientPtr client)
-{
- int status = True;
- XETrapDatum *pdata, *spdata = NULL;
- REQUEST(xResourceReq);
- WindowPtr window_ptr;
- XETrapEnv *penv;
- BYTE *tptr;
- ClientList *ioc = &io_clients;
- ClientList *stc = &stats_clients;
- INT32 asize = sizeof(pdata->hdr) + stuff->length * sizeof(CARD32);
- INT32 size = MAX(asize,XETrapMinPktSize); /* Must be at least */
- INT32 csize; /* size of request to send to the XTrap client */
-
- /* Get memory for the data to be sent */
- if ((pdata = (XETrapDatum *)Xcalloc(size)) == NULL)
- { /* Can't do anything accept set a flag since we don't
- * know who to send the error to yet.
- */
- status = False;
- }
-
- while (ioc->next != NULL)
- {
- ioc = ioc->next;
- penv = XETenv[ioc->client->index];
- if (status == False)
- { /* We didn't get the memory! Complain */
- SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
- stuff->reqType, 0L, BadAlloc);
- break;
- }
- if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
- { /* This particular client is interested in *this* request */
- pdata->hdr.client = client->index; /* stuff client index in hdr */
- if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
- {
- window_ptr = (WindowPtr) LookupDrawable(stuff->id, client);
- if (window_ptr == 0L)
- { /* Failed...invalidate the X and Y coordinate data. */
- pdata->hdr.win_x = -1L;
- pdata->hdr.win_y = -1L;
- }
- else
- {
- pdata->hdr.screen = window_ptr->drawable.pScreen->myNum;
- pdata->hdr.win_x = window_ptr->drawable.x;
- pdata->hdr.win_y = window_ptr->drawable.y;
- }
- }
- if (BitIsTrue(penv->cur.data_config_flags_data,XETrapTimestamp))
- {
- pdata->hdr.timestamp = GetTimeInMillis();
- }
- /* Copy the information to a location we can write it from */
- (void) memcpy(&(pdata->u.req),stuff,stuff->length*sizeof(CARD32));
- pdata->hdr.count = MIN(penv->cur.data_config_max_pkt_size,asize);
- XETrapSetHeaderRequest(&(pdata->hdr));
-
- /* Perform any needed byte/word swapping. NOTE: This is not
- * the "normal" technique that should be used to perform the
- * swapping. The reason that we do it here is to be sure to
- * do it only once in a controlled manner, which we can not
- * guarentee in the case of the Xlib transport. Notice that
- * we don't swap the XTRAP EVENT information. This is done
- * in the XETrapWriteXLib() routine.
- */
-
- if (penv->client->swapped)
- { /* need to deal with swapped clients */
- if (spdata == NULL)
- { /* Get memory for the swapped data to be sent */
- if ((spdata = (XETrapDatum *)Xcalloc(size)) == NULL)
- {
- SendErrorToClient(penv->client,
- XETrap_avail.data.major_opcode,
- stuff->reqType, 0L, BadAlloc);
- break;
- }
-
- memcpy(spdata,pdata,size); /* fill in the info */
- /* Now call the request-specific rtn to swap the request */
- if (stuff->reqType < 128)
- { /* a core request, good */
- (*XETSwProcVector[stuff->reqType])(&(spdata->u.req),
- penv->client); /* RTC X11R6 */
- }
- else if (penv->cur.data_config_max_pkt_size ==
- XETrapMinPktSize)
- { /* Minimum size, so swap it as an ResourceReq */
- XETSwResourceReq(&(spdata->u.req));
- }
- else
- { /* trying to swap an extension request! */
- SendErrorToClient(penv->client,
- XETrap_avail.data.major_opcode,
- stuff->reqType, 0L, XETrapErrorBase + BadSwapReq);
- }
- }
- /* need to stow in the latest header (count) */
- memcpy(spdata,pdata,SIZEOF(XETrapHeader));
- sXETrapHeader(&(spdata->hdr)); /* swap the XTrap Header */
- }
- /* Write as many bytes of information as the client wants */
- tptr = (BYTE *)(penv->client->swapped ? spdata : pdata);
- csize = MAX(pdata->hdr.count, XETrapMinPktSize);
- if (XETrapWriteXLib(penv, tptr, csize) != csize)
- {
- SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
- stuff->reqType, 0L, XETrapErrorBase + BadIO);
- }
-#ifdef COLOR_REPLIES
- /* Process Color Replies, if desired, and applicable */
- if (BitIsTrue(penv->cur.data_config_flags_data,XETrapColorReplies))
- { /* wants color replies */
- switch(stuff->reqType)
- {
- case X_AllocColor:
- GetSendColorRep(client, stuff);
- break;
- case X_AllocNamedColor:
- GetSendNamedColorRep(client, stuff);
- break;
- case X_AllocColorCells:
- GetSendColorCellsRep(client, stuff);
- break;
- case X_AllocColorPlanes:
- GetSendColorPlanesRep(client, stuff);
- break;
- default:
- break;
- }
- }
-#endif /* COLOR_REPLIES */
- }
- }
- while (stc->next != NULL)
- { /* increment appropriate stats bucket for each interested client */
- stc = stc->next;
- penv = XETenv[stc->client->index];
- if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
- { /* This particular client would like this particular stat */
- penv->stats->data.requests[stuff->reqType]++;
- }
- }
-
- if (pdata)
- {
- Xfree(pdata);
- }
- if (spdata)
- {
- Xfree(spdata);
- }
- if (ignore_grabs == True &&
- (stuff->reqType == X_GrabServer || stuff->reqType == X_UngrabServer))
- { /* doesn't want Grab's! Note: this is a "last configured" setting */
-#ifndef NO_NEW_XTRAP
- int status;
-
- if (stuff->reqType == X_GrabServer)
- {
- ClientList *pclient;
-
- /* first call grab server procedure */
- status = (*XETrapProcVector[stuff->reqType])(client);
-
- /* then add XTrap controlling clients */
- for (pclient = &io_clients; pclient; pclient = pclient->next)
- if (pclient->client)
- MakeClientGrabImpervious(pclient->client);
- }
- else
- {
- ClientList *pclient;
-
- /* first drop XTrap controlling clients */
- for (pclient = &io_clients; pclient; pclient = pclient->next)
- if (pclient->client)
- MakeClientGrabPervious(pclient->client);
-
- /* then call ungrab server procedure */
- status = (*XETrapProcVector[stuff->reqType])(client);
- }
- return status;
-#else /* NO_NEW_XTRAP */
- return(Success);
-#endif /* NO_NEW_XTRAP */
- }
- else
- {
- return((*XETrapProcVector[stuff->reqType])(client));
- }
-}
-/*
- *
- * DESCRIPTION:
- *
- * This routine intercepts input xEvents from the keyboard.
- * if XETrapTrapActive, will write record to client(s)
- * and then pass the event to the server iff not command
- * key and gate is open. If it's a command key, then twiddle
- * the gate state as required (optional, see below).
- *
- * This routine implements an optional user specified command key
- * that can be used to close the input pipe into the server
- * while a client command is generated. The keypress of the
- * command key places this routine in command mode, the keyrelease
- * exits command mode.
- *
- * A keypress of the command key followed by the
- * optionally specified lock key will place this routine in continuous
- * command mode until the command key and lock key are pressed again
- * to exit command mode. In the locked state, the client interprets
- * keystrokes as it wishes, as commands or as input to a prior command.
- *
- * Both mechanisms can be used alternately.
- *
- * IMPLICIT INPUTS :
- *
- * penv->cur.data_config_cmd_key :
- * This is the keycode of the key that is used to stop
- * and restart the transmission of intercepted input
- * events to the server. If specified, the gate_state
- * flag will be set or cleared depending on the state of
- * the command_key.
- *
- * penv->cur.data_config_flags_data.XETrapCmdKeyMod:
- * This is the value of the mode in which the command_key
- * will operate. It currently has two values: MODIFIER and
- * COMMAND_LOCK. MODIFIER mode clears gate_state on
- * keypress, and sets gate_state on keyrelease.
- * COMMAND_LOCK mode toggles gate_state on
- * or off.
- *
- * gate_closed:
- * A flag that is set/cleared in the xtrap_keyboard
- * routine that indicates whether intercepted input
- * should be passed to the server at any particular
- * instance.
- *
- *
- * next_key:
- * This variable tracks the state of the next key to be
- * pressed or released. It allows the checking of double
- * presses of the command key to be sent to the server and
- * keeps good state order when the command key is used.
- *
- * key_ignore:
- * This variable indicates whether or not the specific
- * key should be ignored for subsequent server processing.
- *
- */
-int XETrapKeyboard(xEvent *x_event, DevicePtr keybd, int count)
-{
- register BYTE type = x_event->u.u.type;
- register BYTE detail = x_event->u.u.detail;
- XETrapEnv *penv;
- ClientList *stc = &stats_clients;
- ClientList *cmc = &cmd_clients;
- int_function cur_func = XETrapKeyboard;
-
-#ifdef VERBOSE
- if (count != 1L)
- { /* We haven't coded for this situation yet! */
- ErrorF("Warning! Event count != 1 (%d)\n", count);
- }
-#endif
- while (stc->next != NULL)
- { /* increment appropriate stats bucket for each interested client */
- stc = stc->next;
- penv = XETenv[stc->client->index];
- if (BitIsTrue(penv->cur.data_config_flags_event,type))
- { /* This particular client would like this particular stat */
- penv->stats->data.events[type]++;
- }
- }
-#ifndef VECTORED_EVENTS
- /* We *only* StampAndMail command keys with vectored events since
- * we get much more data by waiting till we get called in XETrapEventVector
- */
- XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
-#endif
- while (cmc->next != NULL)
- {
- cmc = cmc->next;
- penv = XETenv[cmc->client->index];
- key_ignore = False;
- if (detail == penv->cur.data_config_cmd_key)
- {
- if (BitIsTrue(penv->cur.data_config_flags_data, XETrapCmdKeyMod))
- {
- switch (type)
- {
- case KeyPress:
- if (next_key == XEKeyIsEcho)
- {
- break;
- }
- gate_closed = True;
- next_key = XEKeyIsClear;
- break;
-
- case KeyRelease:
- if (next_key == XEKeyIsEcho)
- {
- next_key = XEKeyIsClear;
- break;
- }
- if (next_key == XEKeyIsClear)
- {
- next_key = XEKeyIsEcho;
- }
- else
- { /* it's Other, so Clear it */
- next_key = XEKeyIsClear;
- }
- gate_closed = False;
- key_ignore = True;
- break;
-
- default: break;
- }
- }
- else
- {
- switch (type)
- {
- case KeyPress:
- if (next_key == XEKeyIsEcho)
- {
- gate_closed = False;
- break;
- }
- /* Open gate on cmd key release */
- if ((next_key == XEKeyIsOther) &&
- gate_closed == True)
- {
- break;
- }
- gate_closed = True;
- next_key = XEKeyIsClear;
- break;
-
- case KeyRelease:
- if (next_key == XEKeyIsClear)
- {
- next_key = XEKeyIsEcho;
- break;
- }
-
- if (next_key == XEKeyIsEcho)
- {
- next_key = XEKeyIsClear;
- break;
- }
-
- gate_closed = False;
- key_ignore = True;
- next_key = XEKeyIsClear;
- break;
-
- default:
- break;
- }
- }
- }
- else
- {
- next_key = XEKeyIsOther;
- }
- }
-
- /*
- * If the gate to the server is open,
- * and we are not ignoring a keyrelease,
- * pass the event to the server for normal processing.
- */
-#ifndef VECTORED_EVENTS
- if ((gate_closed == False) && (key_ignore == False))
- {
- if (XETrapEventProcVector[type] != cur_func)
- { /* to protect us from infinite loops */
- (void)(*XETrapEventProcVector[type])(x_event,keybd,count);
- }
- else
- {
- (void)(*EventProcVector[type])(x_event,keybd,count);
- }
- }
-#else /* VECTORED_EVENTS */
- if ((gate_closed == False) && (key_ignore == False))
- { /* send event on to server to be trapped again in XETrapEventVector */
- (void)(*keybd_process_inp)(x_event,keybd,count);
- }
- else
- {
- XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
- }
-#endif
- key_ignore = False; /* reset for next time around */
- return 0;
-}
-
-/*
- * DESCRIPTION:
- *
- * This routine intercepts input xEvents from the pointer device
- * and passes the input event back to the server for normal processing.
- *
- * This routine is sensitive to whether input is being passed
- * up to the server or not. This state is set by the keyboard
- * input routine.
- *
- *
- */
-#ifndef VECTORED_EVENTS
-int XETrapPointer(xEvent *x_event, DevicePtr ptrdev, int count)
-{
- XETrapEnv *penv;
- ClientList *stc = &stats_clients;
- int_function cur_func = XETrapPointer;
-
-#ifdef VERBOSE
- if (count != 1L)
- { /* We haven't coded for this situation yet! */
- ErrorF("Warning! Event count != 1 (%d)\n", count);
- }
-#endif
- while (stc->next != NULL)
- { /* increment appropriate stats bucket for each interested client */
- stc = stc->next;
- penv = XETenv[stc->client->index];
- if (BitIsTrue(penv->cur.data_config_flags_event,x_event->u.u.type))
- { /* This particular client would like this particular stat */
- penv->stats->data.events[x_event->u.u.type]++;
- }
- }
- XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
- /*
- * If the gate to the server is open,
- * pass the event up like nothing has happened.
- */
- if (gate_closed == False)
- {
- if (XETrapEventProcVector[x_event->u.u.type] != cur_func)
- { /* to protect us from infinite loops */
- (void)(*XETrapEventProcVector[x_event->u.u.type])(x_event,ptrdev,
- count);
- }
- else
- {
- (void)(*EventProcVector[x_event->u.u.type])(x_event,ptrdev,count);
- }
- }
- return 0;
-}
-#endif /* !VECTORED_EVENTS */
-
-
-/*
- * DESCRIPTION:
- *
- * This routine determines whether it needs to send event data
- * to the XTrap Client(s). If so, it timestamps it appropriately
- * and writes out both the header and detail information.
- *
- */
-void XETrapStampAndMail(xEvent *x_event)
-{
- XETrapDatum data;
- register CARD32 size;
- XETrapEnv *penv;
- ClientList *ioc = &io_clients;
-
- /* Currently, we're intercepting core events *before* most
- * of the event information's filled in. Specifically, the
- * only fields that are valid at this level are: type, detail,
- * time, rootX, rootY, and state.
- */
- /* Loop through all clients wishing I/O */
- while (ioc->next != NULL)
- {
- ioc = ioc->next;
- penv = XETenv[ioc->client->index];
- /* Do we have a valid fd? Do we care about this event? */
- if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
- {
- XETrapSetHeaderEvent(&(data.hdr));
- data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
- data.hdr.screen = 0L; /* not till Events are vectored! */
- data.hdr.client = 0L; /* not till Events are vectored! */
- if (BitIsTrue(penv->cur.data_config_flags_data,
- XETrapTimestamp))
- {
- data.hdr.timestamp = GetTimeInMillis();
- }
- size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
- penv->last_input_time = x_event->u.keyButtonPointer.time;
- /* Copy the event information into our local memory */
- (void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension &&
- (data.u.event.u.u.type == MotionNotify ||
- data.u.event.u.u.type == ButtonPress ||
- data.u.event.u.u.type == ButtonRelease ||
- data.u.event.u.u.type == KeyPress ||
- data.u.event.u.u.type == KeyRelease)) {
- int scr = XineramaGetCursorScreen();
- data.u.event.u.keyButtonPointer.rootX +=
- panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x;
- data.u.event.u.keyButtonPointer.rootY +=
- panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y;
- }
-#endif
-
- if (penv->client->swapped)
- { /*
- * Notice that we don't swap the XTRAP EVENT information.
- * This is done in the XETrapWriteXLib() routine.
- */
- xEvent ToEvent;
- (*EventSwapVector[data.u.event.u.u.type & 0177])
- (&data.u.event,&ToEvent);
- (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
- sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */
- }
- /* From this point on, the contents of data is swapped and
- * therefore we should not refer to it for information.
- */
- if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
- {
- SendErrorToClient(penv->client,
- XETrap_avail.data.major_opcode,
- x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
- }
- }
- }
- return;
-}
-#ifdef VECTORED_EVENTS
-int XETrapEventVector(ClientPtr client, xEvent *x_event)
-{
- XETrapDatum data;
- register CARD32 size;
- XETrapEnv *penv;
- ClientList *ioc = &io_clients;
-
- /* Loop through all clients wishing I/O */
- while (ioc->next != NULL)
- {
- ioc = ioc->next;
- penv = XETenv[ioc->client->index];
- /* Do we care about this event? */
- if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
- {
- XETrapSetHeaderEvent(&(data.hdr));
- data.hdr.client = client->index;
- data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
- if ((current_screen < 0L) || ((x_event->u.u.type >= KeyPress) &&
- (x_event->u.u.type <= MotionNotify) &&
- (!x_event->u.keyButtonPointer.sameScreen)))
- { /* we've moved/warped to another screen */
- WindowPtr root_win = GetCurrentRootWindow();
- current_screen = root_win->drawable.pScreen->myNum;
- }
- data.hdr.screen = current_screen;
- if (BitIsTrue(penv->cur.data_config_flags_data,
- XETrapTimestamp))
- {
- data.hdr.timestamp = GetTimeInMillis();
- }
- size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
- penv->last_input_time = x_event->u.keyButtonPointer.time;
- /* Copy the event information into our local memory */
- (void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
-
- if (penv->client->swapped)
- {
- xEvent ToEvent;
- (*EventSwapVector[data.u.event.u.u.type & 0177])
- (&data.u.event,&ToEvent);
- (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
- sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */
- }
- /* From this point on, the contents of pdata is swapped and
- * therefore we should not refer to it for information.
- */
- if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
- {
- SendErrorToClient(penv->client,
- XETrap_avail.data.major_opcode,
- x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
- }
- }
- }
- return;
-}
-#endif /* VECTORED_EVENTS */
-void sReplyXTrapDispatch(ClientPtr client, int size, char *reply)
-{
- register XETrapRepHdr *rep = (XETrapRepHdr *)reply;
-
- switch(rep->detail)
- {
- case XETrap_GetAvailable:
- {
- xXTrapGetAvailReply lrep;
- (void)memcpy((char *)&lrep,reply,sizeof(lrep));
- sReplyXETrapGetAvail(client,size,(char *)&lrep);
- }
- break;
- case XETrap_GetCurrent:
- {
- xXTrapGetCurReply lrep;
- (void)memcpy((char *)&lrep,reply,sizeof(lrep));
- sReplyXETrapGetCur(client,size,(char *)&lrep);
- }
- break;
- case XETrap_GetStatistics:
- {
- xXTrapGetStatsReply lrep;
- (void)memcpy((char *)&lrep,reply,sizeof(lrep));
- sReplyXETrapGetStats(client,size,(char *)&lrep);
- }
- break;
- case XETrap_GetVersion:
- {
- xXTrapGetVersReply lrep;
- (void)memcpy((char *)&lrep,reply,sizeof(lrep));
- sReplyXETrapGetVers(client,size,(char *)&lrep);
- }
- break;
- case XETrap_GetLastInpTime:
- {
- xXTrapGetLITimReply lrep;
- (void)memcpy((char *)&lrep,reply,sizeof(lrep));
- sReplyXETrapGetLITim(client,size,(char *)&lrep);
- }
- break;
- default:
- SendErrorToClient(client,XETrap_avail.data.major_opcode,
- rep->detail, 0L, BadImplementation);
- break;
- }
- return;
-}
-
-/*
- * XLib communications routines
- */
-
-/*
- * DESCRIPTION:
- *
- * This function performs the transport specific functions required
- * for writing data back to an XTrap client over XLib. The trick is
- * packaging the data into <=32 byte packets to conform to the sizeof
- * an X Event. nbytes must be at least equal to XETrapMinPktSize
- *
- */
-int XETrapWriteXLib(XETrapEnv *penv, BYTE *data, CARD32 nbytes)
-{
- CARD32 size, total = 0L;
- xETrapDataEvent event;
-
- /* Initialize the detail field to show the beginning of a datum */
- event.detail = XETrapDataStart;
- event.idx = 0L;
-
- /* This loop could be optimized by not calling Write until after all
- * of the events are packaged. However, this would require memory
- * games, and may not therefore be a win.
- */
- while (nbytes > 0L)
- { /* How many bytes can we send in this packet */
- size = (nbytes > sz_EventData) ? sz_EventData : nbytes;
-
- /* Initialize the event */
- event.type = XETrapData + XETrap_avail.data.event_base;
- event.sequenceNumber = penv->client->sequence;
-
- /* Copy the data we are sending */
- (void)memcpy(event.data,data,size);
- if (size < sz_EventData)
- (void)memset(event.data+size,0L,sz_EventData-size);
- data += size;
- nbytes -= size;
- total += size;
-
- /* Set the detail field to show the continuation of datum */
- if (total != size)
- { /* this is not the first one */
- event.detail = (nbytes > 0) ? XETrapDataContinued : XETrapDataLast;
- }
-
- /* Send this part to the client */
- WriteEventsToClient(penv->client, 1L, (xEvent *) &event);
- event.idx++; /* Bump the index for the next event */
- }
- return(total);
-}
-
-/*----------------------------*
- * Static Functions
- *----------------------------*/
-
-static void update_protocol(xXTrapGetReq *reqptr, ClientPtr client)
-{
- XETrapEnv *penv = XETenv[client->index];
- /* update protocol number */
- switch (reqptr->protocol)
- {
- /* known acceptable protocols */
- case 31:
- case XETrapProtocol:
- penv->protocol = reqptr->protocol;
- break;
- /* all else */
- default: /* stay backwards compatible */
- penv->protocol = 31;
- break;
- }
-}
-
-/* Swap 2 functions. This is a function instead of a macro to help to keep
- * lint from complaining about mixed types. It seems to work, but I would
- * probably classify this as a hack.
- */
-static void _SwapProc( register int (**f1)(), register int (**f2)())
-{
- register int (*t1)() = *f1;
- *f1 = *f2;
- *f2 = t1;
-
- return;
-}
-
-/*
- * DESCRIPTION:
- *
- * This function swaps the byte order of fields within
- * the XTrap Event Header. It assumes the data will be
- * swapped by code in XETrapRequestVector().
- *
- */
-static void sXETrapEvent(xETrapDataEvent *from, xETrapDataEvent *to)
-{
- to->type = from->type;
- to->detail = from->detail;
- cpswaps(from->sequenceNumber,to->sequenceNumber);
- cpswapl(from->idx,to->idx);
- /* Assumes that the data's already been swapped by XETrapRequestVector */
- memcpy(to->data, from->data, SIZEOF(EventData));
-}
-
-/*
- * DESCRIPTION:
- *
- * This function adds a node from an accelerator linked-list
- * (either io_clients, stats_clients, or cmd_clients).
- *
- */
-static int add_accelerator_node(ClientPtr client, ClientList *accel)
-{
- Bool found = False;
- int status = Success;
-
- while (accel->next != NULL)
- {
- if (accel->client == client)
- {
- found = True; /* Client's already known */
- break;
- }
- else
- {
- accel = accel->next;
- }
- }
- if (found == False)
- {
- if ((accel->next = (ClientList *)Xcalloc(sizeof(ClientList))) == NULL)
- {
- status = BadAlloc;
- }
- else
- { /* fill in the node */
- accel = accel->next;
- accel->next = NULL;
- accel->client = client;
- }
- }
- return(status);
-}
-/*
- * DESCRIPTION:
- *
- * This function removes a node from an accelerator linked-list
- * (either io_clients, stats_clients, or cmd_clients).
- *
- */
-static void remove_accelerator_node(ClientPtr client, ClientList *accel)
-{
- while (accel->next != NULL)
- {
- if (accel->next->client == client)
- {
- ClientList *tmp = accel->next->next;
- Xfree(accel->next);
- accel->next = tmp;
- break;
- }
- else
- {
- accel = accel->next;
- }
- }
-
- return;
-}
-
-#ifdef COLOR_REPLIES
-static void GetSendColorRep(ClientPtr client, xResourceReq *req)
-{ /* adapted from ProcAllocColor() in dispatch.c */
- XETrapDatum data;
- int retval;
- XETrapEnv *penv = XETenv[client->index];
- xAllocColorReply *crep = (xAllocColorReply *)&(data.u.reply);
- xAllocColorReq *creq = (xAllocColorReq *)req;
- ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
- /* Fill in the header fields */
- data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
- XETrapSetHeaderReply(&(data.hdr));
- /* Hack alert:
- * We need to pass the "reply" type in the header since replies don't
- * contain the id's themselves. However, we're not changing the
- * protocol to support this until we decide exactly how we want to
- * do *all* replies (e.g. not just ColorReplies). So until then, stow
- * the reply id in the screen field which wouldn't normally be used in
- * this context.
- */
- data.hdr.screen = req->reqType;
- if (!pmap)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadColor);
- return;
- }
- crep->red = creq->red;
- crep->green = creq->green;
- crep->blue = creq->blue;
- crep->pixel = 0;
- if ((retval = AllocColor(pmap, &(crep->red), &(crep->green),
- &(crep->blue), &(crep->pixel), client->index)) != Success)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, retval);
- return;
- }
- /* Swap data if necessary */
- if (client->swapped)
- {
- INT32 n;
- swaps(&(crep->red), n);
- swaps(&(crep->green), n);
- swaps(&(crep->blue), n);
- swapl(&(crep->pixel), n);
- }
- /* Send data to client */
- if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize)
- != XETrapMinPktSize)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, XETrapErrorBase + BadIO);
- }
-}
-
-static void GetSendNamedColorRep(ClientPtr client, xResourceReq *req)
-{ /* adapted from ProcAllocNamedColor() in dispatch.c */
- XETrapDatum data;
- XETrapEnv *penv = XETenv[client->index];
- int retval;
- xAllocNamedColorReply *nrep = (xAllocNamedColorReply *)&(data.u.reply);
- xAllocNamedColorReq *nreq = (xAllocNamedColorReq *)req;
- ColormapPtr pcmp = (ColormapPtr )LookupIDByType(nreq->cmap, RT_COLORMAP);
-
- data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
- XETrapSetHeaderReply(&(data.hdr));
- /* Hack alert:
- * We need to pass the "reply" type in the header since replies don't
- * contain the id's themselves. However, we're not changing the
- * protocol to support this until we decide exactly how we want to
- * do *all* replies (e.g. not just ColorReplies). So until then, stow
- * the reply id in the screen field which wouldn't normally be used in
- * this context.
- */
- data.hdr.screen = req->reqType;
- if (!pcmp)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadColor);
- return;
- }
- if (!OsLookupColor(pcmp->pScreen->myNum, (char *)&nreq[1],
- nreq->nbytes, &(nrep->exactRed), &(nrep->exactGreen),
- &(nrep->exactBlue)))
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadName);
- return;
- }
- nrep->screenRed = nrep->exactRed;
- nrep->screenGreen = nrep->exactGreen;
- nrep->screenBlue = nrep->exactBlue;
- nrep->pixel = 0;
- if ((retval = AllocColor(pcmp, &(nrep->screenRed),
- &(nrep->screenGreen), &(nrep->screenBlue), &(nrep->pixel),
- client->index)) != Success)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, retval);
- return;
- }
- /* Swap data if necessary */
- if (client->swapped)
- {
- INT32 n;
- swapl(&(nrep->pixel), n);
- swaps(&(nrep->exactRed), n);
- swaps(&(nrep->exactGreen), n);
- swaps(&(nrep->exactBlue), n);
- swaps(&(nrep->screenRed), n);
- swaps(&(nrep->screenGreen), n);
- swaps(&(nrep->screenBlue), n);
- }
-
- /* Send data to client */
- if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize)
- != XETrapMinPktSize)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, XETrapErrorBase + BadIO);
- }
-}
-
-static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
-{ /* adapted from ProcAllocColorCells() in dispatch.c */
- int retval;
- int npixels, nmasks;
- unsigned long *ppixels, *pmasks;
- long length;
- XETrapDatum *data;
- XETrapEnv *penv = XETenv[client->index];
- xAllocColorCellsReply *crep;
- xAllocColorCellsReq *creq = (xAllocColorCellsReq *)req;
- ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
- if (!pmap)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadColor);
- return;
- }
- npixels = creq->colors;
- if (!npixels)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadValue);
- return;
- }
- nmasks = creq->planes;
- length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
- data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
- if (!data)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadAlloc);
- return;
- }
- data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
- sizeof(XETrapDatum)+length);
- XETrapSetHeaderReply(&(data->hdr));
- data->hdr.screen = req->reqType; /* hack! but necessary */
- ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
- pmasks = ppixels + npixels;
- if ((retval = AllocColorCells(client->index, pmap, npixels,
- nmasks, (Bool)creq->contiguous, ppixels, pmasks)) != Success)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, retval);
- DEALLOCATE_LOCAL(data);
- return;
- }
- crep = (xAllocColorCellsReply *)&(data->u.reply);
- crep->nPixels = npixels;
- crep->nMasks = nmasks;
- /* Swap data if necessary */
- if (client->swapped)
- {
- INT32 n, i, *ptr;
- ptr=(INT32 *)ppixels;
- swaps(&(crep->nPixels), n);
- swaps(&(crep->nMasks), n);
- for (i=0; i<length; i++)
- {
- swapl(&(ptr[i]), n);
- }
- }
- /* Send data to client */
- if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count)
- != data->hdr.count)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, XETrapErrorBase + BadIO);
- }
- DEALLOCATE_LOCAL(data);
-}
-static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
-{ /* adapted from ProcAllocColorPlanes() in dispatch.c */
- int retval;
- int npixels, nmasks;
- unsigned long *ppixels, *pmasks;
- long length;
- XETrapDatum *data;
- XETrapEnv *penv = XETenv[client->index];
- xAllocColorPlanesReply *crep;
- xAllocColorPlanesReq *creq = (xAllocColorPlanesReq *)req;
- ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
- if (!pmap)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadColor);
- return;
- }
- npixels = creq->colors;
- if (!npixels)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadValue);
- return;
- }
- length = (long)npixels * sizeof(Pixel);
- data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
- if (!data)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, BadAlloc);
- return;
- }
- data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
- sizeof(XETrapDatum)+length);
- XETrapSetHeaderReply(&(data->hdr));
- data->hdr.screen = req->reqType; /* hack! but necessary */
- ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
- crep = (xAllocColorPlanesReply *)&(data->u.reply);
- if ((retval = AllocColorPlanes(client->index, pmap, npixels,
- (int)creq->red, (int)creq->green, (int)creq->blue,
- (int)creq->contiguous, ppixels, &(crep->redMask), &(crep->greenMask),
- &(crep->blueMask))) != Success)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, retval);
- DEALLOCATE_LOCAL(data);
- return;
- }
- crep->nPixels = npixels;
- /* Swap data if necessary */
- if (client->swapped)
- {
- INT32 n, i, *ptr;
- ptr=(INT32 *)ppixels;
- swaps(&(crep->nPixels), n);
- swapl(&(crep->redMask), n);
- swapl(&(crep->greenMask), n);
- swapl(&(crep->blueMask), n);
- for (i=0; i<length; i++)
- {
- swapl(&(ptr[i]), n);
- }
- }
- /* Send data to client */
- if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count)
- != data->hdr.count)
- {
- SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
- req->reqType, 0L, XETrapErrorBase + BadIO);
- }
- DEALLOCATE_LOCAL(data);
-}
-#endif /* COLOR_REPLIES */
diff --git a/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c b/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c
deleted file mode 100644
index ba8249c35..000000000
--- a/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* $XFree86$ */
-/****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991, 1992 by
-
- Digital Equipment Corp., Maynard, MA
-
-X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
-
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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.
-
-*****************************************************************************/
-/*
- * ABSTRACT:
- *
- * This module is the device independent module responsible for all
- * routines required for proper communication in a heterogeneous
- * networking environment (i.e. client & server on different endian
- * machines). The bulk of this module is patterned after X11/R4's
- * server/dix/swapreq.c ; however, they infact swap fields
- * in the exact opposite order since XTrap requires "unswapped" data
- * to become "swapped" before sending it to a "swapped" client.
- *
- * CONTRIBUTORS:
- *
- * Ken Miller
- * Marc Evans
- *
- * CHANGES:
- *
- * Robert Chesler - added client arg for X11R6 port in many spots
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <nx-X11/X.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <nx-X11/Xproto.h>
-#include <nx-X11/Xprotostr.h>
-#include <nx-X11/extensions/xtrapdi.h>
-#include "input.h" /* Server DevicePtr definitions */
-#include "misc.h"
-#include "dixstruct.h"
-#ifdef PC
-# include "extnsist.h"
-#else
-# include "extnsionst.h" /* Server ExtensionEntry definitions */
-#endif
-# include "swapreq.h" /* Server SwapColorItem definition */
-#include <nx-X11/extensions/xtrapddmi.h>
-#include <nx-X11/extensions/xtrapproto.h>
-
-/* In-coming XTrap requests needing to be swapped to native format */
-
-int sXETrapReset(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapReset(request,client));
-}
-
-int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- swaps(&(request->protocol),n);
- return(XETrapGetAvailable(request,client));
-}
-
-int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- swaps(&(request->config_max_pkt_size),n);
- return(XETrapConfig(request,client));
-}
-
-int sXETrapStartTrap(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapStartTrap(request,client));
-}
-
-int sXETrapStopTrap(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapStopTrap(request,client));
-}
-
-int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapGetCurrent(request,client));
-}
-
-int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapGetStatistics(request,client));
-}
-
-#ifndef _XINPUT
-int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->input.x),n);
- swaps(&(request->input.y),n);
- return(XETrapSimulateXEvent(request,client));
-}
-#endif
-
-int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- swaps(&(request->protocol),n);
- return(XETrapGetVersion(request,client));
-}
-
-int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
-{
- register char n;
- swaps(&(request->length),n);
- return(XETrapGetLastInpTime(request,client));
-}
-
-
-/* Out-going XTrap replies needing to be swapped *from* native format */
-
-void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply)
-{
- xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply;
- register char n;
- swaps(&(rep->hdr.sequenceNumber),n);
- swapl(&(rep->hdr.length),n);
- swapl(&(rep->data.pf_ident),n);
- swaps(&(rep->data.xtrap_release),n);
- swaps(&(rep->data.xtrap_version),n);
- swaps(&(rep->data.xtrap_revision),n);
- swaps(&(rep->data.max_pkt_size),n);
- swapl(&(rep->data.major_opcode),n);
- swapl(&(rep->data.event_base),n);
- swaps(&(rep->data.cur_x),n);
- swaps(&(rep->data.cur_y),n);
- (void)WriteToClient(client,size,reply);
- return;
-}
-void sReplyXETrapGetVers(ClientPtr client, int size, char *reply)
-{
- xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply;
- register char n;
- swaps(&(rep->hdr.sequenceNumber),n);
- swapl(&(rep->hdr.length),n);
- swaps(&(rep->data.xtrap_release),n);
- swaps(&(rep->data.xtrap_version),n);
- swaps(&(rep->data.xtrap_revision),n);
- (void)WriteToClient(client,size,reply);
- return;
-}
-void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply)
-{
- xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply;
- register char n;
- swaps(&(rep->hdr.sequenceNumber),n);
- swapl(&(rep->hdr.length),n);
- swapl(&(rep->data_last_time),n);
- (void)WriteToClient(client,size,reply);
- return;
-}
-void sReplyXETrapGetCur(ClientPtr client, int size, char *reply)
-{
- xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply;
- register char n;
- swaps(&(rep->hdr.sequenceNumber),n);
- swapl(&(rep->hdr.length),n);
- swaps(&(rep->data_config_max_pkt_size),n);
- (void)WriteToClient(client,size,reply);
- return;
-}
-void sReplyXETrapGetStats(ClientPtr client, int size, char *reply)
-{
- xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply;
- register char n;
- register int i;
- long *p;
-
- swaps(&(rep->sequenceNumber),n);
- swapl(&(rep->length),n);
- for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++)
- {
- swapl(p,n);
- }
- for (i=0L, p = (long *)rep->data.events; i<XETrapCoreEvents; i++, p++)
- {
- swapl(p,n);
- }
- (void)WriteToClient(client,size,reply);
- return;
-}
-
-/* Out-going XTrap I/O header needing to be swapped *from* native format */
-
-void sXETrapHeader(XETrapHeader *hdr)
-{
- register char n;
-
- swapl(&(hdr->count), n);
- swapl(&(hdr->timestamp), n);
- swaps(&(hdr->win_x), n);
- swaps(&(hdr->win_y), n);
- swaps(&(hdr->client), n);
-}
-
- /* Out-going requests needing to be swapped *from* native format
- * aka swapreq.c "equivalents"
- */
-
-/* The following is used for all requests that have
- no fields to be swapped (except "length") */
-void XETSwSimpleReq(register xReq *data)
-{
- register char n;
- swaps(&(data->length), n);
-}
-
-/* The following is used for all requests that have
- only a single 32-bit field to be swapped, coming
- right after the "length" field */
-
-void XETSwResourceReq(register xResourceReq *data)
-{
- register char n;
-
- swaps(&(data->length), n);
- swapl(&(data->id), n);
-}
-
-void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client)
-{
- register char n;
-
- swapl(&(data->wid), n);
- swapl(&(data->parent), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
- swaps(&(data->borderWidth), n);
- swaps(&(data->class), n);
- swapl(&(data->visual), n);
- swapl(&(data->mask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data,
-ClientPtr client)
-{
- register char n;
-
- swapl(&(data->window), n);
- swapl(&(data->valueMask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwReparentWindow(register xReparentWindowReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->parent), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
-}
-
-void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client)
-{
- register char n;
- swapl(&(data->window), n);
- swaps(&(data->mask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-
-void XETSwInternAtom(register xInternAtomReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwChangeProperty(register xChangePropertyReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->property), n);
- swapl(&(data->type), n);
- switch ( data->format ) {
- case 8L : break;
- case 16L:
- SwapShorts((short *)(data + 1), data->nUnits);
- break;
- case 32L:
- SwapLongs((CARD32 *)(data + 1), data->nUnits);
- break;
- }
- swapl(&(data->nUnits), n);
-}
-
-void XETSwDeleteProperty(register xDeletePropertyReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->property), n);
-
-}
-void XETSwGetProperty(register xGetPropertyReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->property), n);
- swapl(&(data->type), n);
- swapl(&(data->longOffset), n);
- swapl(&(data->longLength), n);
-}
-
-void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->selection), n);
- swapl(&(data->time), n);
-}
-
-void XETSwConvertSelection(register xConvertSelectionReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->requestor), n);
- swapl(&(data->selection), n);
- swapl(&(data->target), n);
- swapl(&(data->property), n);
- swapl(&(data->time), n);
-}
-
-void XETSwSendEvent(register xSendEventReq *data)
-{
- register char n;
- xEvent eventT;
- void (*proc)();
- swapl(&(data->destination), n);
- swapl(&(data->eventMask), n);
-
- /* Swap event */
- proc = EventSwapVector[data->event.u.u.type & 0177];
- if (!proc || (int (*)()) proc == (int (*)()) NotImplemented)
- (*proc)(&(data->event), &eventT);
- data->event = eventT;
- swaps(&(data->length), n);
-}
-
-void XETSwGrabPointer(register xGrabPointerReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swaps(&(data->eventMask), n);
- swapl(&(data->confineTo), n);
- swapl(&(data->cursor), n);
- swapl(&(data->time), n);
-}
-
-void XETSwGrabButton(register xGrabButtonReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swaps(&(data->eventMask), n);
- swapl(&(data->confineTo), n);
- swapl(&(data->cursor), n);
- swaps(&(data->modifiers), n);
-}
-
-void XETSwUngrabButton(register xUngrabButtonReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swaps(&(data->modifiers), n);
-}
-
-void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cursor), n);
- swapl(&(data->time), n);
- swaps(&(data->eventMask), n);
-}
-
-void XETSwGrabKeyboard(register xGrabKeyboardReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swapl(&(data->time), n);
-}
-
-void XETSwGrabKey(register xGrabKeyReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swaps(&(data->modifiers), n);
-}
-
-void XETSwUngrabKey(register xUngrabKeyReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->grabWindow), n);
- swaps(&(data->modifiers), n);
-}
-
-void XETSwGetMotionEvents(register xGetMotionEventsReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swapl(&(data->start), n);
- swapl(&(data->stop), n);
-}
-
-void XETSwTranslateCoords(register xTranslateCoordsReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->srcWid), n);
- swapl(&(data->dstWid), n);
- swaps(&(data->srcX), n);
- swaps(&(data->srcY), n);
-}
-
-void XETSwWarpPointer(register xWarpPointerReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->srcWid), n);
- swapl(&(data->dstWid), n);
- swaps(&(data->srcX), n);
- swaps(&(data->srcY), n);
- swaps(&(data->srcWidth), n);
- swaps(&(data->srcHeight), n);
- swaps(&(data->dstX), n);
- swaps(&(data->dstY), n);
-}
-
-void XETSwSetInputFocus(register xSetInputFocusReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->focus), n);
- swapl(&(data->time), n);
-}
-
-void XETSwOpenFont(register xOpenFontReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->fid), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwListFonts(register xListFontsReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->maxNames), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->maxNames), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwSetFontPath(register xSetFontPathReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->nFonts), n);
-}
-
-void XETSwCreatePixmap(register xCreatePixmapReq *data)
-{
- register char n;
-
- swaps(&(data->length), n);
- swapl(&(data->pid), n);
- swapl(&(data->drawable), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
-}
-
-void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client)
-{
- register char n;
- swapl(&(data->gc), n);
- swapl(&(data->drawable), n);
- swapl(&(data->mask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client)
-{
- register char n;
- swapl(&(data->gc), n);
- swapl(&(data->mask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwCopyGC(register xCopyGCReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->srcGC), n);
- swapl(&(data->dstGC), n);
- swapl(&(data->mask), n);
-}
-
-void XETSwSetDashes(register xSetDashesReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->gc), n);
- swaps(&(data->dashOffset), n);
- swaps(&(data->nDashes), n);
-}
-
-void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr
-client)
-{
- register char n;
- swapl(&(data->gc), n);
- swaps(&(data->xOrigin), n);
- swaps(&(data->yOrigin), n);
- SwapRestS(data);
- swaps(&(data->length), n);
-}
-
-void XETSwClearToBackground(register xClearAreaReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->window), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
-}
-
-void XETSwCopyArea(register xCopyAreaReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->srcDrawable), n);
- swapl(&(data->dstDrawable), n);
- swapl(&(data->gc), n);
- swaps(&(data->srcX), n);
- swaps(&(data->srcY), n);
- swaps(&(data->dstX), n);
- swaps(&(data->dstY), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
-}
-
-void XETSwCopyPlane(register xCopyPlaneReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->srcDrawable), n);
- swapl(&(data->dstDrawable), n);
- swapl(&(data->gc), n);
- swaps(&(data->srcX), n);
- swaps(&(data->srcY), n);
- swaps(&(data->dstX), n);
- swaps(&(data->dstY), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
- swapl(&(data->bitPlane), n);
-}
-
-/* The following routine is used for all Poly drawing requests
- (except FillPoly, which uses a different request format) */
-void XETSwPoly(register xPolyPointReq *data, ClientPtr client)
-{
- register char n;
-
- swapl(&(data->drawable), n);
- swapl(&(data->gc), n);
- SwapRestS(data);
- swaps(&(data->length), n);
-}
- /* cannot use XETSwPoly for this one, because xFillPolyReq
- * is longer than xPolyPointReq, and we don't want to swap
- * the difference as shorts!
- */
-void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client)
-{
- register char n;
-
- swapl(&(data->drawable), n);
- swapl(&(data->gc), n);
- SwapRestS(data);
- swaps(&(data->length), n);
-}
-
-void XETSwPutImage(register xPutImageReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->drawable), n);
- swapl(&(data->gc), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
- swaps(&(data->dstX), n);
- swaps(&(data->dstY), n);
- /* Image should already be swapped */
-}
-
-void XETSwGetImage(register xGetImageReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->drawable), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
- swapl(&(data->planeMask), n);
-}
-
-/* ProcPolyText used for both PolyText8 and PolyText16 */
-
-void XETSwPolyText(register xPolyTextReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->drawable), n);
- swapl(&(data->gc), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
-}
-
-/* ProcImageText used for both ImageText8 and ImageText16 */
-
-void XETSwImageText(register xImageTextReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->drawable), n);
- swapl(&(data->gc), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
-}
-
-void XETSwCreateColormap(register xCreateColormapReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->mid), n);
- swapl(&(data->window), n);
- swapl(&(data->visual), n);
-}
-
-
-void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->mid), n);
- swapl(&(data->srcCmap), n);
-
-}
-
-void XETSwAllocColor (register xAllocColorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swaps(&(data->red), n);
- swaps(&(data->green), n);
- swaps(&(data->blue), n);
-}
-
-void XETSwAllocNamedColor (register xAllocNamedColorReq *data)
-{
- register char n;
-
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwAllocColorCells (register xAllocColorCellsReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swaps(&(data->colors), n);
- swaps(&(data->planes), n);
-}
-
-void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swaps(&(data->colors), n);
- swaps(&(data->red), n);
- swaps(&(data->green), n);
- swaps(&(data->blue), n);
-}
-
-void XETSwFreeColors (register xFreeColorsReq *data, ClientPtr
-client)
-{
- register char n;
- swapl(&(data->cmap), n);
- swapl(&(data->planeMask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-
-}
-
-void XETSwStoreColors (register xStoreColorsReq *data,ClientPtr
-client)
-{
- register char n;
- unsigned long count;
- xColorItem *pItem;
-
- swapl(&(data->cmap), n);
- pItem = (xColorItem *) &(data[1]);
- for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--)
- SwapColorItem(pItem++);
- swaps(&(data->length), n);
-}
-
-void XETSwStoreNamedColor (register xStoreNamedColorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swapl(&(data->pixel), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client)
-{
- register char n;
- swapl(&(data->cmap), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwLookupColor(register xLookupColorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cmap), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwCreateCursor(register xCreateCursorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cid), n);
- swapl(&(data->source), n);
- swapl(&(data->mask), n);
- swaps(&(data->foreRed), n);
- swaps(&(data->foreGreen), n);
- swaps(&(data->foreBlue), n);
- swaps(&(data->backRed), n);
- swaps(&(data->backGreen), n);
- swaps(&(data->backBlue), n);
- swaps(&(data->x), n);
- swaps(&(data->y), n);
-}
-
-void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cid), n);
- swapl(&(data->source), n);
- swapl(&(data->mask), n);
- swaps(&(data->sourceChar), n);
- swaps(&(data->maskChar), n);
- swaps(&(data->foreRed), n);
- swaps(&(data->foreGreen), n);
- swaps(&(data->foreBlue), n);
- swaps(&(data->backRed), n);
- swaps(&(data->backGreen), n);
- swaps(&(data->backBlue), n);
-}
-
-
-void XETSwRecolorCursor(register xRecolorCursorReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->cursor), n);
- swaps(&(data->foreRed), n);
- swaps(&(data->foreGreen), n);
- swaps(&(data->foreBlue), n);
- swaps(&(data->backRed), n);
- swaps(&(data->backGreen), n);
- swaps(&(data->backBlue), n);
-}
-
-void XETSwQueryBestSize (register xQueryBestSizeReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swapl(&(data->drawable), n);
- swaps(&(data->width), n);
- swaps(&(data->height), n);
-
-}
-
-void XETSwQueryExtension (register xQueryExtensionReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->nbytes), n);
-}
-
-void XETSwChangeKeyboardMapping (register xChangeKeyboardMappingReq *data)
-{
- register char n;
- register long *p;
- register int i, count;
-
- swaps(&(data->length), n);
- p = (long *)&(data[1]);
- count = data->keyCodes * data->keySymsPerKeyCode;
- for(i = 0; i < count; i++)
- {
- swapl(p, n);
- p++;
- }
-}
-
-
-void XETSwChangeKeyboardControl (register xChangeKeyboardControlReq *data,
- ClientPtr client)
-{
- register char n;
- swapl(&(data->mask), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-void XETSwChangePointerControl (register xChangePointerControlReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->accelNum), n);
- swaps(&(data->accelDenum), n);
- swaps(&(data->threshold), n);
-}
-
-
-void XETSwSetScreenSaver (register xSetScreenSaverReq *data)
-{
- register char n;
- swaps(&(data->length), n);
- swaps(&(data->timeout), n);
- swaps(&(data->interval), n);
-}
-
-void XETSwChangeHosts(register xChangeHostsReq *data)
-{
- register char n;
-
- swaps(&(data->length), n);
- swaps(&(data->hostLength), n);
-
-}
-void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client)
-{
- register char n;
- swapl(&(data->window), n);
- swaps(&(data->nAtoms), n);
- swaps(&(data->nPositions), n);
- SwapRestL(data);
- swaps(&(data->length), n);
-}
-
-/*ARGSUSED*/
-void XETSwNoOperation(xReq *data)
-{
- /* noop -- don't do anything */
-}
-
-/* Byte swap a list of longs */
-#if defined vms && !defined MITR5
-#ifndef LINKED_IN
-void SwapLongs ( register long *list, register unsigned long count)
-{
- register char n;
-
- while (count >= 8) {
- swapl(list+0, n);
- swapl(list+1, n);
- swapl(list+2, n);
- swapl(list+3, n);
- swapl(list+4, n);
- swapl(list+5, n);
- swapl(list+6, n);
- swapl(list+7, n);
- list += 8;
- count -= 8;
- }
- if (count != 0) {
- do {
- swapl(list, n);
- list++;
- } while (--count != 0);
- }
-}
-
-/* Byte swap a list of shorts */
-
-void SwapShorts (register short *list, register unsigned long count)
-{
- register char n;
-
- while (count >= 16) {
- swaps(list+0, n);
- swaps(list+1, n);
- swaps(list+2, n);
- swaps(list+3, n);
- swaps(list+4, n);
- swaps(list+5, n);
- swaps(list+6, n);
- swaps(list+7, n);
- swaps(list+8, n);
- swaps(list+9, n);
- swaps(list+10, n);
- swaps(list+11, n);
- swaps(list+12, n);
- swaps(list+13, n);
- swaps(list+14, n);
- swaps(list+15, n);
- list += 16;
- count -= 16;
- }
- if (count != 0) {
- do {
- swaps(list, n);
- list++;
- } while (--count != 0);
- }
-}
-
-SwapColorItem(xColorItem *pItem)
-{
- register char n;
- swapl(&pItem->pixel, n);
- swaps(&pItem->red, n);
- swaps(&pItem->green, n);
- swaps(&pItem->blue, n);
-}
-#endif /* LINKED_IN */
-#endif /* vms */
diff --git a/nx-X11/programs/Xserver/XTrap/xtrapditbl.c b/nx-X11/programs/Xserver/XTrap/xtrapditbl.c
deleted file mode 100644
index 10a070e9e..000000000
--- a/nx-X11/programs/Xserver/XTrap/xtrapditbl.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* $XFree86$ */
-/****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-*****************************************************************************/
-/*
- * ABSTRACT:
- *
- * This module is contains Vector tables used for swapping and general
- * dispatch by the XTrap server extension.
- *
- * CONTRIBUTORS:
- *
- * Ken Miller
- * Marc Evans
- *
- */
-
-/*-----------------*
- * Include Files *
- *-----------------*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <nx-X11/X.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <nx-X11/Xproto.h>
-#include <nx-X11/Xprotostr.h>
-#include <nx-X11/extensions/xtrapdi.h>
-#include "input.h" /* Server DevicePtr definitions */
-#include "misc.h"
-#include "dixstruct.h"
-#ifdef PC
-# include "extnsist.h"
-#else
-# include "extnsionst.h" /* Server ExtensionEntry definitions */
-#endif
-#include <nx-X11/extensions/xtrapddmi.h>
-#include <nx-X11/extensions/xtrapproto.h>
-
-globaldef void_function XETSwProcVector[256L] =
-{
- (void_function)ProcBadRequest,
- XETSwCreateWindow,
- XETSwChangeWindowAttributes,
- XETSwResourceReq, /* GetWindowAttributes */
- XETSwResourceReq, /* DestroyWindow */
- XETSwResourceReq, /* 5 DestroySubwindows */
- XETSwResourceReq, /* XETSwChangeSaveSet, */
- XETSwReparentWindow,
- XETSwResourceReq, /* MapWindow */
- XETSwResourceReq, /* MapSubwindows */
- XETSwResourceReq, /* 10 UnmapWindow */
- XETSwResourceReq, /* UnmapSubwindows */
- XETSwConfigureWindow,
- XETSwResourceReq, /* XETSwCirculateWindow, */
- XETSwResourceReq, /* GetGeometry */
- XETSwResourceReq, /* 15 QueryTree */
- XETSwInternAtom,
- XETSwResourceReq, /* XETSwGetAtomName, */
- XETSwChangeProperty,
- XETSwDeleteProperty,
- XETSwGetProperty, /* 20 */
- XETSwResourceReq, /* XETSwListProperties, */
- XETSwSetSelectionOwner,
- XETSwResourceReq, /* XETSwGetSelectionOwner, */
- XETSwConvertSelection,
- XETSwSendEvent, /* 25 */
- XETSwGrabPointer,
- XETSwResourceReq, /* XETSwUngrabPointer, */
- XETSwGrabButton,
- XETSwUngrabButton,
- XETSwChangeActivePointerGrab, /* 30 */
- XETSwGrabKeyboard,
- XETSwResourceReq, /* XETSwUngrabKeyboard, */
- XETSwGrabKey,
- XETSwUngrabKey,
- XETSwResourceReq, /* 35 XETSwAllowEvents, */
- XETSwSimpleReq, /* XETSwGrabServer, */
- XETSwSimpleReq, /* XETSwUngrabServer, */
- XETSwResourceReq, /* XETSwQueryPointer, */
- XETSwGetMotionEvents,
- XETSwTranslateCoords, /*40 */
- XETSwWarpPointer,
- XETSwSetInputFocus,
- XETSwSimpleReq, /* XETSwGetInputFocus, */
- XETSwSimpleReq, /* QueryKeymap, */
- XETSwOpenFont, /* 45 */
- XETSwResourceReq, /* XETSwCloseFont, */
- XETSwResourceReq, /* XETSwQueryFont, */
- XETSwResourceReq, /* XETSwQueryTextExtents, */
- XETSwListFonts,
- XETSwListFontsWithInfo, /* 50 */
- XETSwSetFontPath,
- XETSwSimpleReq, /* GetFontPath, */
- XETSwCreatePixmap,
- XETSwResourceReq, /* XETSwFreePixmap, */
- XETSwCreateGC, /* 55 */
- XETSwChangeGC,
- XETSwCopyGC,
- XETSwSetDashes,
- XETSwSetClipRectangles,
- XETSwResourceReq, /* 60 XETSwFreeGC, */
- XETSwClearToBackground,
- XETSwCopyArea,
- XETSwCopyPlane,
- XETSwPoly, /* PolyPoint, */
- XETSwPoly, /* 65 PolyLine */
- XETSwPoly, /* PolySegment, */
- XETSwPoly, /* PolyRectangle, */
- XETSwPoly, /* PolyArc, */
- XETSwFillPoly,
- XETSwPoly, /* 70 PolyFillRectangle */
- XETSwPoly, /* PolyFillArc, */
- XETSwPutImage,
- XETSwGetImage,
- XETSwPolyText,
- XETSwPolyText, /* 75 */
- XETSwImageText,
- XETSwImageText,
- XETSwCreateColormap,
- XETSwResourceReq, /* XETSwFreeColormap, */
- XETSwCopyColormapAndFree, /* 80 */
- XETSwResourceReq, /* XETSwInstallColormap, */
- XETSwResourceReq, /* XETSwUninstallColormap, */
- XETSwResourceReq, /* XETSwListInstalledColormaps, */
- XETSwAllocColor,
- XETSwAllocNamedColor, /* 85 */
- XETSwAllocColorCells,
- XETSwAllocColorPlanes,
- XETSwFreeColors,
- XETSwStoreColors,
- XETSwStoreNamedColor, /* 90 */
- XETSwQueryColors,
- XETSwLookupColor,
- XETSwCreateCursor,
- XETSwCreateGlyphCursor,
- XETSwResourceReq, /* 95 XETSwFreeCursor, */
- XETSwRecolorCursor,
- XETSwQueryBestSize,
- XETSwQueryExtension,
- XETSwSimpleReq, /* ListExtensions, */
- XETSwChangeKeyboardMapping, /* 100 */
- XETSwSimpleReq, /* GetKeyboardMapping, */
- XETSwChangeKeyboardControl,
- XETSwSimpleReq, /* GetKeyboardControl, */
- XETSwSimpleReq, /* Bell, */
- XETSwChangePointerControl, /* 105 */
- XETSwSimpleReq, /* GetPointerControl, */
- XETSwSetScreenSaver,
- XETSwSimpleReq, /* GetScreenSaver, */
- XETSwChangeHosts,
- XETSwSimpleReq, /* 110 ListHosts, */
- XETSwSimpleReq, /* XETSwChangeAccessControl, */
- XETSwSimpleReq, /* XETSwChangeCloseDownMode, */
- XETSwResourceReq, /* XETSwKillClient, */
- XETSwRotateProperties,
- XETSwSimpleReq, /* 115 ForceScreenSaver */
- XETSwSimpleReq, /* SetPointerMapping, */
- XETSwSimpleReq, /* GetPointerMapping, */
- XETSwSimpleReq, /* SetModifierMapping, */
- XETSwSimpleReq, /* GetModifierMapping, */
- NotImplemented, /* 120 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 125 */
- NotImplemented,
- XETSwNoOperation
-};
-
-/* NOTE: This array must align with the values of the constants used
- * as minor_opcode values in the request structure. Failure to do this
- * could result in random code paths.
- */
-globaldef int_function XETrapDispatchVector[10L] =
-{
- XETrapReset, /* 0 XETrap_Reset */
- XETrapGetAvailable, /* 1 XETrap_GetAvailable */
- XETrapConfig, /* 2 XETrap_Config */
- XETrapStartTrap, /* 3 XETrap_StartTrap */
- XETrapStopTrap, /* 4 XETrap_StopTrap */
- XETrapGetCurrent, /* 5 XETrap_GetCurrent */
- XETrapGetStatistics, /* 6 XETrap_GetStatistics */
-#ifndef _XINPUT
- XETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
-#endif
- XETrapGetVersion, /* 8 XETrap_GetVersion */
- XETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
-};
-
-/* NOTE: This array must align with the values of the constants used
- * as minor_opcode values in the request structure. Failure to do this
- * could result in random code paths.
- */
-globaldef int_function XETSwDispatchVector[10L] =
-{
- sXETrapReset, /* 0 XETrap_Reset */
- sXETrapGetAvailable, /* 1 XETrap_GetAvailable */
- sXETrapConfig, /* 2 XETrap_Config */
- sXETrapStartTrap, /* 3 XETrap_StartTrap */
- sXETrapStopTrap, /* 4 XETrap_StopTrap */
- sXETrapGetCurrent, /* 5 XETrap_GetCurrent */
- sXETrapGetStatistics, /* 6 XETrap_GetStatistics */
-#ifndef _XINPUT
- sXETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
-#endif
- sXETrapGetVersion, /* 8 XETrap_GetVersion */
- sXETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
-};
-
-/* ProcVector shadow vector */
-globaldef int_function XETrapProcVector[256L] = {XETrapRequestVector};
-/*
- * Events are faked as if they're vectored since that's
- * the way it'll eventually be (X11 R5?).
- */
-#ifndef VECTORED_EVENTS
-globaldef int_function EventProcVector[XETrapCoreEvents] = {NULL};
-#endif
-globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL};
-
-
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;
- }
-}
diff --git a/nx-X11/programs/Xserver/dix/colormap.c b/nx-X11/programs/Xserver/dix/colormap.c
index cd5e1dc49..4acfdc1bb 100644
--- a/nx-X11/programs/Xserver/dix/colormap.c
+++ b/nx-X11/programs/Xserver/dix/colormap.c
@@ -63,9 +63,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include "resource.h"
#include "windowstr.h"
-#ifdef LBX
-#include "lbxserve.h"
-#endif
extern XID clientErrorValue;
extern int colormapPrivateCount;
@@ -1508,65 +1505,17 @@ FreePixels(register ColormapPtr pmap, register int client)
register Pixel *ppix, *ppixStart;
register int n;
int class;
-#ifdef LBX
- Bool grabbed;
- Bool zeroRefCount;
- Bool anyRefCountReachedZero = 0;
-#endif
class = pmap->class;
ppixStart = pmap->clientPixelsRed[client];
if (class & DynamicClass)
{
n = pmap->numPixelsRed[client];
-#ifdef LBX
- grabbed = LbxCheckCmapGrabbed (pmap);
- if (grabbed)
- {
- /*
- * If the colormap is grabbed by a proxy, the server must
- * notify the proxy of all cells that are freed (the refcount
- * has reached zero on these cells).
- */
-
- LbxBeginFreeCellsEvent (pmap);
- LbxSortPixelList (ppixStart, n);
- }
-#endif
for (ppix = ppixStart; --n >= 0; )
{
FreeCell(pmap, *ppix, REDMAP);
-#ifdef LBX
- /*
- * Only PSEUDO colormaps are grabbed by LBX proxies.
- * Check if the ref count reached zero on this pixel.
- */
-
- zeroRefCount = pmap->red[*ppix].refcnt == 0;
- if (zeroRefCount)
- anyRefCountReachedZero = 1;
-
- if (grabbed && zeroRefCount)
- LbxAddFreeCellToEvent (pmap, *ppix);
-#endif
ppix++;
}
-#ifdef LBX
- if (grabbed)
- LbxEndFreeCellsEvent (pmap);
- else if (anyRefCountReachedZero)
- {
- /*
- * We only send LbxFreeCell events to a proxy that has the colormap
- * grabbed. If the colormap is not grabbed, the proxy that last
- * had the colormap grabbed will not be able to do a smart grab
- * in the future. A smart grab can only occur if the proxy is kept
- * up to date on every alloc/free change in the colormap.
- */
-
- LbxDisableSmartGrab (pmap);
- }
-#endif
}
xfree(ppixStart);
@@ -2316,11 +2265,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
int n, zapped;
int errVal = Success;
int offset, numents;
-#ifdef LBX
- Bool grabbed;
- Bool zeroRefCount;
- Bool anyRefCountReachedZero = 0;
-#endif
if (npixIn == 0)
return (errVal);
@@ -2365,22 +2309,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
break;
}
-#ifdef LBX
- grabbed = LbxCheckCmapGrabbed (pmap);
-
- if (grabbed)
- {
- /*
- * If the colormap is grabbed by a proxy, the server must
- * notify the proxy of all cells that are freed (the refcount
- * has reached zero on these cells).
- */
-
- LbxBeginFreeCellsEvent (pmap);
- LbxSortPixelList (ppixIn, npixIn);
- }
-#endif
-
/* zap all pixels which match */
while (1)
{
@@ -2405,19 +2333,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
if (pmap->class & DynamicClass)
{
FreeCell(pmap, pixTest, color);
-#ifdef LBX
- /*
- * Only PSEUDO colormaps are grabbed by LBX proxies.
- * Check if the ref count reached zero on this pixel.
- */
-
- zeroRefCount = pmap->red[pixTest].refcnt == 0;
- if (zeroRefCount)
- anyRefCountReachedZero = 1;
-
- if (grabbed && zeroRefCount)
- LbxAddFreeCellToEvent (pmap, pixTest);
-#endif
}
*cptr = ~((Pixel)0);
zapped++;
@@ -2429,23 +2344,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
GetNextBitsOrBreak(bits, mask, base);
}
-#ifdef LBX
- if (grabbed)
- LbxEndFreeCellsEvent (pmap);
- else if (anyRefCountReachedZero)
- {
- /*
- * We only send LbxFreeCell events to a proxy that has the colormap
- * grabbed. If the colormap is not grabbed, the proxy that last
- * had the colormap grabbed will not be able to do a smart grab
- * in the future. A smart grab can only occur if the proxy is kept
- * up to date on every alloc/free change in the colormap.
- */
-
- LbxDisableSmartGrab (pmap);
- }
-#endif
-
/* delete freed pixels from client pixel list */
if (zapped)
{
diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index 91a92644c..49ab80529 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -74,9 +74,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#include "dispatch.h"
#include "swaprep.h"
@@ -961,9 +958,6 @@ ProcSetModifierMapping(ClientPtr client)
return BadAccess;
#endif
-#ifdef LBX
- LbxFlushModifierMapTag();
-#endif
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -1088,9 +1082,6 @@ ProcChangeKeyboardMapping(ClientPtr client)
keysyms.map = (KeySym *)&stuff[1];
if (!SetKeySymsMap(curKeySyms, &keysyms))
return BadAlloc;
-#ifdef LBX
- LbxFlushKeyboardMapTag();
-#endif
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
client);
return client->noClientException;
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index 009e1ac08..a76c0723c 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -104,24 +104,18 @@ int ProcInitialConnection();
#include "swaprep.h"
#include "swapreq.h"
#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
+#include "../Xext/panoramiX.h"
+#include "../Xext/panoramiXsrv.h"
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
-#ifdef XAPPGROUP
-#include <nx-X11/extensions/Xagsrv.h>
-#endif
#ifdef XKB
#define XKB_IN_SERVER
#include "inputstr.h"
#include <nx-X11/extensions/XKBsrv.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
@@ -2617,15 +2611,6 @@ ProcAllocColor (register ClientPtr client)
RT_COLORMAP, SecurityWriteAccess);
if (pmap)
{
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColor request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pmap, (xReq *) stuff))
- return Success;
-#endif
acr.type = X_Reply;
acr.length = 0;
acr.sequenceNumber = client->sequence;
@@ -2670,15 +2655,6 @@ ProcAllocNamedColor (register ClientPtr client)
xAllocNamedColorReply ancr;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocNamedColor request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
ancr.type = X_Reply;
ancr.length = 0;
ancr.sequenceNumber = client->sequence;
@@ -2732,15 +2708,6 @@ ProcAllocColorCells (register ClientPtr client)
long length;
Pixel *ppixels, *pmasks;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColorCells request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
npixels = stuff->colors;
if (!npixels)
{
@@ -2807,15 +2774,6 @@ ProcAllocColorPlanes(register ClientPtr client)
long length;
Pixel *ppixels;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColorPlanes request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
npixels = stuff->colors;
if (!npixels)
{
@@ -3589,9 +3547,6 @@ CloseDownClient(register ClientPtr client)
if (ClientIsAsleep(client))
ClientSignal (client);
ProcessWorkQueueZombies();
-#ifdef LBX
- ProcessQTagZombies();
-#endif
CloseDownConnection(client);
/* If the client made it to the Running stage, nClients has
@@ -3709,17 +3664,11 @@ void InitClient(ClientPtr client, int i, void * ospriv)
}
#endif
client->replyBytesRemaining = 0;
-#ifdef LBX
- client->readRequest = StandardReadRequestFromClient;
-#endif
#ifdef XCSECURITY
client->trustLevel = XSecurityClientTrusted;
client->CheckAccess = NULL;
client->authId = 0;
#endif
-#ifdef XAPPGROUP
- client->appgroup = NULL;
-#endif
client->fontResFunc = NULL;
#ifdef SMART_SCHEDULE
client->smart_priority = 0;
@@ -3845,14 +3794,6 @@ ProcInitialConnection(register ClientPtr client)
return (client->noClientException);
}
-#ifdef LBX
-void
-IncrementClientCount()
-{
- nClients++;
-}
-#endif
-
int
SendConnSetup(register ClientPtr client, char *reason)
{
@@ -3892,9 +3833,6 @@ SendConnSetup(register ClientPtr client, char *reason)
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
-#ifdef XAPPGROUP
- XagConnectionInfo (client, &lconnSetupPrefix, &lConnectionInfo, &numScreens);
-#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
#ifdef MATCH_CLIENT_ENDIAN
diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c
index 1f92ff824..ffa69c009 100644
--- a/nx-X11/programs/Xserver/dix/dixfonts.c
+++ b/nx-X11/programs/Xserver/dix/dixfonts.c
@@ -133,10 +133,6 @@ _NXGetFontPathError:
#include "panoramiX.h"
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
-
#ifdef XF86BIGFONT
#define _XF86BIGFONT_SERVER_
#include <nx-X11/extensions/xf86bigfont.h>
@@ -557,9 +553,6 @@ CloseFont(void * value, XID fid)
}
if (pfont == defaultFont)
defaultFont = NULL;
-#ifdef LBX
- LbxFreeFontTag(pfont);
-#endif
#ifdef XF86BIGFONT
XF86BigfontFreeFontShm(pfont);
#endif
diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c
index 3163270f4..9005cd226 100644
--- a/nx-X11/programs/Xserver/dix/events.c
+++ b/nx-X11/programs/Xserver/dix/events.c
@@ -143,20 +143,6 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#include <nx-X11/extensions/security.h>
#endif
-#ifdef XEVIE
-extern WindowPtr *WindowTable;
-extern int xevieFlag;
-extern int xevieClientIndex;
-extern DeviceIntPtr xeviemouse;
-extern DeviceIntPtr xeviekb;
-extern Mask xevieMask;
-extern Mask xevieFilters[128];
-extern int xevieEventSent;
-extern int xevieKBEventSent;
-int xeviegrabState = 0;
-xEvent *xeviexE;
-#endif
-
#include <nx-X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
@@ -253,11 +239,6 @@ static struct {
#endif
} sprite; /* info about the cursor sprite */
-#ifdef XEVIE
-WindowPtr xeviewin;
-HotSpot xeviehot;
-#endif
-
static void DoEnterLeaveEvents(
WindowPtr fromWin,
WindowPtr toWin,
@@ -462,13 +443,7 @@ XineramaCheckVirtualMotion(
if (qe)
{
sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
NullWindow;
@@ -505,24 +480,12 @@ XineramaCheckVirtualMotion(
lims = *RegionExtents(&sprite.Reg2);
if (sprite.hot.x < lims.x1)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = lims.x1;
else if (sprite.hot.x >= lims.x2)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = lims.x2 - 1;
if (sprite.hot.y < lims.y1)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = lims.y1;
else if (sprite.hot.y >= lims.y2)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = lims.y2 - 1;
if (RegionNumRects(&sprite.Reg2) > 1)
@@ -552,33 +515,15 @@ XineramaCheckMotion(xEvent *xE)
panoramiXdataPtr[0].x;
XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
panoramiXdataPtr[0].y;
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = XE_KBPTR.rootX;
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = sprite.physLimits.x2 - 1;
if (sprite.hot.y < sprite.physLimits.y1)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = sprite.physLimits.y1;
else if (sprite.hot.y >= sprite.physLimits.y2)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = sprite.physLimits.y2 - 1;
if (sprite.hotShape)
@@ -595,9 +540,6 @@ XineramaCheckMotion(xEvent *xE)
XE_KBPTR.rootY = sprite.hot.y;
}
-#ifdef XEVIE
- xeviewin =
-#endif
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
if (sprite.win != prevSpriteWin)
@@ -821,13 +763,7 @@ CheckVirtualMotion(
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
NullWindow;
@@ -839,31 +775,16 @@ CheckVirtualMotion(
if (sprite.hot.pScreen != pWin->drawable.pScreen)
{
sprite.hot.pScreen = pWin->drawable.pScreen;
-#ifdef XEVIE
- xeviehot.x = xeviehot.y = 0;
-#endif
sprite.hot.x = sprite.hot.y = 0;
}
lims = *RegionExtents(&pWin->borderSize);
if (sprite.hot.x < lims.x1)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = lims.x1;
else if (sprite.hot.x >= lims.x2)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = lims.x2 - 1;
if (sprite.hot.y < lims.y1)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = lims.y1;
else if (sprite.hot.y >= lims.y2)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = lims.y2 - 1;
#ifdef SHAPE
if (wBoundingShape(pWin))
@@ -2057,33 +1978,15 @@ CheckMotion(xEvent *xE)
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = XE_KBPTR.rootX;
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
-#ifdef XEVIE
- xeviehot.x =
-#endif
sprite.hot.x = sprite.physLimits.x2 - 1;
if (sprite.hot.y < sprite.physLimits.y1)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = sprite.physLimits.y1;
else if (sprite.hot.y >= sprite.physLimits.y2)
-#ifdef XEVIE
- xeviehot.y =
-#endif
sprite.hot.y = sprite.physLimits.y2 - 1;
#ifdef SHAPE
if (sprite.hotShape)
@@ -2101,9 +2004,6 @@ CheckMotion(xEvent *xE)
XE_KBPTR.rootY = sprite.hot.y;
}
-#ifdef XEVIE
- xeviewin =
-#endif
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
#ifdef notyet
if (!(sprite.win->deliverableEvents &
@@ -2183,9 +2083,6 @@ DefineInitialRootWindow(register WindowPtr win)
sprite.hot = sprite.hotPhys;
sprite.hotLimits.x2 = pScreen->width;
sprite.hotLimits.y2 = pScreen->height;
-#ifdef XEVIE
- xeviewin =
-#endif
sprite.win = win;
sprite.current = wCursor (win);
sprite.current->refcnt++;
@@ -2764,45 +2661,6 @@ ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int coun
GrabPtr grab = keybd->grab;
Bool deactivateGrab = FALSE;
register KeyClassPtr keyc = keybd->key;
-#ifdef XEVIE
- static Window rootWin = 0;
-
- if(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
- (xevieMask & xevieFilters[xE->u.u.type])) {
- key = xE->u.u.detail;
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
- if((xE->u.u.type == KeyPress && (*kptr & bit)) ||
- (xE->u.u.type == KeyRelease && !(*kptr & bit)))
- {} else {
-#ifdef XKB
- if(!noXkbExtension)
- xevieKBEventSent = 1;
-#endif
- if(!xevieKBEventSent)
- {
- xeviekb = keybd;
- if(!rootWin) {
- rootWin = GetCurrentRootWindow()->drawable.id;
- }
- xE->u.keyButtonPointer.event = xeviewin->drawable.id;
- xE->u.keyButtonPointer.root = rootWin;
- 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;
- WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
-#ifdef XKB
- if(noXkbExtension)
-#endif
- return;
- } else {
- xevieKBEventSent = 0;
- }
- }
- }
-#endif
if (!syncEvents.playingEvents)
{
@@ -2815,15 +2673,6 @@ drawable.id:0;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
}
}
-#ifdef XEVIE
- /* fix for bug5094030: don't change the state bit if the event is from XEvIE client */
- if(!(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
- (xevieMask & xevieFilters[xE->u.u.type]
-#ifdef XKB
- && !noXkbExtension
-#endif
- )))
-#endif
XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
XE_KBPTR.rootX = sprite.hot.x;
XE_KBPTR.rootY = sprite.hot.y;
@@ -2831,16 +2680,6 @@ drawable.id:0;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
modifiers = keyc->modifierMap[key];
-#if defined(XKB) && defined(XEVIE)
- if(!noXkbExtension && !xeviegrabState &&
- xevieFlag && clients[xevieClientIndex] &&
- (xevieMask & xevieFilters[xE->u.u.type])) {
- switch(xE->u.u.type) {
- case KeyPress: *kptr &= ~bit; break;
- case KeyRelease: *kptr |= bit; break;
- }
- }
-#endif
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
@@ -2963,18 +2802,6 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
#ifdef XKB
XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo;
#endif
-#ifdef XEVIE
- if(xevieFlag && clients[xevieClientIndex] && !xeviegrabState &&
- (xevieMask & xevieFilters[xE->u.u.type])) {
- if(xevieEventSent)
- xevieEventSent = 0;
- else {
- xeviemouse = mouse;
- WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
- return;
- }
- }
-#endif
if (!syncEvents.playingEvents)
NoticeTime(xE)
@@ -4104,9 +3931,6 @@ InitEvents()
spriteTraceGood = 0;
lastEventMask = OwnerGrabButtonMask;
filters[MotionNotify] = PointerMotionMask;
-#ifdef XEVIE
- xeviewin =
-#endif
sprite.win = NullWindow;
sprite.current = NullCursor;
sprite.hotLimits.x1 = 0;
diff --git a/nx-X11/programs/Xserver/dix/extension.c b/nx-X11/programs/Xserver/dix/extension.c
index dd6de9c63..5b6caaafb 100644
--- a/nx-X11/programs/Xserver/dix/extension.c
+++ b/nx-X11/programs/Xserver/dix/extension.c
@@ -65,9 +65,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#define EXTENSION_BASE 128
#define EXTENSION_EVENT_BASE 64
@@ -154,9 +151,6 @@ AddExtension(char *name, int NumEvents, int NumErrors,
ext->secure = FALSE;
#endif
-#ifdef LBX
- (void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase);
-#endif
return(ext);
}
@@ -176,11 +170,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
strcpy(name, alias);
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
-#ifdef LBX
- return LbxAddExtensionAlias(ext->index, alias);
-#else
return TRUE;
-#endif
}
static int
@@ -241,9 +231,6 @@ DeclareExtensionSecurity(char *extname, Bool secure)
}
}
#endif
-#ifdef LBX
- LbxDeclareExtensionSecurity(extname, secure);
-#endif
}
unsigned short
@@ -271,10 +258,6 @@ CloseDownExtensions()
{
register int i,j;
-#ifdef LBX
- LbxCloseDownExtensions();
-#endif
-
for (i = NumExtensions - 1; i >= 0; i--)
{
(* extensions[i]->CloseDown)(extensions[i]);
diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c
index 51cbc1a0d..6041595ce 100644
--- a/nx-X11/programs/Xserver/dix/property.c
+++ b/nx-X11/programs/Xserver/dix/property.c
@@ -64,19 +64,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#include "lbxtags.h"
-#endif
-
-#if defined(LBX) || defined(LBX_COMPAT)
-#if 0 /* no header in X11 environment, not used in X11 environment */
-int fWriteToClient(ClientPtr client, int len, char *buf)
-{
- return WriteToClient(client, len, buf);
-}
-#endif
-#endif
/*****************************************************************
* Property Stuff
@@ -261,13 +248,8 @@ ProcChangeProperty(ClientPtr client)
}
#endif
-#ifdef LBX
- err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
- (int)format, (int)mode, len, TRUE, (void *)&stuff[1], TRUE, NULL);
-#else
err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
(int)mode, len, (void *)&stuff[1], TRUE);
-#endif
if (err != Success)
return err;
else
@@ -279,11 +261,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
{
-#ifdef LBX
- return LbxChangeWindowProperty(NULL, pWin, property, type,
- format, mode, len, TRUE, value,
- sendevent, NULL);
-#else
PropertyPtr pProp;
xEvent event;
int sizeInBytes;
@@ -390,7 +367,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
}
return(Success);
-#endif
}
int
@@ -420,10 +396,6 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{
prevProp->next = pProp->next;
}
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -445,10 +417,6 @@ DeleteAllWindowProperties(WindowPtr pWin)
pProp = wUserProps (pWin);
while (pProp)
{
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -570,13 +538,6 @@ ProcGetProperty(ClientPtr client)
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return(Success);
}
-#ifdef LBX
- /* make sure we have the current value */
- if (pProp->tag_id && pProp->owner_pid) {
- LbxStallPropRequest(client, pProp);
- return client->noClientException;
- }
-#endif
/*
* Return type, format, value to client
@@ -627,10 +588,6 @@ ProcGetProperty(ClientPtr client)
if (stuff->delete && (reply.bytesAfter == 0))
{ /* delete the Property */
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))
diff --git a/nx-X11/programs/Xserver/dix/swaprep.c b/nx-X11/programs/Xserver/dix/swaprep.c
index b8f245408..31c823b3a 100644
--- a/nx-X11/programs/Xserver/dix/swaprep.c
+++ b/nx-X11/programs/Xserver/dix/swaprep.c
@@ -65,11 +65,9 @@ SOFTWARE.
static void SwapFontInfo(xQueryFontReply *pr);
-#ifndef LBX
static void SwapCharInfo(xCharInfo *pInfo);
static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs);
-#endif
/**
* Thanks to Jack Palevich for testing and subsequently rewriting all this
@@ -391,9 +389,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
(void)WriteToClient(pClient, size, (char *) pRep);
}
-#ifndef LBX
static
-#endif
void
SwapCharInfo(xCharInfo *pInfo)
{
@@ -423,9 +419,7 @@ SwapFontInfo(xQueryFontReply *pr)
swapl(&pr->nCharInfos, n);
}
-#ifndef LBX
static
-#endif
void
SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
{
diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c
index c3d901fb9..6221af4d1 100644
--- a/nx-X11/programs/Xserver/dix/window.c
+++ b/nx-X11/programs/Xserver/dix/window.c
@@ -104,9 +104,6 @@ Equipment Corporation.
#include "dixevents.h"
#include "globals.h"
-#ifdef XAPPGROUP
-#include <nx-X11/extensions/Xagsrv.h>
-#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
@@ -607,14 +604,6 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
if (!ancwopt)
ancwopt = FindWindowWithOptional(pParent)->optional;
if (visual == CopyFromParent) {
-#ifdef XAPPGROUP
- VisualID ag_visual;
-
- if (client->appgroup && !pParent->parent &&
- (ag_visual = XagRootVisual (client)))
- visual = ag_visual;
- else
-#endif
visual = ancwopt->visual;
}
@@ -1276,22 +1265,6 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
pVlist++;
if (cmap == CopyFromParent)
{
-#ifdef XAPPGROUP
- Colormap ag_colormap;
- ClientPtr win_owner;
-
- /*
- * win_owner == client for CreateWindow, other clients
- * can ChangeWindowAttributes
- */
- win_owner = clients[CLIENT_ID(pWin->drawable.id)];
-
- if ( win_owner && win_owner->appgroup &&
- !pWin->parent->parent &&
- (ag_colormap = XagDefaultColormap (win_owner)))
- cmap = ag_colormap;
- else
-#endif
if (pWin->parent &&
(!pWin->optional ||
pWin->optional->visual == wVisual (pWin->parent)))
@@ -2208,10 +2181,6 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
h = pWin->drawable.height,
bw = pWin->borderWidth;
int action, smode = Above;
-#ifdef XAPPGROUP
- ClientPtr win_owner;
- ClientPtr ag_leader = NULL;
-#endif
xEvent event;
if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
@@ -2308,17 +2277,8 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
else
pSib = pWin->nextSib;
-#ifdef XAPPGROUP
- win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- ag_leader = XagLeader (win_owner);
-#endif
-
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
-#ifdef XAPPGROUP
- || (win_owner->appgroup && ag_leader &&
- XagIsControlledRoot (client, pParent))
-#endif
))
{
memset(&event, 0, sizeof(xEvent));
@@ -2344,16 +2304,6 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
event.u.configureRequest.height = h;
event.u.configureRequest.borderWidth = bw;
event.u.configureRequest.valueMask = mask;
-#ifdef XAPPGROUP
- /* make sure if the ag_leader maps the window it goes to the wm */
- if (ag_leader && ag_leader != client &&
- XagIsControlledRoot (client, pParent)) {
- event.u.configureRequest.parent = XagId (win_owner);
- (void) TryClientEvents (ag_leader, &event, 1,
- NoEventMask, NoEventMask, NullGrab);
- return Success;
- }
-#endif
event.u.configureRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
SubstructureRedirectMask, client) == 1)
@@ -2714,32 +2664,14 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
{
xEvent event;
Bool anyMarked;
-#ifdef XAPPGROUP
- ClientPtr win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- ClientPtr ag_leader = XagLeader (win_owner);
-#endif
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
-#ifdef XAPPGROUP
- || (win_owner->appgroup && ag_leader &&
- XagIsControlledRoot (client, pParent))
-#endif
))
{
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id;
-#ifdef XAPPGROUP
- /* make sure if the ag_leader maps the window it goes to the wm */
- if (ag_leader && ag_leader != client &&
- XagIsControlledRoot (client, pParent)) {
- event.u.mapRequest.parent = XagId (win_owner);
- (void) TryClientEvents (ag_leader, &event, 1,
- NoEventMask, NoEventMask, NullGrab);
- return Success;
- }
-#endif
event.u.mapRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
diff --git a/nx-X11/programs/Xserver/include/cursorstr.h b/nx-X11/programs/Xserver/include/cursorstr.h
index 894467289..d5d82576b 100644
--- a/nx-X11/programs/Xserver/include/cursorstr.h
+++ b/nx-X11/programs/Xserver/include/cursorstr.h
@@ -92,7 +92,4 @@ typedef struct {
ScreenPtr pScreen;
} HotSpot;
-#ifdef XEVIE
-extern HotSpot xeviehot;
-#endif
#endif /* CURSORSTRUCT_H */
diff --git a/nx-X11/programs/Xserver/include/dix.h b/nx-X11/programs/Xserver/include/dix.h
index 5f9d3b5d5..b7f91b6da 100644
--- a/nx-X11/programs/Xserver/include/dix.h
+++ b/nx-X11/programs/Xserver/include/dix.h
@@ -375,10 +375,6 @@ extern int DoGetImage(
Mask /*planemask*/,
xGetImageReply ** /*im_return*/);
-#ifdef LBX
-extern void IncrementClientCount(void);
-#endif /* LBX */
-
#if defined(DDXBEFORERESET)
extern void ddxBeforeReset (void);
#endif
diff --git a/nx-X11/programs/Xserver/include/dixstruct.h b/nx-X11/programs/Xserver/include/dixstruct.h
index e4b5e9fe8..01a1c86dc 100644
--- a/nx-X11/programs/Xserver/include/dixstruct.h
+++ b/nx-X11/programs/Xserver/include/dixstruct.h
@@ -129,9 +129,6 @@ typedef struct _Client {
unsigned char requestLog[MAX_REQUEST_LOG];
int requestLogIndex;
#endif
-#ifdef LBX
- int (*readRequest)(ClientPtr /*client*/);
-#endif
unsigned long replyBytesRemaining;
#ifdef XCSECURITY
XID authId;
@@ -143,9 +140,6 @@ typedef struct _Client {
Mask /*access_mode*/,
void * /*resourceval*/);
#endif
-#ifdef XAPPGROUP
- struct _AppGroupRec* appgroup;
-#endif
struct _FontResolution * (*fontResFunc) ( /* no need for font.h */
ClientPtr /* pClient */,
int * /* num */);
diff --git a/nx-X11/programs/Xserver/include/globals.h b/nx-X11/programs/Xserver/include/globals.h
index bb6aa80d3..f37fb68ba 100644
--- a/nx-X11/programs/Xserver/include/globals.h
+++ b/nx-X11/programs/Xserver/include/globals.h
@@ -73,22 +73,10 @@ extern Bool noDPSExtension;
extern Bool noDPMSExtension;
#endif
-#ifdef EVI
-extern Bool noEVIExtension;
-#endif
-
-#ifdef FONTCACHE
-extern Bool noFontCacheExtension;
-#endif
-
#ifdef GLXEXT
extern Bool noGlxExtension;
#endif
-#ifdef LBX
-extern Bool noLbxExtension;
-#endif
-
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif
@@ -97,14 +85,6 @@ extern Bool noScreenSaverExtension;
extern Bool noMITShmExtension;
#endif
-#ifdef MITMISC
-extern Bool noMITMiscExtension;
-#endif
-
-#ifdef MULTIBUFFER
-extern Bool noMultibufferExtension;
-#endif
-
#ifdef RANDR
extern Bool noRRExtension;
#endif
@@ -125,46 +105,22 @@ extern Bool noSecurityExtension;
extern Bool noSyncExtension;
#endif
-#ifdef TOGCUP
-extern Bool noXcupExtension;
-#endif
-
#ifdef RES
extern Bool noResExtension;
#endif
-#ifdef XAPPGROUP
-extern Bool noXagExtension;
-#endif
-
#ifdef XCMISC
extern Bool noXCMiscExtension;
#endif
-#ifdef XEVIE
-extern Bool noXevieExtension;
-#endif
-
#ifdef XF86BIGFONT
extern Bool noXFree86BigfontExtension;
#endif
-#ifdef XFreeXDGA
-extern Bool noXFree86DGAExtension;
-#endif
-
#ifdef XF86DRI
extern Bool noXFree86DRIExtension;
#endif
-#ifdef XF86MISC
-extern Bool noXFree86MiscExtension;
-#endif
-
-#ifdef XF86VIDMODE
-extern Bool noXFree86VidModeExtension;
-#endif
-
#ifdef XFIXES
extern Bool noXFixesExtension;
#endif
diff --git a/nx-X11/programs/Xserver/include/os.h b/nx-X11/programs/Xserver/include/os.h
index e150e1e0b..aff2952fa 100644
--- a/nx-X11/programs/Xserver/include/os.h
+++ b/nx-X11/programs/Xserver/include/os.h
@@ -113,14 +113,7 @@ extern int WaitForSomething(
int* /*pClientsReady*/
);
-#ifdef LBX
-#define ReadRequestFromClient(client) ((client)->readRequest(client))
-extern int StandardReadRequestFromClient(ClientPtr /*client*/);
-
-extern int ClientConnectionNumber(ClientPtr /*client*/);
-#else
extern int ReadRequestFromClient(ClientPtr /*client*/);
-#endif /* LBX */
extern Bool InsertFakeRequest(
ClientPtr /*client*/,
@@ -180,10 +173,6 @@ extern void MakeClientGrabImpervious(ClientPtr /*client*/);
extern void MakeClientGrabPervious(ClientPtr /*client*/);
-#ifdef LBX
-extern void CloseDownFileDescriptor(ClientPtr /* client */);
-#endif
-
extern void AvailableClientInput(ClientPtr /* client */);
extern CARD32 GetTimeInMillis(void);
diff --git a/nx-X11/programs/Xserver/include/propertyst.h b/nx-X11/programs/Xserver/include/propertyst.h
index 8f9abd5f8..2bd0b270c 100644
--- a/nx-X11/programs/Xserver/include/propertyst.h
+++ b/nx-X11/programs/Xserver/include/propertyst.h
@@ -62,14 +62,6 @@ typedef struct _Property {
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
void *data; /* private to client */
-#if defined(LBX) || defined(LBX_COMPAT)
- /* If space is at a premium and binary compatibility is not
- * an issue, you may want to put the owner_pid next to format
- * so that the two shorts pack together without padding.
- */
- short owner_pid; /* proxy that has the data */
- XID tag_id;
-#endif
} PropertyRec;
#endif /* PROPERTYSTRUCT_H */
diff --git a/nx-X11/programs/Xserver/include/swaprep.h b/nx-X11/programs/Xserver/include/swaprep.h
index 2c026c659..d18b39f0c 100644
--- a/nx-X11/programs/Xserver/include/swaprep.h
+++ b/nx-X11/programs/Xserver/include/swaprep.h
@@ -120,17 +120,6 @@ extern void SQueryKeymapReply(
int /* size */,
xQueryKeymapReply * /* pRep */);
-#ifdef LBX
-extern void SwapCharInfo(
- xCharInfo * /* pInfo */);
-#endif
-
-#ifdef LBX
-extern void SwapFont(
- xQueryFontReply * /* pr */,
- Bool /* hasGlyphs */);
-#endif
-
extern void SQueryFontReply(
ClientPtr /* pClient */,
int /* size */,
diff --git a/nx-X11/programs/Xserver/include/windowstr.h b/nx-X11/programs/Xserver/include/windowstr.h
index c32842fe3..dd9bb4653 100644
--- a/nx-X11/programs/Xserver/include/windowstr.h
+++ b/nx-X11/programs/Xserver/include/windowstr.h
@@ -254,8 +254,4 @@ extern ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
extern int numSaveUndersViewable;
extern int deltaSaveUndersViewable;
-#ifdef XEVIE
-extern WindowPtr xeviewin;
-#endif
-
#endif /* WINDOWSTRUCT_H */
diff --git a/nx-X11/programs/Xserver/mi/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile
index 4f87dec8e..0d70c46ae 100644
--- a/nx-X11/programs/Xserver/mi/Imakefile
+++ b/nx-X11/programs/Xserver/mi/Imakefile
@@ -76,12 +76,12 @@ OBJS = $(CBRT_OBJ) mivaltree.o mipolyseg.o mipolyrect.o \
* don't use the XF86 module loader.
*/
-EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \
+EXT_DEFINES = ExtensionDefines \
-UXFree86LOADER
#else
-EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \
+EXT_DEFINES = ExtensionDefines -UXINPUT \
-UXFree86LOADER
#endif
diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c
index 47ff26127..b58202ebd 100644
--- a/nx-X11/programs/Xserver/mi/miinitext.c
+++ b/nx-X11/programs/Xserver/mi/miinitext.c
@@ -93,30 +93,15 @@ extern Bool noDPSExtension;
#ifdef DPMSExtension
extern Bool noDPMSExtension;
#endif
-#ifdef EVI
-extern Bool noEVIExtension;
-#endif
-#ifdef FONTCACHE
-extern Bool noFontCacheExtension;
-#endif
#ifdef GLXEXT
extern Bool noGlxExtension;
#endif
-#ifdef LBX
-extern Bool noLbxExtension;
-#endif
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif
#ifdef MITSHM
extern Bool noMITShmExtension;
#endif
-#ifdef MITMISC
-extern Bool noMITMiscExtension;
-#endif
-#ifdef MULTIBUFFER
-extern Bool noMultibufferExtension;
-#endif
#ifdef RANDR
extern Bool noRRExtension;
#endif
@@ -132,36 +117,18 @@ extern Bool noSecurityExtension;
#ifdef XSYNC
extern Bool noSyncExtension;
#endif
-#ifdef TOGCUP
-extern Bool noXcupExtension;
-#endif
#ifdef RES
extern Bool noResExtension;
#endif
-#ifdef XAPPGROUP
-extern Bool noXagExtension;
-#endif
#ifdef XCMISC
extern Bool noXCMiscExtension;
#endif
-#ifdef XEVIE
-extern Bool noXevieExtension;
-#endif
#ifdef XF86BIGFONT
extern Bool noXFree86BigfontExtension;
#endif
-#ifdef XFreeXDGA
-extern Bool noXFree86DGAExtension;
-#endif
#ifdef XF86DRI
extern Bool noXFree86DRIExtension;
#endif
-#ifdef XF86MISC
-extern Bool noXFree86MiscExtension;
-#endif
-#ifdef XF86VIDMODE
-extern Bool noXFree86VidModeExtension;
-#endif
#ifdef XFIXES
extern Bool noXFixesExtension;
#endif
@@ -200,14 +167,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef XKB
#include <nx-X11/extensions/XKB.h>
#endif
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <nx-X11/extensions/lbxstr.h>
-#endif
-#ifdef XAPPGROUP
-#define _XAG_SERVER_
-#include <nx-X11/extensions/Xagstr.h>
-#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/securstr.h>
@@ -229,15 +188,9 @@ extern void XTestExtension1Init(INITARGS);
#ifdef SHAPE
extern void ShapeExtensionInit(INITARGS);
#endif
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#endif
#ifdef MITSHM
extern void ShmExtensionInit(INITARGS);
#endif
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#endif
#ifdef PANORAMIX
extern void PanoramiXExtensionInit(INITARGS);
#endif
@@ -250,15 +203,9 @@ extern void XTestExtensionInit(INITARGS);
#ifdef BIGREQS
extern void BigReqExtensionInit(INITARGS);
#endif
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#endif
#ifdef XIDLE
extern void XIdleExtensionInit(INITARGS);
#endif
-#ifdef XTRAP
-extern void DEC_XTRAPInit(INITARGS);
-#endif
#ifdef SCREENSAVER
extern void ScreenSaverExtensionInit (INITARGS);
#endif
@@ -278,30 +225,15 @@ extern void XCMiscExtensionInit(INITARGS);
#ifdef XRECORD
extern void RecordExtensionInit(INITARGS);
#endif
-#ifdef LBX
-extern void LbxExtensionInit(INITARGS);
-#endif
#ifdef DBE
extern void DbeExtensionInit(INITARGS);
#endif
-#ifdef XAPPGROUP
-extern void XagExtensionInit(INITARGS);
-#endif
#ifdef XCSECURITY
extern void SecurityExtensionInit(INITARGS);
#endif
#ifdef XF86BIGFONT
extern void XFree86BigfontExtensionInit(INITARGS);
#endif
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit(INITARGS);
-#endif
-#ifdef XF86MISC
-extern void XFree86MiscExtensionInit(INITARGS);
-#endif
-#ifdef XFreeXDGA
-extern void XFree86DGAExtensionInit(INITARGS);
-#endif
#ifdef GLXEXT
#ifndef __DARWIN__
extern void GlxExtensionInit(INITARGS);
@@ -314,18 +246,12 @@ extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
#ifdef XF86DRI
extern void XFree86DRIExtensionInit(INITARGS);
#endif
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#endif
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#endif
#ifdef DPSEXT
extern void DPSExtensionInit(INITARGS);
#endif
-#ifdef FONTCACHE
-extern void FontCacheExtensionInit(INITARGS);
-#endif
#ifdef RENDER
extern void RenderExtensionInit(INITARGS);
#endif
@@ -338,9 +264,6 @@ extern void ResExtensionInit(INITARGS);
#ifdef DMXEXT
extern void DMXExtensionInit(INITARGS);
#endif
-#ifdef XEVIE
-extern void XevieExtensionInit(INITARGS);
-#endif
#ifdef XFIXES
extern void XFixesExtensionInit(INITARGS);
#endif
@@ -380,30 +303,15 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef DPMSExtension
{ "DPMS", &noDPMSExtension },
#endif
-#ifdef EVI
- { "Extended-Visual-Information", &noEVIExtension },
-#endif
-#ifdef FONTCACHE
- { "FontCache", &noFontCacheExtension },
-#endif
#ifdef GLXEXT
{ "GLX", &noGlxExtension },
#endif
-#ifdef LBX
- { "LBX", &noLbxExtension },
-#endif
#ifdef SCREENSAVER
{ "MIT-SCREEN-SAVER", &noScreenSaverExtension },
#endif
#ifdef MITSHM
{ SHMNAME, &noMITShmExtension },
#endif
-#ifdef MITMISC
- { "MIT-SUNDRY-NONSTANDARD", &noMITMiscExtension },
-#endif
-#ifdef MULTIBUFFER
- { "Multi-Buffering", &noMultibufferExtension },
-#endif
#ifdef RANDR
{ "RANDR", &noRRExtension },
#endif
@@ -419,36 +327,18 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef XSYNC
{ "SYNC", &noSyncExtension },
#endif
-#ifdef TOGCUP
- { "TOG-CUP", &noXcupExtension },
-#endif
#ifdef RES
{ "X-Resource", &noResExtension },
#endif
-#ifdef XAPPGROUP
- { "XC-APPGROUP", &noXagExtension },
-#endif
#ifdef XCMISC
{ "XC-MISC", &noXCMiscExtension },
#endif
-#ifdef XEVIE
- { "XEVIE", &noXevieExtension },
-#endif
#ifdef XF86BIGFONT
{ "XFree86-Bigfont", &noXFree86BigfontExtension },
#endif
-#ifdef XFreeXDGA
- { "XFree86-DGA", &noXFree86DGAExtension },
-#endif
#ifdef XF86DRI
{ "XFree86-DRI", &noXFree86DRIExtension },
#endif
-#ifdef XF86MISC
- { "XFree86-Misc", &noXFree86MiscExtension },
-#endif
-#ifdef XF86VIDMODE
- { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
-#endif
#ifdef XFIXES
{ "XFIXES", &noXFixesExtension },
#endif
@@ -515,12 +405,6 @@ InitExtensions(argc, argv)
#ifdef MITSHM
if (!noMITShmExtension) ShmExtensionInit();
#endif
-#ifdef EVI
- if (!noEVIExtension) EVIExtensionInit();
-#endif
-#ifdef MULTIBUFFER
- if (!noMultibufferExtension) MultibufferExtensionInit();
-#endif
#if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS)
if (!noXInputExtension) XInputExtensionInit();
#endif
@@ -530,15 +414,9 @@ InitExtensions(argc, argv)
#ifdef BIGREQS
if (!noBigReqExtension) BigReqExtensionInit();
#endif
-#ifdef MITMISC
- if (!noMITMiscExtension) MITMiscExtensionInit();
-#endif
#ifdef XIDLE
if (!noXIdleExtension) XIdleExtensionInit();
#endif
-#ifdef XTRAP
- if (!noTestExtensions) DEC_XTRAPInit();
-#endif
#if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER)
if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
#endif
@@ -560,40 +438,19 @@ InitExtensions(argc, argv)
#ifdef XRECORD
if (!noTestExtensions) RecordExtensionInit();
#endif
-#ifdef LBX
- if (!noLbxExtension) LbxExtensionInit();
-#endif
#ifdef DBE
if (!noDbeExtension) DbeExtensionInit();
#endif
-#ifdef XAPPGROUP
- if (!noXagExtension) XagExtensionInit();
-#endif
#ifdef XCSECURITY
if (!noSecurityExtension) SecurityExtensionInit();
#endif
-#ifdef TOGCUP
- if (!noXcupExtension) XcupExtensionInit();
-#endif
#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
if (!noDPMSExtension) DPMSExtensionInit();
#endif
-#ifdef FONTCACHE
- if (!noFontCacheExtension) FontCacheExtensionInit();
-#endif
#ifdef XF86BIGFONT
if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
#endif
#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
-#if defined(XF86VIDMODE)
- if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
-#endif
-#if defined(XF86MISC)
- if (!noXFree86MiscExtension) XFree86MiscExtensionInit();
-#endif
-#if defined(XFreeXDGA)
- if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
-#endif
#ifdef XF86DRI
if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
#endif
@@ -621,9 +478,6 @@ InitExtensions(argc, argv)
#ifdef DMXEXT
DMXExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
-#ifdef XEVIE
- if (!noXevieExtension) XevieExtensionInit();
-#endif
#ifdef COMPOSITE
if (!noCompositeExtension) CompositeExtensionInit();
#endif
@@ -666,12 +520,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef XKB
{ XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
#endif
-#ifdef LBX
- { LbxExtensionInit, LBXNAME, &noLbxExtension, NULL, NULL },
-#endif
-#ifdef XAPPGROUP
- { XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
-#endif
#ifdef XCSECURITY
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
#endif
@@ -697,9 +545,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef DAMAGE
{ DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
#endif
-#ifdef XEVIE
- { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL },
-#endif
{ NULL, NULL, NULL, NULL, NULL }
};
diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c
index 05dfaf38a..d2bf972fe 100644
--- a/nx-X11/programs/Xserver/os/access.c
+++ b/nx-X11/programs/Xserver/os/access.c
@@ -1390,10 +1390,6 @@ Bool LocalClient(ClientPtr client)
return FALSE;
}
#endif
-#ifdef LBX
- if (!((OsCommPtr)client->osPrivate)->trans_conn)
- return FALSE;
-#endif
if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
&notused, &alen, &from))
{
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index ef71cd540..2df92bf91 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -147,19 +147,10 @@ extern __const__ int _nfiles;
#include <nx-X11/Xpoll.h>
#include "opaque.h"
#include "dixstruct.h"
-#ifdef XAPPGROUP
-#include <nx-X11/extensions/Xagsrv.h>
-#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#include "osdep.h"
-#endif
#ifdef X_NOT_POSIX
#define Pid_t int
@@ -300,12 +291,10 @@ int ListenTransCount;
static void ErrorConnMax(XtransConnInfo /* trans_conn */);
-#ifndef LBX
static
void CloseDownFileDescriptor(
OsCommPtr /*oc*/
);
-#endif
static XtransConnInfo
@@ -694,64 +683,13 @@ ClientAuthorized(ClientPtr client,
char *reason = NULL;
XtransConnInfo trans_conn;
int restore_trans_conn = 0;
- ClientPtr lbxpc = NULL;
priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
-#ifdef LBX
- if (!trans_conn) {
- /*
- * Since trans_conn is NULL, this must be a proxy's client for
- * which we have NO address. Therefore, we will temporarily
- * set the client's trans_conn to the proxy's trans_conn and
- * after CheckAuthorization the client's trans_conn will be
- * restored.
- *
- * If XDM-AUTHORIZATION-1 is being used, CheckAuthorization
- * will eventually call XdmAuthorizationValidate and this
- * later function may use the client's trans_conn to get the
- * client's address. Since a XDM-AUTH-1 auth string includes
- * the client's address, this address is compared to the address
- * in the client's trans_conn. If the proxy and client are
- * on the same host, the comparison will fail; otherwise the
- * comparison will fail and the client will not be authorized
- * to connect to the server.
- *
- * The basis for this additional code is to prevent a
- * NULL pointer dereference of the client's trans_conn.
- * The fundamental problem - the fact that the client's
- * trans_conn is NULL - is because the NewClient
- * request in version 1.0 of the LBX protocol does not
- * send the client's address to the server. When the
- * spec is changed and the client's address is sent to
- * server in the NewClient request, this additional code
- * should be removed.
- *
- * See defect number XWSog08218 for more information.
- */
- lbxpc = LbxProxyClient(priv->proxy);
- trans_conn = ((OsCommPtr)lbxpc->osPrivate)->trans_conn;
- priv->trans_conn = trans_conn;
- restore_trans_conn = 1;
- }
-#endif
-
auth_id = CheckAuthorization (proto_n, auth_proto,
string_n, auth_string, client, &reason);
-#ifdef LBX
- if (! priv->trans_conn) {
- if (auth_id == (XID) ~0L && !GetAccessControl())
- auth_id = ((OsCommPtr)lbxpc->osPrivate)->auth_id;
-#ifdef XCSECURITY
- else if (auth_id != (XID) ~0L && !SecuritySameLevel(lbxpc, auth_id)) {
- auth_id = (XID) ~0L;
- reason = "Client trust level differs from that of LBX Proxy";
- }
-#endif
- }
-#endif
if (auth_id == (XID) ~0L)
{
if (
@@ -763,9 +701,6 @@ ClientAuthorized(ClientPtr client,
&family, &fromlen, &from) != -1)
{
if (
-#ifdef LBX
- !trans_conn ||
-#endif
InvalidHost ((struct sockaddr *) from, fromlen, client))
AuthAudit(client, FALSE, (struct sockaddr *) from,
fromlen, proto_n, auth_proto, auth_id);
@@ -782,14 +717,6 @@ ClientAuthorized(ClientPtr client,
}
if (auth_id == (XID) ~0L) {
-#ifdef LBX
- /*
- * Restore client's trans_conn state
- */
- if (restore_trans_conn) {
- priv->trans_conn = NULL;
- }
-#endif
if (reason)
return reason;
else
@@ -814,44 +741,22 @@ ClientAuthorized(ClientPtr client,
/* indicate to Xdmcp protocol that we've opened new client */
XdmcpOpenDisplay(priv->fd);
#endif /* XDMCP */
-#ifdef XAPPGROUP
- if (ClientStateCallback)
- XagCallClientStateChange (client);
-#endif
/* At this point, if the client is authorized to change the access control
* list, we should getpeername() information, and add the client to
* the selfhosts list. It's not really the host machine, but the
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
-#ifdef LBX
- if (restore_trans_conn) {
- priv->trans_conn = NULL;
- }
-#endif
return((char *)NULL);
}
static ClientPtr
-#ifdef LBX
-AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time,
- int (*Flush)(
- ClientPtr /*who*/, OsCommPtr /*oc*/,
- char * /*extraBuf*/, int /*extraCount*/),
- void (*Close)(
- ClientPtr /*client*/),
- LbxProxyPtr proxy)
-#else
AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
-#endif
{
OsCommPtr oc;
ClientPtr client;
if (
-#ifdef LBX
- trans_conn &&
-#endif
#ifndef WIN32
fd >= lastfdesc
#else
@@ -868,20 +773,11 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
oc->output = (ConnectionOutputPtr)NULL;
oc->auth_id = None;
oc->conn_time = conn_time;
-#ifdef LBX
- oc->proxy = proxy;
- oc->Flush = Flush;
- oc->Close = Close;
- oc->largereq = (ConnectionInputPtr) NULL;
-#endif
if (!(client = NextAvailableClient((void *)oc)))
{
xfree (oc);
return NullClient;
}
-#ifdef LBX
- if (trans_conn)
-#endif
{
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
@@ -908,39 +804,6 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
return client;
}
-#ifdef LBX
-
-int
-ClientConnectionNumber (ClientPtr client)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- return oc->fd;
-}
-
-ClientPtr
-AllocLbxClientConnection (ClientPtr client, LbxProxyPtr proxy)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- return AllocNewConnection ((XtransConnInfo)NULL, oc->fd, GetTimeInMillis(),
- LbxFlushClient, LbxCloseClient, proxy);
-}
-
-void
-LbxProxyConnection (ClientPtr client, LbxProxyPtr proxy)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- FlushClient(client, oc, (char *)NULL, 0);
- oc->proxy = proxy;
- oc->Flush = LbxFlushClient;
- oc->Close = LbxCloseClient;
- LbxPrimeInput(client, proxy);
-}
-
-#endif
-
/*****************
* EstablishNewConnections
* If anyone is waiting on listened sockets, accept them.
@@ -1020,10 +883,6 @@ EstablishNewConnections(ClientPtr clientUnused, void * closure)
_XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
if (!AllocNewConnection (new_trans_conn, newconn, connect_time
-#ifdef LBX
- , StandardFlushClient,
- CloseDownFileDescriptor, (LbxProxyPtr)NULL
-#endif
))
{
ErrorConnMax(new_trans_conn);
@@ -1093,27 +952,17 @@ ErrorConnMax(XtransConnInfo trans_conn)
* Remove this file descriptor and it's I/O buffers, etc.
************/
-#ifdef LBX
-void
-CloseDownFileDescriptor(ClientPtr client)
-#else
static void
CloseDownFileDescriptor(OsCommPtr oc)
-#endif
{
-#ifdef LBX
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-#endif
int connection = oc->fd;
if (oc->trans_conn) {
_XSERVTransDisconnect(oc->trans_conn);
_XSERVTransClose(oc->trans_conn);
}
-#ifndef LBX
FreeOsBuffers(oc);
xfree(oc);
-#endif
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
@@ -1208,13 +1057,7 @@ CloseDownConnection(ClientPtr client)
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
-#ifndef LBX
CloseDownFileDescriptor(oc);
-#else
- (*oc->Close) (client);
- FreeOsBuffers(oc);
- xfree(oc);
-#endif
client->osPrivate = (void *)NULL;
if (auditTrailLevel > 1)
AuditF("client %d disconnected\n", client->index);
@@ -1303,17 +1146,8 @@ IgnoreClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-#endif
isItTimeToYield = TRUE;
-#ifdef LBX
- if (lbxClient) {
- lbxClient->ignored = TRUE;
- return;
- }
-#endif
if (!GrabInProgress || FD_ISSET(connection, &AllClients))
{
if (FD_ISSET (connection, &ClientsWithInput))
@@ -1347,14 +1181,6 @@ AttendClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-
- if (lbxClient) {
- lbxClient->ignored = FALSE;
- return;
- }
-#endif
if (!GrabInProgress || GrabInProgress == client->index ||
FD_ISSET(connection, &GrabImperviousClients))
{
diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c
index ccfc01dfe..fefe3007f 100644
--- a/nx-X11/programs/Xserver/os/io.c
+++ b/nx-X11/programs/Xserver/os/io.c
@@ -85,11 +85,6 @@ SOFTWARE.
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
-#ifdef LBX
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#endif
CallbackListPtr ReplyCallback;
CallbackListPtr FlushCallback;
@@ -200,26 +195,9 @@ OsCommPtr AvailableInput = (OsCommPtr)NULL;
#define YieldControlDeath() \
{ timesThisConnection = 0; }
-#ifdef hpux_not_tog
-#define LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#endif
-
-#ifdef LBX
-#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#undef ReadRequestFromClient
int
ReadRequestFromClient(ClientPtr client)
{
- return (*client->readRequest)(client);
-}
-#endif
-int
-StandardReadRequestFromClient(ClientPtr client)
-#else
-int
-ReadRequestFromClient(ClientPtr client)
-#endif
-{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
@@ -368,13 +346,6 @@ ReadRequestFromClient(ClientPtr client)
YieldControlDeath();
return -1;
}
-#ifdef LBX
- if (oc->proxy && oc->proxy->compHandle)
- result = (*oc->proxy->streamOpts.streamCompRead)(fd,
- (unsigned char *)oci->buffer + oci->bufcnt,
- oci->size - oci->bufcnt);
- else
-#endif
result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
oci->size - oci->bufcnt);
if (result <= 0)
@@ -382,18 +353,8 @@ ReadRequestFromClient(ClientPtr client)
if ((result < 0) && ETEST(errno))
{
#if defined(SVR4) && defined(i386) && !defined(sun)
-#if defined(LBX) && 0
- /*
- * For LBX connections, we can get a valid EWOULDBLOCK
- * There is probably a better way of distinguishing LBX
- * connections, but this works. (DHD)
- */
- extern int LbxRead();
- if (oc->Read == LbxRead)
-#else
if (0)
#endif
-#endif
{
YieldControlNoInput();
return 0;
@@ -610,18 +571,6 @@ ResetCurrentRequest(ClientPtr client)
int fd = oc->fd;
register xReq *request;
int gotnow, needed;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-
- if (lbxClient) {
- LbxSetForBlock(lbxClient);
- if (!oci) {
- AppendFakeRequest(client,
- client->requestBuffer, client->req_len << 2);
- return;
- }
- }
-#endif
if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
oci->lenLastReq = 0;
@@ -851,9 +800,6 @@ FlushAllOutput(void)
continue;
oc = (OsCommPtr)client->osPrivate;
if (
-#ifdef LBX
- !oc->proxy &&
-#endif
FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &OutputPending); /* set the bit again */
@@ -875,9 +821,6 @@ FlushAllOutput(void)
continue;
oc = (OsCommPtr)client->osPrivate;
if (
-#ifdef LBX
- !oc->proxy &&
-#endif
FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &newOutputPending); /* set the bit again */
@@ -1055,22 +998,8 @@ WriteToClient (ClientPtr who, int count, char *buf)
*
**********************/
-#ifdef LBX
-#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#undef FlushClient
-int
-FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
-{
- return (*oc->Flush)(who, oc, extraBuf, extraCount);
-}
-#endif
-int
-StandardFlushClient(ClientPtr who, OsCommPtr oc,
- char *extraBuf, int extraCount)
-#else
int
FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
-#endif
{
ConnectionOutputPtr oco = oc->output;
int connection = oc->fd;
@@ -1274,9 +1203,6 @@ AllocateOutputBuffer(void)
}
oco->size = BUFSIZE;
oco->count = 0;
-#ifdef LBX
- oco->nocompress = FALSE;
-#endif
return oco;
}
@@ -1318,12 +1244,6 @@ FreeOsBuffers(OsCommPtr oc)
oco->count = 0;
}
}
-#ifdef LBX
- if ((oci = oc->largereq)) {
- xfree(oci->buffer);
- xfree(oci);
- }
-#endif
}
void
diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h
index e0c5de3a8..acf832e1c 100644
--- a/nx-X11/programs/Xserver/os/osdep.h
+++ b/nx-X11/programs/Xserver/os/osdep.h
@@ -143,9 +143,6 @@ typedef struct _connectionOutput {
int size;
unsigned char *buf;
int count;
-#ifdef LBX
- Bool nocompress;
-#endif
} ConnectionOutput, *ConnectionOutputPtr;
#ifdef K5AUTH
@@ -158,10 +155,6 @@ typedef struct _k5_state {
} k5_state;
#endif
-#ifdef LBX
-typedef struct _LbxProxy *OsProxyPtr;
-#endif
-
struct _osComm;
#define AuthInitArgs void
@@ -202,33 +195,14 @@ typedef struct _osComm {
#endif
CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
-#ifdef LBX
- OsProxyPtr proxy;
- ConnectionInputPtr largereq;
- OsCloseFunc Close;
- OsFlushFunc Flush;
-#endif
} OsCommRec, *OsCommPtr;
-#ifdef LBX
-#define FlushClient(who, oc, extraBuf, extraCount) \
- (*(oc)->Flush)(who, oc, extraBuf, extraCount)
-extern int StandardFlushClient(
- ClientPtr /*who*/,
- OsCommPtr /*oc*/,
- char* /*extraBuf*/,
- int /*extraCount*/
-);
-extern int LbxFlushClient(ClientPtr /*who*/, OsCommPtr /*oc*/,
- char * /*extraBuf*/, int /*extraCount*/);
-#else
extern int FlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
);
-#endif
extern void FreeOsBuffers(
OsCommPtr /*oc*/
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index 4934b5ca3..3f58b6fc5 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -168,30 +168,15 @@ Bool noDPSExtension = FALSE;
#ifdef DPMSExtension
Bool noDPMSExtension = FALSE;
#endif
-#ifdef EVI
-Bool noEVIExtension = FALSE;
-#endif
-#ifdef FONTCACHE
-Bool noFontCacheExtension = FALSE;
-#endif
#ifdef GLXEXT
Bool noGlxExtension = FALSE;
#endif
-#ifdef LBX
-Bool noLbxExtension = FALSE;
-#endif
#ifdef SCREENSAVER
Bool noScreenSaverExtension = FALSE;
#endif
#ifdef MITSHM
Bool noMITShmExtension = FALSE;
#endif
-#ifdef MITMISC
-Bool noMITMiscExtension = FALSE;
-#endif
-#ifdef MULTIBUFFER
-Bool noMultibufferExtension = FALSE;
-#endif
#ifdef RANDR
Bool noRRExtension = FALSE;
#endif
@@ -207,38 +192,18 @@ Bool noSecurityExtension = FALSE;
#ifdef XSYNC
Bool noSyncExtension = FALSE;
#endif
-#ifdef TOGCUP
-Bool noXcupExtension = FALSE;
-#endif
#ifdef RES
Bool noResExtension = FALSE;
#endif
-#ifdef XAPPGROUP
-Bool noXagExtension = FALSE;
-#endif
#ifdef XCMISC
Bool noXCMiscExtension = FALSE;
#endif
-#ifdef XEVIE
-/* Xevie is disabled by default for now until the
- * interface is stable */
-Bool noXevieExtension = TRUE;
-#endif
#ifdef XF86BIGFONT
Bool noXFree86BigfontExtension = FALSE;
#endif
-#ifdef XFreeXDGA
-Bool noXFree86DGAExtension = FALSE;
-#endif
#ifdef XF86DRI
Bool noXFree86DRIExtension = FALSE;
#endif
-#ifdef XF86MISC
-Bool noXFree86MiscExtension = FALSE;
-#endif
-#ifdef XF86VIDMODE
-Bool noXFree86VidModeExtension = FALSE;
-#endif
#ifdef XFIXES
Bool noXFixesExtension = FALSE;
#endif