[PATCH 37/37] Remove separate ExtensionToggle list from miinitext [WIP]

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:53 PDT 2011


miinitext.c had two duplicate extension + disable pointer lists, one of
which was used for extension init, the other of which was used to toggle
extensions on and off via the command line or xorg.conf.  Merge these
into one.

WIP: This only works for static extensions, those added later (GLX,
     DGA, VidMode) or added by the DDX can't be enabled/disabled.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 hw/xwin/winwindowswm.c |   11 ---
 mi/miinitext.c         |  159 +++++++++++++-----------------------------------
 2 files changed, 43 insertions(+), 127 deletions(-)

diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 242a275..fb46187 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -546,13 +546,6 @@ ProcWindowsWMDispatch (ClientPtr client)
     {
     case X_WindowsWMQueryVersion:
       return ProcWindowsWMQueryVersion(client);
-    }
-
-  if (!LocalClient(client))
-    return WMErrorBase + WindowsWMClientNotLocal;
-
-  switch (stuff->data)
-    {
     case X_WindowsWMSelectInput:
       return ProcWindowsWMSelectInput(client);
     case X_WindowsWMDisableUpdate:
@@ -597,10 +590,6 @@ SProcWindowsWMDispatch (ClientPtr client)
 {
   REQUEST(xReq);
 
-  /* It is bound to be non-local when there is byte swapping */
-  if (!LocalClient(client))
-    return WMErrorBase + WindowsWMClientNotLocal;
-
   /* only local clients are allowed WM access */
   switch (stuff->data)
     {
diff --git a/mi/miinitext.c b/mi/miinitext.c
index a59724b..6142f00 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -276,122 +276,6 @@ extern void CompositeExtensionInit(void);
 #endif
 extern void GEExtensionInit(void);
 
-/* The following is only a small first step towards run-time
- * configurable extensions.
- */
-typedef struct {
-    char *name;
-    Bool *disablePtr;
-} ExtensionToggle;
-
-static ExtensionToggle ExtensionToggleList[] =
-{
-    /* sort order is extension name string as shown in xdpyinfo */
-    { "Generic Events", &noGEExtension },
-#ifdef COMPOSITE
-    { "Composite", &noCompositeExtension },
-#endif
-#ifdef DAMAGE
-    { "DAMAGE", &noDamageExtension },
-#endif
-#ifdef DBE
-    { "DOUBLE-BUFFER", &noDbeExtension },
-#endif
-#ifdef DPMSExtension
-    { "DPMS", &noDPMSExtension },
-#endif
-#ifdef GLXEXT
-    { "GLX", &noGlxExtension },
-#endif
-#ifdef SCREENSAVER
-    { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
-#endif
-#ifdef MITSHM
-    { SHMNAME, &noMITShmExtension },
-#endif
-#ifdef RANDR
-    { "RANDR", &noRRExtension },
-#endif
-    { "RENDER", &noRenderExtension },
-#ifdef XCSECURITY
-    { "SECURITY", &noSecurityExtension },
-#endif
-#ifdef RES
-    { "X-Resource", &noResExtension },
-#endif
-#ifdef XF86BIGFONT
-    { "XFree86-Bigfont", &noXFree86BigfontExtension },
-#endif
-#ifdef XFreeXDGA
-    { "XFree86-DGA", &noXFree86DGAExtension },
-#endif
-#ifdef XF86DRI
-    { "XFree86-DRI", &noXFree86DRIExtension },
-#endif
-#ifdef XF86VIDMODE
-    { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
-#endif
-#ifdef XFIXES
-    { "XFIXES", &noXFixesExtension },
-#endif
-#ifdef PANORAMIX
-    { "XINERAMA", &noPanoramiXExtension },
-#endif
-    { "XInputExtension", NULL },
-    { "XKEYBOARD", NULL },
-#ifdef XSELINUX
-    { "SELinux", &noSELinuxExtension },
-#endif
-    { "XTEST", &noTestExtensions },
-#ifdef XV
-    { "XVideo", &noXvExtension },
-#endif
-    { NULL, NULL }
-};
-
-Bool EnableDisableExtension(char *name, Bool enable)
-{
-    ExtensionToggle *ext = &ExtensionToggleList[0];
-
-    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
-	if (strcmp(name, ext->name) == 0) {
-	    if (ext->disablePtr != NULL) {
-		*ext->disablePtr = !enable;
-		return TRUE;
-	    } else {
-		/* Extension is always on, impossible to disable */
-		return enable; /* okay if they wanted to enable,
-				  fail if they tried to disable */
-	    }
-	}
-    }
-
-    return FALSE;
-}
-
-void EnableDisableExtensionError(char *name, Bool enable)
-{
-    ExtensionToggle *ext = &ExtensionToggleList[0];
-    Bool found = FALSE;
-
-    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
-	if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
-	    ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
-	    found = TRUE;
-	    break;
-	}
-    }
-    if (found == FALSE)
-	ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
-    ErrorF("[mi] Only the following extensions can be run-time %s:\n",
-	   enable ? "enabled" : "disabled");
-    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
-	if (ext->disablePtr != NULL) {
-	    ErrorF("[mi]    %s\n", ext->name);
-	}
-    }
-}
-
 /* List of built-in (statically linked) extensions */
 static ExtensionModule staticExtensions[] = {
     { GEExtensionInit, "Generic Event Extension", &noGEExtension },
@@ -455,6 +339,49 @@ static ExtensionModule staticExtensions[] = {
     { NULL, NULL, NULL }
 };
 
+Bool EnableDisableExtension(char *name, Bool enable)
+{
+    ExtensionModule *ext;
+
+    for (ext = &staticExtensions[0]; ext->name != NULL; ext++) {
+	if (strcmp(name, ext->name) == 0) {
+	    if (ext->disablePtr != NULL) {
+		*ext->disablePtr = !enable;
+		return TRUE;
+	    } else {
+		/* Extension is always on, impossible to disable */
+		return enable; /* okay if they wanted to enable,
+				  fail if they tried to disable */
+	    }
+	}
+    }
+
+    return FALSE;
+}
+
+void EnableDisableExtensionError(char *name, Bool enable)
+{
+    ExtensionModule *ext;
+    Bool found = FALSE;
+
+    for (ext = &staticExtensions[0]; ext->name != NULL; ext++) {
+	if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
+	    ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
+	    found = TRUE;
+	    break;
+	}
+    }
+    if (found == FALSE)
+	ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
+    ErrorF("[mi] Only the following extensions can be run-time %s:\n",
+	   enable ? "enabled" : "disabled");
+    for (ext = &staticExtensions[0]; ext->name != NULL; ext++) {
+	if (ext->disablePtr != NULL) {
+	    ErrorF("[mi]    %s\n", ext->name);
+	}
+    }
+}
+
 static ExtensionModule *ExtensionModuleList = NULL;
 static int numExtensionModules = 0;
 
-- 
1.7.5.4



More information about the xorg-devel mailing list