aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/dix/Imakefile14
-rw-r--r--nx-X11/programs/Xserver/dix/extension.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXextension.c324
3 files changed, 15 insertions, 327 deletions
diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile
index 011641279..cc5712126 100644
--- a/nx-X11/programs/Xserver/dix/Imakefile
+++ b/nx-X11/programs/Xserver/dix/Imakefile
@@ -13,6 +13,16 @@ FFS_SRC = ffs.c
FFS_OBJ = ffs.o
#endif
+#if (!(defined(NXAgentServer) && NXAgentServer))
+NXAGENT_SKIP_SRCS = \
+ extension.c \
+ $(NULL)
+NXAGENT_SKIP_OBJS = \
+ extension.o \
+ $(NULL)
+#endif
+
+
SRCS = \
atom.c \
colormap.c \
@@ -21,7 +31,6 @@ SRCS = \
dispatch.c \
dixutils.c \
events.c \
- extension.c \
gc.c \
globals.c \
glyphcurs.c \
@@ -38,6 +47,7 @@ SRCS = \
dixfonts.c \
privates.c \
pixmap.c \
+ $(NXAGENT_SKIP_SRCS) \
$(FFS_SRC) \
$(NULL)
@@ -49,7 +59,6 @@ OBJS = \
dispatch.o \
dixutils.o \
events.o \
- extension.o \
gc.o \
globals.o \
glyphcurs.o \
@@ -66,6 +75,7 @@ OBJS = \
dixfonts.o \
privates.o \
pixmap.o \
+ $(NXAGENT_SKIP_OBJS) \
$(FFS_OBJ) \
$(NULL)
diff --git a/nx-X11/programs/Xserver/dix/extension.c b/nx-X11/programs/Xserver/dix/extension.c
index bc106d83c..fe51f8916 100644
--- a/nx-X11/programs/Xserver/dix/extension.c
+++ b/nx-X11/programs/Xserver/dix/extension.c
@@ -287,7 +287,7 @@ CloseDownExtensions()
}
}
-
+#ifndef NXAGENT_SERVER
int
ProcQueryExtension(ClientPtr client)
{
@@ -392,7 +392,7 @@ ProcListExtensions(ClientPtr client)
}
return(client->noClientException);
}
-
+#endif
ExtensionLookupProc
LookupProc(char *name, GCPtr pGC)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXextension.c b/nx-X11/programs/Xserver/hw/nxagent/NXextension.c
index 0c0145477..71478fcc4 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXextension.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXextension.c
@@ -64,265 +64,9 @@ SOFTWARE.
******************************************************************/
/* $Xorg: extension.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <nx-X11/X.h>
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <nx-X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "../../dix/dispatch.h"
-#ifdef XCSECURITY
-#define _SECURITY_SERVER
-#include <nx-X11/extensions/security.h>
-#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
-
#include "Trap.h"
-#define EXTENSION_BASE 128
-#define EXTENSION_EVENT_BASE 64
-#define LAST_EVENT 128
-#define LAST_ERROR 255
-
-ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS];
-
-static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
-
-int lastEvent = EXTENSION_EVENT_BASE;
-static int lastError = FirstExtensionError;
-static unsigned int NumExtensions = 0;
-
-ExtensionEntry *
-AddExtension(char *name, int NumEvents, int NumErrors,
- int (*MainProc)(ClientPtr c1),
- int (*SwappedMainProc)(ClientPtr c2),
- void (*CloseDownProc)(ExtensionEntry *e),
- unsigned short (*MinorOpcodeProc)(ClientPtr c3))
-{
- int i;
- register ExtensionEntry *ext, **newexts;
-
- if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
- return((ExtensionEntry *) NULL);
- if ((lastEvent + NumEvents > LAST_EVENT) ||
- (unsigned)(lastError + NumErrors > LAST_ERROR))
- return((ExtensionEntry *) NULL);
-
- ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry));
- if (!ext)
- return((ExtensionEntry *) NULL);
- ext->name = (char *)xalloc(strlen(name) + 1);
- ext->num_aliases = 0;
- ext->aliases = (char **)NULL;
- if (!ext->name)
- {
- xfree(ext);
- return((ExtensionEntry *) NULL);
- }
- strcpy(ext->name, name);
- i = NumExtensions;
- newexts = (ExtensionEntry **) xrealloc(extensions,
- (i + 1) * sizeof(ExtensionEntry *));
- if (!newexts)
- {
- xfree(ext->name);
- xfree(ext);
- return((ExtensionEntry *) NULL);
- }
- NumExtensions++;
- extensions = newexts;
- extensions[i] = ext;
- ext->index = i;
- ext->base = i + EXTENSION_BASE;
- ext->CloseDown = CloseDownProc;
- ext->MinorOpcode = MinorOpcodeProc;
- ProcVector[i + EXTENSION_BASE] = MainProc;
- SwappedProcVector[i + EXTENSION_BASE] = SwappedMainProc;
- if (NumEvents)
- {
- ext->eventBase = lastEvent;
- ext->eventLast = lastEvent + NumEvents;
- lastEvent += NumEvents;
- }
- else
- {
- ext->eventBase = 0;
- ext->eventLast = 0;
- }
- if (NumErrors)
- {
- ext->errorBase = lastError;
- ext->errorLast = lastError + NumErrors;
- lastError += NumErrors;
- }
- else
- {
- ext->errorBase = 0;
- ext->errorLast = 0;
- }
-#ifdef XCSECURITY
- ext->secure = FALSE;
-#endif
-
-#ifdef LBX
- (void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase);
-#endif
- return(ext);
-}
-
-Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
-{
- char *name;
- char **aliases;
-
- aliases = (char **)xrealloc(ext->aliases,
- (ext->num_aliases + 1) * sizeof(char *));
- if (!aliases)
- return FALSE;
- ext->aliases = aliases;
- name = (char *)xalloc(strlen(alias) + 1);
- if (!name)
- return FALSE;
- 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
-FindExtension(char *extname, int len)
-{
- int i, j;
-
- for (i=0; i<NumExtensions; i++)
- {
- if ((strlen(extensions[i]->name) == len) &&
- !strncmp(extname, extensions[i]->name, len))
- break;
- for (j = extensions[i]->num_aliases; --j >= 0;)
- {
- if ((strlen(extensions[i]->aliases[j]) == len) &&
- !strncmp(extname, extensions[i]->aliases[j], len))
- break;
- }
- if (j >= 0) break;
- }
- return ((i == NumExtensions) ? -1 : i);
-}
-
-/*
- * CheckExtension returns the extensions[] entry for the requested
- * extension name. Maybe this could just return a Bool instead?
- */
-ExtensionEntry *
-CheckExtension(const char *extname)
-{
- int n;
-
- n = FindExtension((char*)extname, strlen(extname));
- if (n != -1)
- return extensions[n];
- else
- return NULL;
-}
-
-void
-DeclareExtensionSecurity(char *extname, Bool secure)
-{
-#ifdef XCSECURITY
- int i = FindExtension(extname, strlen(extname));
- if (i >= 0)
- {
- int majorop = extensions[i]->base;
- extensions[i]->secure = secure;
- if (secure)
- {
- UntrustedProcVector[majorop] = ProcVector[majorop];
- SwappedUntrustedProcVector[majorop] = SwappedProcVector[majorop];
- }
- else
- {
- UntrustedProcVector[majorop] = ProcBadRequest;
- SwappedUntrustedProcVector[majorop] = ProcBadRequest;
- }
- }
-#endif
-#ifdef LBX
- LbxDeclareExtensionSecurity(extname, secure);
-#endif
-}
-
-unsigned short
-StandardMinorOpcode(ClientPtr client)
-{
- return ((xReq *)client->requestBuffer)->data;
-}
-
-unsigned short
-MinorOpcodeOfRequest(ClientPtr client)
-{
- unsigned char major;
-
- major = ((xReq *)client->requestBuffer)->reqType;
- if (major < EXTENSION_BASE)
- return 0;
- major -= EXTENSION_BASE;
- if (major >= NumExtensions)
- return 0;
- return (*extensions[major]->MinorOpcode)(client);
-}
-
-void
-CloseDownExtensions()
-{
- register int i,j;
-
-#ifdef LBX
- LbxCloseDownExtensions();
-#endif
-
- for (i = NumExtensions - 1; i >= 0; i--)
- {
- if (extensions[i]->CloseDown)
- (* extensions[i]->CloseDown)(extensions[i]);
- NumExtensions = i;
- xfree(extensions[i]->name);
- for (j = extensions[i]->num_aliases; --j >= 0;)
- xfree(extensions[i]->aliases[j]);
- xfree(extensions[i]->aliases);
- xfree(extensions[i]);
- }
- xfree(extensions);
- extensions = (ExtensionEntry **)NULL;
- lastEvent = EXTENSION_EVENT_BASE;
- lastError = FirstExtensionError;
- for (i=0; i<MAXSCREENS; i++)
- {
- register ScreenProcEntry *spentry = &AuxillaryScreenProcs[i];
-
- while (spentry->num)
- {
- spentry->num--;
- xfree(spentry->procList[spentry->num].name);
- }
- xfree(spentry->procList);
- spentry->procList = (ProcEntryPtr)NULL;
- }
-}
-
+#include "../../dix/extension.c"
int
ProcQueryExtension(ClientPtr client)
@@ -443,69 +187,3 @@ ProcListExtensions(ClientPtr client)
}
return(client->noClientException);
}
-
-
-ExtensionLookupProc
-LookupProc(char *name, GCPtr pGC)
-{
- register int i;
- register ScreenProcEntry *spentry;
- spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum];
- if (spentry->num)
- {
- for (i = 0; i < spentry->num; i++)
- if (strcmp(name, spentry->procList[i].name) == 0)
- return(spentry->procList[i].proc);
- }
- return (ExtensionLookupProc)NULL;
-}
-
-Bool
-RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc)
-{
- return RegisterScreenProc(name, pGC->pScreen, proc);
-}
-
-Bool
-RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
-{
- register ScreenProcEntry *spentry;
- register ProcEntryPtr procEntry = (ProcEntryPtr)NULL;
- char *newname;
- int i;
-
- spentry = &AuxillaryScreenProcs[pScreen->myNum];
- /* first replace duplicates */
- if (spentry->num)
- {
- for (i = 0; i < spentry->num; i++)
- if (strcmp(name, spentry->procList[i].name) == 0)
- {
- procEntry = &spentry->procList[i];
- break;
- }
- }
- if (procEntry)
- procEntry->proc = proc;
- else
- {
- newname = (char *)xalloc(strlen(name)+1);
- if (!newname)
- return FALSE;
- procEntry = (ProcEntryPtr)
- xrealloc(spentry->procList,
- sizeof(ProcEntryRec) * (spentry->num+1));
- if (!procEntry)
- {
- xfree(newname);
- return FALSE;
- }
- spentry->procList = procEntry;
- procEntry += spentry->num;
- procEntry->name = newname;
- strcpy(newname, name);
- procEntry->proc = proc;
- spentry->num++;
- }
- return TRUE;
-}