diff --git a/configure.ac b/configure.ac index e40bf6585..7c07a938f 100644 --- a/configure.ac +++ b/configure.ac @@ -1708,7 +1708,6 @@ if test "X$XQUARTZ" = Xauto; then LDFLAGS=$save_LDFLAGS]) if test "X$xorg_cv_Carbon_framework" = Xyes; then - AC_DEFINE([XQUARTZ],[1],[Have Quartz]) XQUARTZ=yes else XQUARTZ=no @@ -1716,15 +1715,7 @@ if test "X$XQUARTZ" = Xauto; then fi if test "x$XQUARTZ" = xyes; then - if test "x$X11APP" = xauto; then - AC_MSG_CHECKING([whether to build X11.app]) - if test "x$XQUARTZ" = xyes ; then - X11APP=yes - else - X11APP=no - fi - AC_MSG_RESULT([$X11APP]) - fi + AC_DEFINE([XQUARTZ],[1],[Have Quartz]) # glxAGL / glxCGL don't work yet # AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[ @@ -1767,6 +1758,16 @@ if test "x$XQUARTZ" = xyes; then fi fi +if test "x$X11APP" = xauto; then + AC_MSG_CHECKING([whether to build X11.app]) + if test "x$XQUARTZ" = xyes ; then + X11APP=yes + else + X11APP=no + fi + AC_MSG_RESULT([$X11APP]) +fi + if test "x$LAUNCHD" = xauto; then # Do we want to have this default to on for Xquartz builds only or any time we have launchd (like Xnest or Xvfb on OS-X) #AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no]) diff --git a/dix/main.c b/dix/main.c index c322b0dd5..06f022bc7 100644 --- a/dix/main.c +++ b/dix/main.c @@ -260,11 +260,6 @@ main(int argc, char *argv[], char *envp[]) /* Quartz support on Mac OS X requires that the Cocoa event loop be in * the main thread. This allows the X server main to be called again * from another thread. */ - - /* TODO: Put some runtime conditioning on this, so it doesn't get - * executed by Xvfb, Xnest, Xfake, Xephyr, etc when built at the same - * time as Xquartz - */ DarwinHandleGUI(argc, argv, envp); #endif diff --git a/hw/darwin/Makefile.am b/hw/darwin/Makefile.am index e23a3d143..0d3ee0257 100644 --- a/hw/darwin/Makefile.am +++ b/hw/darwin/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = @XORG_CFLAGS@ -AM_CPPFLAGS = @XORG_INCS@ -I../../miext/rootless -DUSE_NEW_CLUT -DBUILD_DATE=\"$(BUILD_DATE)\" -DHAVE_XORG_CONFIG_H -DXFree86Server -DINXQUARTZ +AM_CPPFLAGS = @XORG_INCS@ -I$(top_srcdir)/Xext -I$(top_srcdir)/miext/rootless -DUSE_NEW_CLUT -DBUILD_DATE=\"$(BUILD_DATE)\" -DHAVE_XORG_CONFIG_H -DXFree86Server -DINXQUARTZ SUBDIRS = quartz utils diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m index f49429f8c..ae6f4bc11 100644 --- a/hw/darwin/apple/X11Application.m +++ b/hw/darwin/apple/X11Application.m @@ -47,6 +47,10 @@ #include #include +#include "rootlessCommon.h" + +WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c + #define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist" int X11EnableKeyEquivalents = TRUE; @@ -577,7 +581,7 @@ cfarray_to_nsarray (CFArrayRef in) ret = CFBooleanGetValue (value); else if (CFGetTypeID (value) == CFStringGetTypeID ()) { - const char *tem = [(NSString *) value lossyCString]; + const char *tem = [(NSString *) value UTF8String]; if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0) ret = YES; else diff --git a/hw/darwin/darwin.c b/hw/darwin/darwin.c index 789b0e284..c721ca112 100644 --- a/hw/darwin/darwin.c +++ b/hw/darwin/darwin.c @@ -69,6 +69,11 @@ #include #include +#ifdef MITSHM +#define _XSHM_SERVER_ +#include +#endif + #include "darwin.h" #include "darwinClut8.h" @@ -186,7 +191,9 @@ static Bool DarwinAddScreen( // allocate space for private per screen storage dfb = xalloc(sizeof(DarwinFramebufferRec)); - SCREEN_PRIV(pScreen) = dfb; + + // SCREEN_PRIV(pScreen) = dfb; + pScreen->devPrivates[darwinScreenIndex].ptr = dfb; // setup hardware/mode specific details ret = DarwinModeAddScreen(foundIndex, pScreen); @@ -342,7 +349,7 @@ static int DarwinMouseProc( DeviceIntPtr pPointer, int what ) { - char map[6]; + CARD8 map[6]; switch (what) { @@ -699,10 +706,30 @@ void ddxInitGlobals(void) */ int ddxProcessArgument( int argc, char *argv[], int i ) { - int numDone; + if ( !strcmp( argv[i], "-fullscreen" ) ) { + ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" ); + return 1; + } - if ((numDone = DarwinModeProcessArgument( argc, argv, i ))) - return numDone; + if ( !strcmp( argv[i], "-rootless" ) ) { + ErrorF( "Running rootless inside Mac OS X window server.\n" ); + return 1; + } + + if ( !strcmp( argv[i], "-quartz" ) ) { + ErrorF( "Running in parallel with Mac OS X Quartz window server.\n" ); + return 1; + } + + // The Mac OS X front end uses this argument, which we just ignore here. + if ( !strcmp( argv[i], "-nostartx" ) ) { + return 1; + } + + // This command line arg is passed when launched from the Aqua GUI. + if ( !strncmp( argv[i], "-psn_", 5 ) ) { + return 1; + } if ( !strcmp( argv[i], "-fakebuttons" ) ) { darwinFakeButtons = TRUE; diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h index 7e141fa01..392bb4378 100644 --- a/hw/darwin/darwin.h +++ b/hw/darwin/darwin.h @@ -76,7 +76,6 @@ Bool DarwinModeAddScreen(int index, ScreenPtr pScreen); Bool DarwinModeSetupScreen(int index, ScreenPtr pScreen); void DarwinModeInitOutput(int argc,char **argv); void DarwinModeInitInput(int argc, char **argv); -int DarwinModeProcessArgument(int argc, char *argv[], int i); void DarwinModeProcessEvent(xEvent *xe); void DarwinModeGiveUp(void); void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c index 9d206d04c..ee082335b 100644 --- a/hw/darwin/darwinEvents.c +++ b/hw/darwin/darwinEvents.c @@ -257,7 +257,7 @@ static void DarwinUpdateModifiers( void DarwinReleaseModifiers(void) { KeySym *map = NULL; xEvent ke; - int i = 0, j = 0, nevents = 0; + int i = 0; DEBUG_LOG("DarwinReleaseModifiers(%p)\n", &keyInfo.keyMap); diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am index 26bc8ebb9..838af2989 100644 --- a/hw/darwin/quartz/Makefile.am +++ b/hw/darwin/quartz/Makefile.am @@ -2,7 +2,7 @@ noinst_LIBRARIES = libXQuartz.a AM_CFLAGS = @XORG_CFLAGS@ AM_OBJCFLAGS = @XORG_CFLAGS@ -AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@ -DXBINDIR=\"${bindir}\" -DHAS_KL_API -DHAVE_XORG_CONFIG_H +AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../apple -I$(top_srcdir)/miext/rootless @XORG_INCS@ -DXBINDIR=\"${bindir}\" -DHAS_KL_API -DHAVE_XORG_CONFIG_H SUBDIRS = cr fullscreen xpr diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index 009eb8712..23463036a 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define _APPLEWM_SERVER_ #include "X11/extensions/applewmstr.h" #include "applewmExt.h" +#include "X11Application.h" #define DEFINE_ATOM_HELPER(func,atom_name) \ static Atom func (void) { \ diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c index fcd78ae34..615ea8d29 100644 --- a/hw/darwin/quartz/quartz.c +++ b/hw/darwin/quartz/quartz.c @@ -40,11 +40,14 @@ #include "X11/extensions/applewm.h" #include "applewmExt.h" +#include "X11Application.h" + // X headers #include "scrnintstr.h" #include "windowstr.h" #include "colormapst.h" #include "globals.h" +#include "rootlessWindow.h" // System headers #include @@ -111,7 +114,9 @@ Bool DarwinModeAddScreen( { // allocate space for private per screen Quartz specific storage QuartzScreenPtr displayInfo = xcalloc(sizeof(QuartzScreenRec), 1); - QUARTZ_PRIV(pScreen) = displayInfo; + + // QUARTZ_PRIV(pScreen) = displayInfo; + pScreen->devPrivates[quartzScreenIndex].ptr = displayInfo; // do Quartz mode specific initialization return quartzProcs->AddScreen(index, pScreen); diff --git a/hw/darwin/quartz/quartz.h b/hw/darwin/quartz/quartz.h index 172f3239b..e74a1082b 100644 --- a/hw/darwin/quartz/quartz.h +++ b/hw/darwin/quartz/quartz.h @@ -124,6 +124,4 @@ typedef struct _QuartzModeProcs { extern QuartzModeProcsPtr quartzProcs; extern int quartzHasRoot, quartzEnableRootless; -Bool QuartzLoadDisplayBundle(const char *dpyBundleName); - #endif diff --git a/hw/darwin/quartz/quartzStartup.c b/hw/darwin/quartz/quartzStartup.c index 73a9f1ac8..3c8412f2a 100644 --- a/hw/darwin/quartz/quartzStartup.c +++ b/hw/darwin/quartz/quartzStartup.c @@ -40,14 +40,10 @@ char **envpGlobal; // argcGlobal and argvGlobal // are from dix/globals.c -void X11ControllerMain(int argc, char *argv[], - void (*server_thread) (void *), void *server_arg); -void GlxExtensionInit(void); -void GlxWrapInitVisuals(miInitVisualsProcPtr *procPtr); +void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg); static void server_thread (void *arg) { extern int main(int argc, char **argv, char **envp); - exit (main (argcGlobal, argvGlobal, envpGlobal)); } @@ -65,7 +61,7 @@ void DarwinHandleGUI( char *envp[] ) { static Bool been_here = FALSE; - int main_exit, i; + int i; int fd[2]; if (been_here) { @@ -107,141 +103,5 @@ void DarwinHandleGUI( _InitHLTB(); X11ControllerMain(argc, argv, server_thread, NULL); - exit(main_exit); -} - -/* - * QuartzLoadDisplayBundle - * Try to load the appropriate bundle containing the back end display code. - */ -Bool QuartzLoadDisplayBundle( - const char *dpyBundleName) -{ - return TRUE; -} - -#ifdef GLXEXT -/* - * LoadGlxBundle - * The Quartz mode X server needs to dynamically load the appropriate - * bundle before initializing GLX. - */ -static void LoadGlxBundle(void) -{ - CFBundleRef mainBundle; - CFStringRef bundleName; - CFURLRef bundleURL; - CFBundleRef glxBundle; - - // Get the main bundle for the application - mainBundle = CFBundleGetMainBundle(); - - // Choose the bundle to load - ErrorF("Loading GLX bundle "); - if (/*quartzUseAGL*/0) { - bundleName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, - quartzOpenGLBundle, - kCFStringEncodingASCII, - kCFAllocatorNull); - ErrorF("%s (using Apple's OpenGL)\n", quartzOpenGLBundle); - } else { - bundleName = CFSTR("glxMesa.bundle"); - CFRetain(bundleName); // so we can release later - ErrorF("glxMesa.bundle (using Mesa)\n"); - } - - // Look for the appropriate GLX bundle in the main bundle by name - bundleURL = CFBundleCopyResourceURL(mainBundle, bundleName, - NULL, NULL); - if (!bundleURL) { - FatalError("Could not find GLX bundle."); - } - - // Make a bundle instance using the URLRef - glxBundle = CFBundleCreate(kCFAllocatorDefault, bundleURL); - - if (!CFBundleLoadExecutable(glxBundle)) { - FatalError("Could not load GLX bundle."); - } - - // Find the GLX init functions - if (!GlxExtensionInit || !GlxWrapInitVisuals) { - FatalError("Could not initialize GLX bundle."); - } - - // Release the CF objects - CFRelease(bundleName); - CFRelease(bundleURL); -} -# endif -#else - -Bool QuartzLoadDisplayBundle(const char *dpyBundleName) -{ - return TRUE; - } - -/* - * DarwinGlxExtensionInit - * Initialize the GLX extension. - */ -void DarwinGlxPushProvider(void *impl) -{ - GlxPushProvider(impl); -} - -/* - * DarwinGlxExtensionInit - * Initialize the GLX extension. - */ -void DarwinGlxExtensionInit(void) -{ - GlxExtensionInit(); -} - - -/* - * DarwinGlxWrapInitVisuals - */ -void DarwinGlxWrapInitVisuals( - miInitVisualsProcPtr *procPtr) -{ - if (!GlxWrapInitVisuals) - LoadGlxBundle(); - GlxWrapInitVisuals(procPtr); -} -#endif - -int DarwinModeProcessArgument( int argc, char *argv[], int i ) -{ - // fullscreen: CoreGraphics full-screen mode - // rootless: Cocoa rootless mode - // quartz: Default, either fullscreen or rootless - - if ( !strcmp( argv[i], "-fullscreen" ) ) { - ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" ); - return 1; - } - - if ( !strcmp( argv[i], "-rootless" ) ) { - ErrorF( "Running rootless inside Mac OS X window server.\n" ); - return 1; - } - - if ( !strcmp( argv[i], "-quartz" ) ) { - ErrorF( "Running in parallel with Mac OS X Quartz window server.\n" ); - return 1; - } - - // The Mac OS X front end uses this argument, which we just ignore here. - if ( !strcmp( argv[i], "-nostartx" ) ) { - return 1; - } - - // This command line arg is passed when launched from the Aqua GUI. - if ( !strncmp( argv[i], "-psn_", 5 ) ) { - return 1; - } - - return 0; + exit(0); } diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c index ef68c867b..9b2e7b05e 100644 --- a/hw/darwin/quartz/xpr/appledri.c +++ b/hw/darwin/quartz/xpr/appledri.c @@ -175,7 +175,7 @@ ProcAppleDRIAuthConnection( rep.authenticated = 1; if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) { - ErrorF("Failed to authenticate %u\n", stuff->magic); + ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic); rep.authenticated = 0; } WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep); diff --git a/hw/darwin/quartz/xpr/x-hook.c b/hw/darwin/quartz/xpr/x-hook.c index 323e3739d..2d9a564d6 100644 --- a/hw/darwin/quartz/xpr/x-hook.c +++ b/hw/darwin/quartz/xpr/x-hook.c @@ -50,12 +50,19 @@ X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data) { x_list *node, *cell; x_list *to_delete = NULL; + x_list *prev = NULL; - for (node = lst; node != NULL; node = node->next) + for (node = lst; node != NULL; prev = node, node = node->next) { cell = node->data; if (CELL_FUN (cell) == fun && CELL_DATA (cell) == data) + { to_delete = X_PFX (list_prepend) (to_delete, cell); + if(lst == node) + lst = node->next; + else + prev->next = node->next; + } } for (node = to_delete; node != NULL; node = node->next) @@ -66,6 +73,7 @@ X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data) } X_PFX (list_free) (to_delete); + return lst; } X_EXTERN void diff --git a/hw/darwin/quartz/xpr/xprCursor.c b/hw/darwin/quartz/xpr/xprCursor.c index 02260bd43..e45bd1fb3 100644 --- a/hw/darwin/quartz/xpr/xprCursor.c +++ b/hw/darwin/quartz/xpr/xprCursor.c @@ -381,7 +381,8 @@ QuartzInitCursor(ScreenPtr pScreen) if (ScreenPriv == NULL) return FALSE; - CURSOR_PRIV(pScreen) = ScreenPriv; + /* CURSOR_PRIV(pScreen) = ScreenPriv; */ + pScreen->devPrivates[darwinCursorScreenIndex].ptr = ScreenPriv; /* override some screen procedures */ ScreenPriv->QueryBestSize = pScreen->QueryBestSize; diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c index e31d78eb2..ad23006be 100644 --- a/hw/darwin/quartz/xpr/xprScreen.c +++ b/hw/darwin/quartz/xpr/xprScreen.c @@ -42,6 +42,9 @@ #include "Xplugin.h" #include "quartz/applewmExt.h" +// From xprFrame.c +WindowPtr xprGetXWindow(xp_window_id wid); + #ifdef DAMAGE # include "damage.h" #endif diff --git a/mi/miinitext.c b/mi/miinitext.c index ea0930249..02000efc8 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -661,12 +661,8 @@ InitVisualWrap() { miResetInitVisuals(); #ifdef GLXEXT -#ifdef INXQUARTZ - DarwinGlxWrapInitVisuals(&miInitVisualsProc); -#else GlxWrapInitVisuals(&miInitVisualsProc); #endif -#endif } #else /* XFree86LOADER */ diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h index 093a2b384..ad876e53f 100644 --- a/miext/rootless/rootlessWindow.h +++ b/miext/rootless/rootlessWindow.h @@ -36,6 +36,7 @@ #include "rootlessCommon.h" +#include Bool RootlessCreateWindow(WindowPtr pWin); Bool RootlessDestroyWindow(WindowPtr pWin); @@ -59,5 +60,7 @@ void RootlessPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, void RootlessPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what); void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width); +void RootlessNativeWindowMoved (WindowPtr pWin); +void RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state); #endif