diff options
Diffstat (limited to 'hw/darwin/quartz/quartzStartup.c')
-rw-r--r-- | hw/darwin/quartz/quartzStartup.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/hw/darwin/quartz/quartzStartup.c b/hw/darwin/quartz/quartzStartup.c index 38fde3cbe..ae156f8f0 100644 --- a/hw/darwin/quartz/quartzStartup.c +++ b/hw/darwin/quartz/quartzStartup.c @@ -38,11 +38,22 @@ #include "opaque.h" #include "micmap.h" #include <assert.h> -int NSApplicationMain(int argc, char *argv[]); char **envpGlobal; // argcGlobal and argvGlobal // are from dix/globals.c +#ifdef INX11APP +void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg); +void GlxExtensionInit(void); +void GlxWrapInitVisuals(miInitVisualsProcPtr *); + +static void server_thread (void *arg) { + extern int main (int argc, char **argv, char **envp); + exit (main (argcGlobal, argvGlobal, envpGlobal)); +} +#else +int NSApplicationMain(int argc, char *argv[]); + // GLX bundle function pointers typedef void (*GlxExtensionInitPtr)(void); static GlxExtensionInitPtr GlxExtensionInit = NULL; @@ -55,6 +66,7 @@ typedef Bool (*QuartzModeBundleInitPtr)(void); void * __DarwinglXMesaProvider = NULL; typedef void (*GlxPushProviderPtr)(void *); GlxPushProviderPtr GlxPushProvider = NULL; +#endif /* * DarwinHandleGUI @@ -74,7 +86,9 @@ void DarwinHandleGUI( int fd[2]; if (been_here) { +#ifdef INXDARWINAPP QuartzReadPreferences(); +#endif return; } been_here = TRUE; @@ -109,11 +123,27 @@ void DarwinHandleGUI( } } +#ifdef INX11APP + /* Initially I ran the X server on the main thread, and received + events on the second thread. But now we may be using Carbon, + that needs to run on the main thread. (Otherwise, when it's + prebound, it will initialize itself on the wrong thread) + + grr.. but doing that means that if the X thread gets scheduled + before the main thread when we're _not_ prebound, things fail, + so initialize by hand. */ + extern void _InitHLTB(void); + + _InitHLTB(); + + X11ControllerMain(argc, argv, server_thread, NULL); +#else main_exit = NSApplicationMain(argc, argv); +#endif exit(main_exit); } - +#ifndef INX11APP /* * QuartzLoadDisplayBundle * Try to load the appropriate bundle containing the back end display code. @@ -239,15 +269,21 @@ static void LoadGlxBundle(void) CFRelease(bundleURL); } +#else + +Bool QuartzLoadDisplayBundle(const char *dpyBundleName) +{ + return TRUE; + } + +#endif -/* - * DarwinGlxExtensionInit - * Initialize the GLX extension. - */ void DarwinGlxPushProvider(void *impl) { +#ifndef INX11APP if (!GlxExtensionInit) LoadGlxBundle(); +#endif GlxPushProvider(impl); } @@ -258,9 +294,10 @@ void DarwinGlxPushProvider(void *impl) */ void DarwinGlxExtensionInit(void) { +#ifndef INX11APP if (!GlxExtensionInit) LoadGlxBundle(); - +#endif GlxExtensionInit(); } @@ -271,9 +308,10 @@ void DarwinGlxExtensionInit(void) void DarwinGlxWrapInitVisuals( miInitVisualsProcPtr *procPtr) { +#ifndef INX11APP if (!GlxWrapInitVisuals) LoadGlxBundle(); - +#endif GlxWrapInitVisuals(procPtr); } |