xserver: Branch 'xorg-server-1.2-apple'

Ben Byer bbyer at kemper.freedesktop.org
Fri Nov 16 05:05:01 PST 2007


 configure.ac                     |   21 +++--
 dix/main.c                       |    5 -
 hw/darwin/Makefile.am            |    2 
 hw/darwin/apple/X11Application.m |    6 +
 hw/darwin/darwin.c               |   37 ++++++++--
 hw/darwin/darwin.h               |    1 
 hw/darwin/darwinEvents.c         |    2 
 hw/darwin/quartz/Makefile.am     |    2 
 hw/darwin/quartz/applewm.c       |    1 
 hw/darwin/quartz/quartz.c        |    7 +
 hw/darwin/quartz/quartz.h        |    2 
 hw/darwin/quartz/quartzStartup.c |  140 ---------------------------------------
 hw/darwin/quartz/xpr/appledri.c  |    2 
 hw/darwin/quartz/xpr/x-hook.c    |   10 ++
 hw/darwin/quartz/xpr/xprCursor.c |    3 
 hw/darwin/quartz/xpr/xprScreen.c |    3 
 mi/miinitext.c                   |    4 -
 miext/rootless/rootlessWindow.h  |    3 
 18 files changed, 79 insertions(+), 172 deletions(-)

New commits:
commit 6050c012359964e1b1dae141001ea162b2e77a76
Author: Ben Byer <bbyer at bbyer.local>
Date:   Fri Nov 16 05:04:54 2007 -0800

    From Jeremy Huddleston:
    1) Fixed a bug where XQUARTZ was #defined when auto but not when --enable-xquartz
    2) Cleaned up missing #includes and function prototypes.
    3) Fixed some invalid C syntax problems
    4) Removed a bunch of dead code
    5) Cleaned up code to prevent some warnings
    6) Bugfix in xpr/x-hook.c - looks like someone just forgot to finish writing code for hook_remove()... I only noticed it because gcc -Wall complained about reaching the end of a non-void function... lucky for us gcc is smarter than we are.

diff --git a/configure.ac b/configure.ac
index facca68..052f827 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1610,7 +1610,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
@@ -1618,15 +1617,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,[
@@ -1669,6 +1660,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 50dbb67..7f7b094 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 e23a3d1..0d3ee02 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 df42c1b..f36a5e2 100644
--- a/hw/darwin/apple/X11Application.m
+++ b/hw/darwin/apple/X11Application.m
@@ -47,6 +47,10 @@
 #include <unistd.h>
 #include <pthread.h>
 
+#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 789b0e2..c721ca1 100644
--- a/hw/darwin/darwin.c
+++ b/hw/darwin/darwin.c
@@ -69,6 +69,11 @@
 #include <IOKit/hidsystem/IOHIDLib.h>
 #include <IOKit/hidsystem/ev_keymap.h>
 
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include <X11/extensions/XShm.h>
+#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 ( !strcmp( argv[i], "-rootless" ) ) {
+        ErrorF( "Running rootless inside Mac OS X window server.\n" );
+        return 1;
+    }
 
-    if ((numDone = DarwinModeProcessArgument( argc, argv, i )))
-        return numDone;
+    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 25bba20..14443b9 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -72,7 +72,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 0fb5c9a..4201e0e 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -235,7 +235,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 26bc8eb..838af29 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 2272a70..11cec4a 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 fcd78ae..615ea8d 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 <sys/types.h>
@@ -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 172f323..e74a108 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 583941d..3c8412f 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,135 +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;
-}
-
-
-/*
- * 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);
-}
-
-
-/*
- * 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);
-}
-
-
-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 c38157d..7925239 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 323e373..2d9a564 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 02260bd..e45bd1f 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 589b172..49cd1c1 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 3ccd456..f6aa9bd 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -660,12 +660,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 093a2b3..ad876e5 100644
--- a/miext/rootless/rootlessWindow.h
+++ b/miext/rootless/rootlessWindow.h
@@ -36,6 +36,7 @@
 
 #include "rootlessCommon.h"
 
+#include <Xplugin.h>
 
 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


More information about the xorg-commit mailing list