[PATCH 1/6] Move main() from dix to ddx

Jon TURNEY jon.turney at dronecode.org.uk
Mon Jan 17 06:20:36 PST 2011


Rename the existing main() as dix_main() and arrange to call it
from main() in all ddx

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 dix/main.c                   |    6 ++----
 hw/dmx/dmxinit.c             |    6 ++++++
 hw/kdrive/ephyr/ephyrinit.c  |    7 +++++++
 hw/kdrive/fake/fakeinit.c    |    7 +++++++
 hw/kdrive/fbdev/fbinit.c     |    7 +++++++
 hw/vfb/InitOutput.c          |    6 ++++++
 hw/xfree86/common/xf86Init.c |    6 ++++++
 hw/xnest/Init.c              |    6 ++++++
 hw/xwin/InitOutput.c         |    5 +++++
 include/dixmain.h            |   29 +++++++++++++++++++++++++++++
 10 files changed, 81 insertions(+), 4 deletions(-)
 create mode 100644 include/dixmain.h

diff --git a/dix/main.c b/dix/main.c
index 692bec1..910b9ca 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -109,6 +109,7 @@ Equipment Corporation.
 #else
 #include "dixevents.h"		/* InitEvents() */
 #endif
+#include "dixmain.h"
 
 #ifdef DPMSExtension
 #include <X11/extensions/dpmsconst.h>
@@ -124,12 +125,9 @@ BOOL serverInitComplete = FALSE;
 pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
 
-int dix_main(int argc, char *argv[], char *envp[]);
+#endif
 
 int dix_main(int argc, char *argv[], char *envp[])
-#else
-int main(int argc, char *argv[], char *envp[])
-#endif
 {
     int		i;
     HWEventQueueType	alwaysCheckForInput[2];
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 74b3582..9012382 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -70,6 +70,7 @@
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/extutil.h>
 #endif /* GLXEXT */
+#include "dixmain.h"
 
 /* Global variables available to all Xserver/hw/dmx routines. */
 int             dmxNumScreens;
@@ -818,6 +819,11 @@ static void dmxSetDefaultFontPath(char *fp)
     defaultFontPath = dmxFontPath;
 }
 
+int main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
+
 /** This function is called in Xserver/os/utils.c from \a AbortServer().
  * We must ensure that backend and console state is restored in the
  * event the server shutdown wasn't clean. */
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 27cab3b..b539008 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -28,6 +28,7 @@
 #endif
 #include "ephyr.h"
 #include "ephyrlog.h"
+#include "dixmain.h"
 
 extern Window EphyrPreExistingHostWin;
 extern Bool   EphyrWantGrayScale;
@@ -47,6 +48,12 @@ extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
 
 void processScreenArg (char *screen_size, char *parent_id) ;
 
+int
+main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
+
 void
 InitCard (char *name)
 {
diff --git a/hw/kdrive/fake/fakeinit.c b/hw/kdrive/fake/fakeinit.c
index ba61959..03fb511 100644
--- a/hw/kdrive/fake/fakeinit.c
+++ b/hw/kdrive/fake/fakeinit.c
@@ -24,6 +24,13 @@
 #include <kdrive-config.h>
 #endif
 #include "fake.h"
+#include "dixmain.h"
+
+int
+main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
 
 void
 InitCard (char *name)
diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c
index 51e7e00..087068d 100644
--- a/hw/kdrive/fbdev/fbinit.c
+++ b/hw/kdrive/fbdev/fbinit.c
@@ -24,6 +24,13 @@
 #include <kdrive-config.h>
 #endif
 #include <fbdev.h>
+#include "dixmain.h"
+
+int
+main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
 
 void
 InitCard (char *name)
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 53f82f9..14d0c03 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -66,6 +66,7 @@ from The Open Group.
 #endif /* HAS_SHM */
 #include "dix.h"
 #include "miline.h"
+#include "dixmain.h"
 
 #define VFB_DEFAULT_WIDTH      1280
 #define VFB_DEFAULT_HEIGHT     1024
@@ -149,6 +150,11 @@ vfbBitsPerPixel(int depth)
     else return 32;
 }
 
+int main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
+
 void
 ddxGiveUp(void)
 {
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a1fda54..4702b00 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -86,6 +86,7 @@
 #include "dpmsproc.h"
 #endif
 #include <hotplug.h>
+#include "dixmain.h"
 
 
 #ifdef XF86PM
@@ -117,6 +118,11 @@ static Bool formatsDone = FALSE;
 #define PRE_RELEASE XORG_VERSION_SNAP
 #endif
 
+int main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
+
 static void
 xf86PrintBanner(void)
 {
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 8a90cc6..f6b4a20 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -42,11 +42,17 @@ is" without express or implied warranty.
 #ifdef DPMSExtension
 #include "dpmsproc.h"
 #endif
+#include "dixmain.h"
 
 Bool xnestDoFullGeneration = True;
 
 EventList *xnestEvents = NULL;
 
+int main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
+
 void
 InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
 {
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 38a658d..4e55a89 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -57,6 +57,7 @@ typedef HRESULT (*SHGETFOLDERPATHPROC)(
     LPTSTR pszPath
 );
 #endif
+#include "dixmain.h"
 
 /*
  * References to external symbols
@@ -188,6 +189,10 @@ ddxBeforeReset (void)
 }
 #endif
 
+int main(int argc, char *argv[], char *envp[])
+{
+  return dix_main(argc, argv, envp);
+}
 
 /* See Porting Layer Definition - p. 57 */
 void
diff --git a/include/dixmain.h b/include/dixmain.h
new file mode 100644
index 0000000..992823b
--- /dev/null
+++ b/include/dixmain.h
@@ -0,0 +1,29 @@
+/*
+  Copyright © 2009,2010 Jon TURNEY
+
+  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 (including the next
+  paragraph) shall be included in all copies or substantial portions of the
+  Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef DIXMAIN_H
+#define DIXMAIN_H
+
+int dix_main(int argc, char *argv[], char *envp[]);
+
+#endif /* DIXMAIN_H */
-- 
1.7.3.3



More information about the xorg-devel mailing list