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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Dec 4 18:03:42 PST 2007


 configure.ac                                                   |    2 
 dev/null                                                       |binary
 hw/darwin/Makefile.am                                          |   58 
 hw/darwin/Xquartz.man                                          |  156 -
 hw/darwin/apple/English.lproj/main.nib/classes.nib             |  318 ---
 hw/darwin/apple/English.lproj/main.nib/info.nib                |   18 
 hw/darwin/apple/Info.plist                                     |   35 
 hw/darwin/apple/Makefile.am                                    |   28 
 hw/darwin/apple/X11.xcodeproj/project.pbxproj                  |  344 ---
 hw/darwin/apple/bundle-main.c                                  |   82 
 hw/darwin/apple/launcher-main.c                                |   81 
 hw/darwin/apple/org.x.X11.plist                                |   25 
 hw/darwin/apple/server-main.c                                  |  904 ----------
 hw/darwin/quartz/Makefile.am                                   |   13 
 hw/darwin/quartz/X11Application.m                              |    3 
 hw/darwin/quartz/apple/English.lproj/InfoPlist.strings         |binary
 hw/darwin/quartz/apple/English.lproj/Localizable.strings       |binary
 hw/darwin/quartz/apple/English.lproj/main.nib/classes.nib      |  318 +++
 hw/darwin/quartz/apple/English.lproj/main.nib/info.nib         |   18 
 hw/darwin/quartz/apple/English.lproj/main.nib/keyedobjects.nib |binary
 hw/darwin/quartz/apple/Info.plist                              |   35 
 hw/darwin/quartz/apple/Makefile.am                             |   28 
 hw/darwin/quartz/apple/X11.icns                                |binary
 hw/darwin/quartz/apple/X11.xcodeproj/project.pbxproj           |  344 +++
 hw/darwin/quartz/apple/bundle-main.c                           |   82 
 hw/darwin/quartz/apple/launcher-main.c                         |   81 
 hw/darwin/quartz/apple/org.x.X11.plist                         |   25 
 hw/darwin/quartz/apple/server-main.c                           |  904 ++++++++++
 hw/darwin/quartz/xpr/Makefile.am                               |   54 
 hw/darwin/quartz/xpr/Xquartz.man                               |  156 +
 30 files changed, 2055 insertions(+), 2057 deletions(-)

New commits:
commit 3f60656eb330ea40f85d87b1b5aa3383c2281373
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Tue Dec 4 17:59:13 2007 -0800

    Darwin: Rework build system to more accurately reveal code infrastructure and facilitate future modularity.
    (cherry picked from commit e8399fd4d66a2b77b770c277e2fa424229a721b2)

diff --git a/configure.ac b/configure.ac
index 0e72d04..6841462 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2154,8 +2154,8 @@ hw/xgl/glxext/module/Makefile
 hw/xnest/Makefile
 hw/xwin/Makefile
 hw/darwin/Makefile
-hw/darwin/apple/Makefile
 hw/darwin/quartz/Makefile
+hw/darwin/quartz/apple/Makefile
 hw/darwin/quartz/xpr/Makefile
 hw/kdrive/Makefile
 hw/kdrive/ati/Makefile
diff --git a/hw/darwin/Makefile.am b/hw/darwin/Makefile.am
index f5b9e75..3f29a81 100644
--- a/hw/darwin/Makefile.am
+++ b/hw/darwin/Makefile.am
@@ -1,21 +1,13 @@
+noinst_LTLIBRARIES = libXdarwin.la
 AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
 	-DINXQUARTZ \
 	-DUSE_NEW_CLUT \
-	-DXFree86Server \
-	-I$(top_srcdir)/miext/rootless
+	-DXFree86Server
 
-if X11APP
-X11APP_SUBDIRS = apple
-endif
+SUBDIRS = . quartz
 
-SUBDIRS = quartz $(X11APP_SUBDIRS)
-DIST_SUBDIRS = quartz apple
-
-bin_PROGRAMS = Xquartz
-man1_MANS = Xquartz.man
-
-Xquartz_SOURCES = \
+libXdarwin_la_SOURCES = \
 	darwin.c \
 	darwinEvents.c \
 	darwinKeyboard.c \
@@ -23,49 +15,7 @@ Xquartz_SOURCES = \
 	$(top_srcdir)/fb/fbcmap_mi.c \
 	$(top_srcdir)/mi/miinitext.c
 
-#		We should probably add these once they're working, or are these obsolete and to be removed?
-#		./quartz/cr/libcr.a
-#		./quartz/fullscreen/libfullscreen.a
-
-Xquartz_LDADD = \
-	./quartz/libXquartz.a \
-	./quartz/xpr/libxpr.a \
-	$(top_builddir)/dix/dixfonts.lo \
-	$(top_builddir)/dix/libdix.la \
-	$(top_builddir)/os/libos.la \
-	$(top_builddir)/dix/libxpstubs.la \
-	$(top_builddir)/miext/shadow/libshadow.la \
-	$(top_builddir)/fb/libfb.la \
-	$(top_builddir)/mi/libmi.la \
-	$(top_builddir)/composite/libcomposite.la \
-	$(top_builddir)/damageext/libdamageext.la \
-	$(top_builddir)/miext/damage/libdamage.la \
-	$(top_builddir)/xfixes/libxfixes.la \
-	$(top_builddir)/miext/cw/libcw.la \
-	$(top_builddir)/Xext/libXext.la \
-	$(top_builddir)/xkb/libxkb.la \
-	$(top_builddir)/xkb/libxkbstubs.la \
-	$(top_builddir)/Xi/libXi.la \
-	$(top_builddir)/dbe/libdbe.la \
-	$(top_builddir)/record/librecord.la \
-	$(top_builddir)/XTrap/libxtrap.la \
-	$(top_builddir)/miext/rootless/librootless.la \
-	$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
-	$(top_builddir)/miext/rootless/accel/librlAccel.la \
-	$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
-
-Xquartz_LDFLAGS =  \
-	-XCClinker -Objc \
-	-Wl,-u,_miDCInitialize \
-	-Wl,-framework,Carbon \
-	-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \
-	-Wl,-framework,OpenGL \
-	-Wl,-framework,Cocoa \
-	-Wl,-framework,CoreAudio \
-	-Wl,-framework,IOKit
-
 EXTRA_DIST = \
-	Xquartz.man \
 	darwinClut8.h \
 	darwin.h \
 	darwinKeyboard.h
diff --git a/hw/darwin/Xquartz.man b/hw/darwin/Xquartz.man
deleted file mode 100644
index 37a7f1a..0000000
--- a/hw/darwin/Xquartz.man
+++ /dev/null
@@ -1,156 +0,0 @@
-.TH XQUARTZ 1 __vendorversion__
-.SH NAME
-Xquartz \- X window system server for Quartz operating system
-.SH SYNOPSIS
-.B Xquartz
-[ options ] ...
-.SH DESCRIPTION
-.I Xquartz
-is the X window server for Mac OS X provided by Apple.
-.I Xquartz
-runs in parallel with Aqua in rootless mode. In rootless mode, the X
-window system and Mac OS X share your display.  The root window of the
-X11 display is the size of the screen and contains all the other
-windows. The X11 root window is not displayed in rootless mode as Mac
-OS X handles the desktop background.
-.SH OPTIONS
-.PP
-In addition to the normal server options described in the \fIXserver(1)\fP
-manual page, \fIXquartz\fP accepts the following command line switches:
-.TP 8
-.B \-fakebuttons
-Emulates a 3 button mouse using modifier keys. By default, the Command modifier
-is used to emulate button 2 and Option is used for button 3. Thus, clicking the
-first mouse button while holding down Command will act like clicking
-button 2. Holding down Option will simulate button 3.
-.TP 8
-.B \-nofakebuttons
-Do not emulate a 3 button mouse. This is the default.
-.TP 8
-.B "\-fakemouse2 \fImodifiers\fP"
-Change the modifier keys used to emulate the second mouse button. By default,
-Command is used to emulate the second button. Any combination of the following
-modifier names may be used: Shift, Option, Control, Command, Fn. For example,
-.B \-fakemouse2 """Option,Shift""
-will set holding Option, Shift and clicking on button one as equivalent to
-clicking the second mouse button.
-.TP 8
-.B "\-fakemouse3 \fImodifiers\fP"
-Change the modifier keys used to emulate the third mouse button. By default,
-Option is used to emulate the third button. Any combination of the following
-modifier names may be used: Shift, Option, Control, Command, Fn. For example,
-.B \-fakemouse3 """Control,Shift""
-will set holding Control, Shift and clicking on button one as equivalent to
-clicking the third mouse button.
-.TP 8
-.B "\-swapAltMeta"
-Swaps the meaning of the Alt and Meta modifier keys.
-.TP 8
-.B "\-keymap \fIfile\fP"
-On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
-The default is to read this keymapping from USA.keymapping. With this option
-the keymapping will be read from \fIfile\fP instead. If the file's path is
-not specified, it will be searched for in Library/Keyboards/ underneath the
-following directories (in order): ~, /, /Network, /System.
-.TP 8
-.B \-nokeymap
-On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
-With this option \fIXquartz\fP queries the kernel for the current keymapping
-instead of reading it from a file. This will often fail on newer kernels.
-.TP 8
-.B "\-depth \fIdepth\fP"
-Specifies the color bit depth to use. Currently only 15, and 24 color
-bits per pixel are supported. If not specified, defaults to the depth
-of the main display.
-.SH CUSTOMIZATION
-\fIXquartz\fP can also be customized using the defaults(1) command. The available options are:
-.TP 8
-.B defaults write com.apple.x11 enable_fake_buttons -boolean true
-Equivalent to the \fB-fakebuttons\fP command line option.
-.TP 8
-.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP
-Equivalent to the \fB-fakemouse2\fP option.
-.TP 8
-.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP
-Equivalent to the \fB-fakemouse3\fP option.
-.TP 8
-.B defaults write com.apple.x11 swap_alt_meta -boolean true
-Equivalent to the \fB-swapAltMeta\fP option.
-.TP 8
-.B defaults write com.apple.x11 keymap_file \fIfilename\fP
-Equivalent to the \fB-keymap\fP option.
-.TP 8
-.B defaults write com.apple.x11 no_quit_alert -boolean true
-Disables the alert dialog displayed when attempting to quit X11.
-.TP 8
-.B defaults write com.apple.x11 no_auth -boolean true
-Stops the X server requiring that clients authenticate themselves when
-connecting. See Xsecurity(__miscmansuffix__).
-.TP 8
-.B defaults write com.apple.x11 nolisten_tcp -boolean true
-Prevents the X server accepting remote connections.
-.TP 8
-.B defaults write com.apple.x11 xinit_kills_server -boolean false
-Stops the X server exiting when the xinitrc script terminates.
-.TP 8
-.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false
-Allows system hotkeys to be handled while in X11 fullscreen mode.
-.TP 8
-.B defaults write com.apple.x11 enable_system_beep -boolean false
-Don't use the standard system beep effect for X11 alerts.
-.TP 8
-.B defaults write com.apple.x11 enable_key_equivalents -boolean false
-Disable menu keyboard equivalents while X11 windows are focused.
-.TP 8
-.B defaults write com.apple.x11 depth \fIdepth\fP
-Equivalent to the \fB-depth\fP option.
-.SH "SEE ALSO"
-.PP
-X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1)
-.PP
-.SH AUTHORS
-XFree86 was originally ported to Mac OS X Server by John Carmack. Dave
-Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
-Torrey T. Lyons improved and integrated this code into the XFree86
-Project's mainline for the 4.0.2 release.
-.PP
-The following members of the XonX Team contributed to the following
-releases (in alphabetical order):
-.TP 4
-XFree86 4.1.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - Cocoa version of XDarwin front end
-.br
-Gregory Robert Parker - Original Quartz implementation
-.br
-Christoph Pfisterer - Dynamic shared X libraries
-.br
-Toshimitsu Tanaka - Japanese localization
-.TP 4
-XFree86 4.2.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Pablo Di Noto - Spanish localization
-.br
-Paul Edens - Dutch localization
-.br
-Kyunghwan Kim - Korean localization
-.br
-Mario Klebsch - Non-US keyboard support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - German localization
-.br
-Patrik Montgomery - Swedish localization
-.br
-Greg Parker - Rootless support
-.br
-Toshimitsu Tanaka - Japanese localization
-.br
-Olivier Verdier - French localization
diff --git a/hw/darwin/apple/English.lproj/InfoPlist.strings b/hw/darwin/apple/English.lproj/InfoPlist.strings
deleted file mode 100644
index 88e1f04..0000000
Binary files a/hw/darwin/apple/English.lproj/InfoPlist.strings and /dev/null differ
diff --git a/hw/darwin/apple/English.lproj/Localizable.strings b/hw/darwin/apple/English.lproj/Localizable.strings
deleted file mode 100644
index c83b085..0000000
Binary files a/hw/darwin/apple/English.lproj/Localizable.strings and /dev/null differ
diff --git a/hw/darwin/apple/English.lproj/main.nib/classes.nib b/hw/darwin/apple/English.lproj/main.nib/classes.nib
deleted file mode 100644
index a82159b..0000000
--- a/hw/darwin/apple/English.lproj/main.nib/classes.nib
+++ /dev/null
@@ -1,318 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IBClasses</key>
-	<array>
-		<dict>
-			<key>CLASS</key>
-			<string>IBLibraryObjectTemplate</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>draggedView</key>
-				<string>NSView</string>
-				<key>representedObject</key>
-				<string>NSObject</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>IBInspector</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>inspectorView</key>
-				<string>NSView</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSDateFormatter</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSFormatter</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>apps_table_cancel</key>
-				<string>id</string>
-				<key>apps_table_delete</key>
-				<string>id</string>
-				<key>apps_table_done</key>
-				<string>id</string>
-				<key>apps_table_duplicate</key>
-				<string>id</string>
-				<key>apps_table_new</key>
-				<string>id</string>
-				<key>apps_table_show</key>
-				<string>id</string>
-				<key>bring_to_front</key>
-				<string>id</string>
-				<key>close_window</key>
-				<string>id</string>
-				<key>enable_fullscreen_changed</key>
-				<string>id</string>
-				<key>minimize_window</key>
-				<string>id</string>
-				<key>next_window</key>
-				<string>id</string>
-				<key>prefs_changed</key>
-				<string>id</string>
-				<key>prefs_show</key>
-				<string>id</string>
-				<key>previous_window</key>
-				<string>id</string>
-				<key>toggle_fullscreen</key>
-				<string>id</string>
-				<key>x11_help</key>
-				<string>id</string>
-				<key>zoom_window</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>X11Controller</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>apps_separator</key>
-				<string>id</string>
-				<key>apps_table</key>
-				<string>id</string>
-				<key>depth</key>
-				<string>id</string>
-				<key>dock_apps_menu</key>
-				<string>id</string>
-				<key>dock_menu</key>
-				<string>id</string>
-				<key>dock_window_separator</key>
-				<string>id</string>
-				<key>enable_auth</key>
-				<string>id</string>
-				<key>enable_fullscreen</key>
-				<string>id</string>
-				<key>enable_keyequivs</key>
-				<string>id</string>
-				<key>enable_tcp</key>
-				<string>id</string>
-				<key>fake_buttons</key>
-				<string>id</string>
-				<key>prefs_panel</key>
-				<string>id</string>
-				<key>sync_keymap</key>
-				<string>id</string>
-				<key>toggle_fullscreen_item</key>
-				<string>id</string>
-				<key>use_sysbeep</key>
-				<string>id</string>
-				<key>window_separator</key>
-				<string>id</string>
-				<key>x11_about_item</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSNumberFormatter</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSFormatter</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSFormatter</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>alignCenter:</key>
-				<string>id</string>
-				<key>alignJustified:</key>
-				<string>id</string>
-				<key>alignLeft:</key>
-				<string>id</string>
-				<key>alignRight:</key>
-				<string>id</string>
-				<key>arrangeInFront:</key>
-				<string>id</string>
-				<key>centerSelectionInVisibleArea:</key>
-				<string>id</string>
-				<key>changeFont:</key>
-				<string>id</string>
-				<key>checkSpelling:</key>
-				<string>id</string>
-				<key>clear:</key>
-				<string>id</string>
-				<key>clearRecentDocuments:</key>
-				<string>id</string>
-				<key>complete:</key>
-				<string>id</string>
-				<key>copy:</key>
-				<string>id</string>
-				<key>copyFont:</key>
-				<string>id</string>
-				<key>copyRuler:</key>
-				<string>id</string>
-				<key>cut:</key>
-				<string>id</string>
-				<key>delete:</key>
-				<string>id</string>
-				<key>deminiaturize:</key>
-				<string>id</string>
-				<key>fax:</key>
-				<string>id</string>
-				<key>hide:</key>
-				<string>id</string>
-				<key>hideOtherApplications:</key>
-				<string>id</string>
-				<key>loosenKerning:</key>
-				<string>id</string>
-				<key>lowerBaseline:</key>
-				<string>id</string>
-				<key>makeKeyAndOrderFront:</key>
-				<string>id</string>
-				<key>miniaturize:</key>
-				<string>id</string>
-				<key>newDocument:</key>
-				<string>id</string>
-				<key>openDocument:</key>
-				<string>id</string>
-				<key>orderBack:</key>
-				<string>id</string>
-				<key>orderFront:</key>
-				<string>id</string>
-				<key>orderFrontColorPanel:</key>
-				<string>id</string>
-				<key>orderFrontHelpPanel:</key>
-				<string>id</string>
-				<key>orderOut:</key>
-				<string>id</string>
-				<key>outline:</key>
-				<string>id</string>
-				<key>paste:</key>
-				<string>id</string>
-				<key>pasteAsPlainText:</key>
-				<string>id</string>
-				<key>pasteAsRichText:</key>
-				<string>id</string>
-				<key>pasteFont:</key>
-				<string>id</string>
-				<key>pasteRuler:</key>
-				<string>id</string>
-				<key>pause:</key>
-				<string>id</string>
-				<key>performClose:</key>
-				<string>id</string>
-				<key>performFindPanelAction:</key>
-				<string>id</string>
-				<key>performMiniaturize:</key>
-				<string>id</string>
-				<key>performZoom:</key>
-				<string>id</string>
-				<key>play:</key>
-				<string>id</string>
-				<key>print:</key>
-				<string>id</string>
-				<key>printDocument:</key>
-				<string>id</string>
-				<key>raiseBaseline:</key>
-				<string>id</string>
-				<key>record:</key>
-				<string>id</string>
-				<key>redo:</key>
-				<string>id</string>
-				<key>resume:</key>
-				<string>id</string>
-				<key>revertDocumentToSaved:</key>
-				<string>id</string>
-				<key>run:</key>
-				<string>id</string>
-				<key>runPageLayout:</key>
-				<string>id</string>
-				<key>runToolbarCustomizationPalette:</key>
-				<string>id</string>
-				<key>saveAllDocuments:</key>
-				<string>id</string>
-				<key>saveDocument:</key>
-				<string>id</string>
-				<key>saveDocumentAs:</key>
-				<string>id</string>
-				<key>saveDocumentTo:</key>
-				<string>id</string>
-				<key>selectAll:</key>
-				<string>id</string>
-				<key>selectText:</key>
-				<string>id</string>
-				<key>showGuessPanel:</key>
-				<string>id</string>
-				<key>showHelp:</key>
-				<string>id</string>
-				<key>start:</key>
-				<string>id</string>
-				<key>startSpeaking:</key>
-				<string>id</string>
-				<key>stop:</key>
-				<string>id</string>
-				<key>stopSpeaking:</key>
-				<string>id</string>
-				<key>subscript:</key>
-				<string>id</string>
-				<key>superscript:</key>
-				<string>id</string>
-				<key>terminate:</key>
-				<string>id</string>
-				<key>tightenKerning:</key>
-				<string>id</string>
-				<key>toggleContinuousSpellChecking:</key>
-				<string>id</string>
-				<key>toggleRuler:</key>
-				<string>id</string>
-				<key>toggleToolbarShown:</key>
-				<string>id</string>
-				<key>turnOffKerning:</key>
-				<string>id</string>
-				<key>turnOffLigatures:</key>
-				<string>id</string>
-				<key>underline:</key>
-				<string>id</string>
-				<key>undo:</key>
-				<string>id</string>
-				<key>unhideAllApplications:</key>
-				<string>id</string>
-				<key>unscript:</key>
-				<string>id</string>
-				<key>useAllLigatures:</key>
-				<string>id</string>
-				<key>useStandardKerning:</key>
-				<string>id</string>
-				<key>useStandardLigatures:</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>FirstResponder</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-	</array>
-	<key>IBVersion</key>
-	<integer>1</integer>
-</dict>
-</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/info.nib b/hw/darwin/apple/English.lproj/main.nib/info.nib
deleted file mode 100644
index 88bc626..0000000
--- a/hw/darwin/apple/English.lproj/main.nib/info.nib
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IBFramework Version</key>
-	<string>588</string>
-	<key>IBOpenObjects</key>
-	<array>
-		<integer>244</integer>
-		<integer>29</integer>
-		<integer>423</integer>
-	</array>
-	<key>IBSystem Version</key>
-	<string>9A356</string>
-	<key>targetFramework</key>
-	<string>IBCocoaFramework</string>
-</dict>
-</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
deleted file mode 100644
index 8b31450..0000000
Binary files a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib and /dev/null differ
diff --git a/hw/darwin/apple/Info.plist b/hw/darwin/apple/Info.plist
deleted file mode 100644
index 66f1f6b..0000000
--- a/hw/darwin/apple/Info.plist
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>X11</string>
-	<key>CFBundleGetInfoString</key>
-	<string>X11</string>
-	<key>CFBundleIconFile</key>
-	<string>X11.icns</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.x.X11</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>X11</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>2.0</string>
-	<key>CFBundleSignature</key>
-	<string>x11a</string>
-	<key>CSResourcesFileMapped</key>
-	<true/>
-	<key>NSHumanReadableCopyright</key>
-	<string>Copyright © 2003-2007, Apple Inc.
-Copyright © 2003, XFree86 Project, Inc.</string>
-	<key>NSMainNibFile</key>
-	<string>main</string>
-	<key>NSPrincipalClass</key>
-	<string>X11Application</string>
-</dict>
-</plist>
diff --git a/hw/darwin/apple/Makefile.am b/hw/darwin/apple/Makefile.am
deleted file mode 100644
index a6e2dfb..0000000
--- a/hw/darwin/apple/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-bin_SCRIPTS = x11app
-
-.PHONY: x11app
-
-x11app:
-	xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
-
-install-data-hook:
-	xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
-	$(MKDIR_P) "$(DESTDIR)/System/Library/LaunchAgents/"
-	$(INSTALL) org.x.X11.plist "$(DESTDIR)/System/Library/LaunchAgents/"
-
-clean-local:
-	rm -rf build
-
-EXTRA_DIST = \
-	org.x.X11.plist \
-	Info.plist \
-	X11.icns \
-	bundle-main.c \
-	launcher-main.c \
-	server-main.c \
-	English.lproj/InfoPlist.strings \
-	English.lproj/Localizable.strings \
-	English.lproj/main.nib/classes.nib \
-	English.lproj/main.nib/info.nib \
-	English.lproj/main.nib/keyedobjects.nib \
-	X11.xcodeproj/project.pbxproj
diff --git a/hw/darwin/apple/X11.icns b/hw/darwin/apple/X11.icns
deleted file mode 100644
index d770e61..0000000
Binary files a/hw/darwin/apple/X11.icns and /dev/null differ
diff --git a/hw/darwin/apple/X11.xcodeproj/project.pbxproj b/hw/darwin/apple/X11.xcodeproj/project.pbxproj
deleted file mode 100644
index 225f371..0000000
--- a/hw/darwin/apple/X11.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,344 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 42;
-	objects = {
-
-/* Begin PBXBuildFile section */
-		3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDE0D04BF110020CA24 /* launcher-main.c */; };
-		3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDF0D04BF110020CA24 /* server-main.c */; };
-		527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
-		527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
-		527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; };
-		527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; };
-		527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; };
-		527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; };
-		527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; };
-		52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
-		0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
-		1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
-		3F5E1BDE0D04BF110020CA24 /* launcher-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "launcher-main.c"; sourceTree = "<group>"; };
-		3F5E1BDF0D04BF110020CA24 /* server-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "server-main.c"; sourceTree = "<group>"; };
-		50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; };
-		50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; };
-		50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
-		527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-		527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
-		570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		527F241E0B5D938C007840A7 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */,
-				527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		195DF8CFFE9D517E11CA2CBB /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				527F24270B5D938C007840A7 /* X11.app */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-		20286C29FDCF999611CA2CEA /* X11 */ = {
-			isa = PBXGroup;
-			children = (
-				20286C2AFDCF999611CA2CEA /* Sources */,
-				20286C2CFDCF999611CA2CEA /* Resources */,
-				20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
-				195DF8CFFE9D517E11CA2CBB /* Products */,
-				527F24260B5D938C007840A7 /* Info.plist */,
-			);
-			name = X11;
-			sourceTree = "<group>";
-		};
-		20286C2AFDCF999611CA2CEA /* Sources */ = {
-			isa = PBXGroup;
-			children = (
-				3F5E1BDE0D04BF110020CA24 /* launcher-main.c */,
-				3F5E1BDF0D04BF110020CA24 /* server-main.c */,
-				50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
-			);
-			name = Sources;
-			sourceTree = "<group>";
-		};
-		20286C2CFDCF999611CA2CEA /* Resources */ = {
-			isa = PBXGroup;
-			children = (
-				52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */,
-				50459C5F038587C60ECA21EC /* X11.icns */,
-				0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */,
-				02345980000FD03B11CA0E72 /* main.nib */,
-			);
-			name = Resources;
-			sourceTree = "<group>";
-		};
-		20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = {
-			isa = PBXGroup;
-			children = (
-				50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */,
-				570C5748047186C400ACF82F /* SystemConfiguration.framework */,
-			);
-			name = "External Frameworks and Libraries";
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
-		527F24170B5D938C007840A7 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
-		527F24160B5D938C007840A7 /* X11 */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */;
-			buildPhases = (
-				527F24170B5D938C007840A7 /* Headers */,
-				527F24180B5D938C007840A7 /* Resources */,
-				527F241C0B5D938C007840A7 /* Sources */,
-				527F241E0B5D938C007840A7 /* Frameworks */,
-				527F24210B5D938C007840A7 /* Rez */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = X11;
-			productName = X11;
-			productReference = 527F24270B5D938C007840A7 /* X11.app */;
-			productType = "com.apple.product-type.application";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		20286C28FDCF999611CA2CEA /* Project object */ = {
-			isa = PBXProject;
-			buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */;
-			compatibilityVersion = "Xcode 2.4";
-			hasScannedForEncodings = 1;
-			mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
-			projectDirPath = "";
-			projectRoot = "";
-			targets = (
-				527F24160B5D938C007840A7 /* X11 */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
-		527F24180B5D938C007840A7 /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				527F24370B5D9D89007840A7 /* Info.plist in Resources */,
-				527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */,
-				527F241A0B5D938C007840A7 /* main.nib in Resources */,
-				527F241B0B5D938C007840A7 /* X11.icns in Resources */,
-				52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXRezBuildPhase section */
-		527F24210B5D938C007840A7 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXRezBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
-		527F241C0B5D938C007840A7 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
-				3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */,
-				3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
-		02345980000FD03B11CA0E72 /* main.nib */ = {
-			isa = PBXVariantGroup;
-			children = (
-				1870340FFE93FCAF11CA0CD7 /* English */,
-			);
-			name = main.nib;
-			sourceTree = "<group>";
-		};
-		0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
-			isa = PBXVariantGroup;
-			children = (
-				0867D6ABFE840B52C02AAC07 /* English */,
-			);
-			name = InfoPlist.strings;
-			sourceTree = "<group>";
-		};
-		52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = {
-			isa = PBXVariantGroup;
-			children = (
-				52D9C0EC0BCDDF6B00CD2AFC /* English */,
-			);
-			name = Localizable.strings;
-			sourceTree = "<group>";
-		};
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
-		527F24090B5D8FFC007840A7 /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				INSTALL_MODE_FLAG = "a+rX";
-			};
-			name = Development;
-		};
-		527F240A0B5D8FFC007840A7 /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				INSTALL_MODE_FLAG = "a+rX";
-			};
-			name = Deployment;
-		};
-		527F240B0B5D8FFC007840A7 /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				INSTALL_MODE_FLAG = "a+rX";
-			};
-			name = Default;
-		};
-		527F24230B5D938C007840A7 /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				FRAMEWORK_SEARCH_PATHS = "";
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
-				HEADER_SEARCH_PATHS = /usr/X11/include;
-				INFOPLIST_FILE = Info.plist;
-				INSTALL_PATH = /usr/X11;
-				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-lXau",
-					"-lxcb",
-					"-lX11",
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = X11;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = app;
-			};
-			name = Development;
-		};
-		527F24240B5D938C007840A7 /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				FRAMEWORK_SEARCH_PATHS = "";
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
-				HEADER_SEARCH_PATHS = /usr/X11/include;
-				INFOPLIST_FILE = Info.plist;
-				INSTALL_PATH = /usr/X11;
-				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-lXau",
-					"-lxcb",
-					"-lX11",
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = X11;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = app;
-			};
-			name = Deployment;
-		};
-		527F24250B5D938C007840A7 /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				FRAMEWORK_SEARCH_PATHS = "";
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
-				HEADER_SEARCH_PATHS = /usr/X11/include;
-				INFOPLIST_FILE = Info.plist;
-				INSTALL_PATH = /usr/X11;
-				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-lXau",
-					"-lxcb",
-					"-lX11",
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = X11;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = app;
-			};
-			name = Default;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				527F24090B5D8FFC007840A7 /* Development */,
-				527F240A0B5D8FFC007840A7 /* Deployment */,
-				527F240B0B5D8FFC007840A7 /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				527F24230B5D938C007840A7 /* Development */,
-				527F24240B5D938C007840A7 /* Deployment */,
-				527F24250B5D938C007840A7 /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = 20286C28FDCF999611CA2CEA /* Project object */;
-}
diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c
deleted file mode 100644
index c436d51..0000000
--- a/hw/darwin/apple/bundle-main.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* main.c -- X application launcher
- 
- Copyright (c) 2007 Jeremy Huddleston
- Copyright (c) 2007 Apple Inc
- 
- 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 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 ABOVE LISTED COPYRIGHT
- HOLDER(S) 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.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#include <X11/Xlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-
-int launcher_main(int argc, char **argv);
-int server_main(int argc, char **argv);
-
-int main(int argc, char **argv) {
-    Display *display;
-  
-    fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
-    int i;
-    for(i=0; i < argc; i++) {
-        fprintf(stderr, "\targv[%d] = %s\n", i, argv[i]);
-    }
-    
-    /* First check if launchd started us */
-    if(argc == 2 && !strncmp(argv[1], "--launchd", 9)) {
-        argc--;
-        argv[1] = argv[0];
-        argv++;
-        fprintf(stderr, "X11.app: main(): launchd called us, running server_main()");
-        return server_main(argc, argv);
-    }
-
-    /* If we have a process serial number and it's our only arg, act as if
-     * the user double clicked the app bundle: launch app_to_run if possible
-     */
-    if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
-        /* Now, try to open a display, if so, run the launcher */
-        display = XOpenDisplay(NULL);
-        if(display) {
-            fprintf(stderr, "X11.app: main(): closing the display");
-            /* Could open the display, start the launcher */
-            XCloseDisplay(display);
-
-            /* Give 2 seconds for the server to start... 
-             * TODO: *Really* fix this race condition
-             */
-            usleep(2000);
-            fprintf(stderr, "X11.app: main(): running launcher_main()");
-            return launcher_main(argc, argv);
-        }
-    }
-
-    /* Couldn't open the display or we were called with arguments,
-     * just want to start a server.
-     */
-    fprintf(stderr, "X11.app: main(): running server_main()");
-    return server_main(argc, argv);
-}
diff --git a/hw/darwin/apple/launcher-main.c b/hw/darwin/apple/launcher-main.c
deleted file mode 100644
index 60a1624..0000000
--- a/hw/darwin/apple/launcher-main.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* main.c -- X application launcher
- 
- Copyright (c) 2007 Apple Inc.
- 
- 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 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 ABOVE LISTED COPYRIGHT
- HOLDER(S) 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.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#define DEFAULT_APP "/usr/X11/bin/xterm"
-
-int launcher_main (int argc, char **argv) {
-  char *command = DEFAULT_APP;
-  const char *newargv[7];
-  int child;
-  
-
-	CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(CFSTR("app_to_run"),
-									kCFPreferencesCurrentApplication);
-	
-	if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
-		CFPreferencesSetAppValue(CFSTR("app_to_run"), CFSTR(DEFAULT_APP), 
-								 kCFPreferencesCurrentApplication);
-		CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
-	} else {
-		int len = CFStringGetLength((CFStringRef)PlistRef)+1;
-		command = (char *) malloc(len);
-		CFStringGetCString((CFStringRef)PlistRef, command, len,  kCFStringEncodingASCII);
-		fprintf(stderr, "command=%s\n", command);
-	}
-	
-	if (PlistRef) CFRelease(PlistRef);
-	
-	newargv[0] = "/usr/bin/login";
-	newargv[1] = "-fp";
-	newargv[2] = getlogin();
-	newargv[3] = "/bin/sh";
-	newargv[4] = "-c";
-	newargv[5] = command;
-	newargv[6] = NULL;
-
-    child = fork();
-	
-    switch (child) {
-    case -1:				/* error */
-      perror ("fork");
-      return EXIT_FAILURE;		
-    case 0:				    /* child */
-      execvp (newargv[0], (char **const) newargv);
-      perror ("Couldn't exec");
-      _exit (1);
-   }
-	
-    return 0;
-}
diff --git a/hw/darwin/apple/org.x.X11.plist b/hw/darwin/apple/org.x.X11.plist
deleted file mode 100644
index 6c6be91..0000000
--- a/hw/darwin/apple/org.x.X11.plist
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>Label</key>
-		<string>org.x.X11</string>
-	<key>Program</key>
-		<string>/Applications/Utilities/X11.app/Contents/MacOS/X11</string>
-	<key>ProgramArguments</key>
-		<array>
-		<string>/Applications/Utilities/X11.app/Contents/MacOS/X11</string>
-		<string>--launchd</string>
-		</array>
-	<key>Sockets</key>
-		<dict>
-		<key>:0</key>
-			<dict>
-			<key>SecureSocketWithKey</key>
-				<string>DISPLAY</string>
-			</dict>
-		</dict>
-	<key>ServiceIPC</key>
-		<true/>
-</dict>
-</plist>
diff --git a/hw/darwin/apple/server-main.c b/hw/darwin/apple/server-main.c
deleted file mode 100644
index 26fcbb0..0000000
--- a/hw/darwin/apple/server-main.c
+++ /dev/null
@@ -1,904 +0,0 @@
-/* bundle-main.c -- X server launcher
- 
- Copyright (c) 2002-2007 Apple Inc. All rights reserved.
- 
- 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 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 ABOVE LISTED COPYRIGHT
- HOLDER(S) 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.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization.
- 
- Parts of this file are derived from xdm, which has this copyright:
- 
- Copyright 1988, 1998  The Open Group
- 
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies and
- that both that copyright notice and this permission notice appear in
- supporting documentation.
- 
- The above copyright notice and this permission notice 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 OPEN GROUP 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.
- 
- Except as contained in this notice, the name of The Open Group shall
- not be used in advertising or otherwise to promote the sale, use or
- other dealings in this Software without prior written authorization
- from The Open Group. */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/utsname.h>
-#include <ifaddrs.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <setjmp.h>
-#include <sys/ioctl.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xauth.h>
-#include <xcb/xcb.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-
-#define X_SERVER "/usr/X11/bin/Xquartz"
-#define XTERM_PATH "/usr/X11/bin/xterm"
-#define WM_PATH "/usr/bin/quartz-wm"
-#define DEFAULT_XINITRC "/usr/X11/lib/X11/xinit/xinitrc"
-#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
-
-/* what xinit does */
-#ifndef SHELL
-# define SHELL "sh"
-#endif
-
-#undef FALSE
-#define FALSE 0
-#undef TRUE
-#define TRUE 1
-
-#define MAX_DISPLAYS 64
-
-static int server_pid = -1, client_pid = -1;
-static int xinit_kills_server = FALSE;
-static jmp_buf exit_continuation;
-static const char *server_name = NULL;
-static Display *server_dpy;
-
-static char *auth_file;
-
-typedef struct addr_list_struct addr_list;
-
-struct addr_list_struct {
-    addr_list *next;
-    Xauth auth;
-};
-
-static addr_list *addresses;
-
-
-/* Utility functions. */
-
-/* Return the current host name. Matches what Xlib does. */
-static char *
-host_name (void)
-{
-#ifdef NEED_UTSNAME
-    static struct utsname name;
-	
-    uname(&name);
-	
-    return name.nodename;
-#else
-    static char buf[100];
-	
-    gethostname(buf, sizeof(buf));
-	
-    return buf;
-#endif
-}
-
-static int
-read_boolean_pref (CFStringRef name, int default_)
-{
-    int value;
-    Boolean ok;
-	
-    value = CFPreferencesGetAppBooleanValue (name,
-											 CFSTR ("com.apple.x11"), &ok);
-    return ok ? value : default_;
-}
-
-static inline int
-binary_equal (const void *a, const void *b, int length)
-{
-    return memcmp (a, b, length) == 0;
-}
-
-static inline void *
-binary_dup (const void *a, int length)
-{
-    void *b = malloc (length);
-    if (b != NULL)
-		memcpy (b, a, length);
-    return b;
-}
-
-static inline void
-binary_free (void *data, int length)
-{
-    if (data != NULL)
-		free (data);
-}
-
-
-/* Functions for managing the authentication entries. */
-
-/* Returns true if something matching AUTH is in our list of auth items */
-static int
-check_auth_item (Xauth *auth)
-{
-    addr_list *a;
-	
-    for (a = addresses; a != NULL; a = a->next)
-    {
-		if (a->auth.family == auth->family
-			&& a->auth.address_length == auth->address_length
-			&& binary_equal (a->auth.address, auth->address, auth->address_length)
-			&& a->auth.number_length == auth->number_length
-			&& binary_equal (a->auth.number, auth->number, auth->number_length)
-			&& a->auth.name_length == auth->name_length
-			&& binary_equal (a->auth.name, auth->name, auth->name_length))
-		{
-			return TRUE;
-		}
-    }
-	
-    return FALSE;
-}
-
-/* Add one item to our list of auth items. */
-static void
-add_auth_item (Xauth *auth)
-{
-    addr_list *a = malloc (sizeof (addr_list));
-	
-    a->auth.family = auth->family;
-    a->auth.address_length = auth->address_length;
-    a->auth.address = binary_dup (auth->address, auth->address_length);
-    a->auth.number_length = auth->number_length;
-    a->auth.number = binary_dup (auth->number, auth->number_length);
-    a->auth.name_length = auth->name_length;
-    a->auth.name = binary_dup (auth->name, auth->name_length);
-    a->auth.data_length = auth->data_length;
-    a->auth.data = binary_dup (auth->data, auth->data_length);
-	
-    a->next = addresses;
-    addresses = a;
-}
-
-/* Free all allocated auth items. */
-static void
-free_auth_items (void)
-{
-    addr_list *a;
-	
-    while ((a = addresses) != NULL)
-    {
-		addresses = a->next;
-		
-		binary_free (a->auth.address, a->auth.address_length);
-		binary_free (a->auth.number, a->auth.number_length);
-		binary_free (a->auth.name, a->auth.name_length);
-		binary_free (a->auth.data, a->auth.data_length);
-		free (a);
-    }
-}
-
-/* Add the unix domain auth item. */
-static void
-define_local (Xauth *auth)
-{
-    char *host = host_name ();
-	
-#ifdef DEBUG
-    fprintf (stderr, "x11: hostname is %s\n", host);
-#endif
-	
-    auth->family = FamilyLocal;
-    auth->address_length = strlen (host);
-    auth->address = host;
-	
-    add_auth_item (auth);
-}
-
-/* Add the tcp auth item. */
-static void
-define_named (Xauth *auth, const char *name)
-{
-    struct ifaddrs *addrs, *ptr;
-	
-    if (getifaddrs (&addrs) != 0)
-		return;
-	
-    for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next)
-    {
-		if (ptr->ifa_addr->sa_family != AF_INET)
-			continue;
-		
-		auth->family = FamilyInternet;
-		auth->address_length = sizeof (struct in_addr);
-		auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr);
-		
-#ifdef DEBUG
-		fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n",
-				 (unsigned char) auth->address[0],
-				 (unsigned char) auth->address[1],
-				 (unsigned char) auth->address[2],
-				 (unsigned char) auth->address[3]);
-#endif
-		
-		add_auth_item (auth);
-    }
-	
-    freeifaddrs (addrs);
-}
-
-/* Parse the display number from NAME and add it to AUTH. */
-static void
-set_auth_number (Xauth *auth, const char *name)
-{
-    char *colon;
-    char *dot, *number;
-	
-    colon = strrchr(name, ':');
-    if (colon != NULL)
-    {
-		colon++;
-		dot = strchr(colon, '.');
-		
-		if (dot != NULL)
-			auth->number_length = dot - colon;
-		else
-			auth->number_length = strlen (colon);
-		
-		number = malloc (auth->number_length + 1);
-		if (number != NULL)
-		{
-			strncpy (number, colon, auth->number_length);
-			number[auth->number_length] = '\0';
-		}
-		else
-		{
-			auth->number_length = 0;
-		}
-		
-		auth->number = number;
-    }
-}
-
-/* Put 128 bits of random data into DATA. If possible, it will be "high
- quality" */
-static int
-generate_mit_magic_cookie (char data[16])
-{
-    int fd, ret, i;
-    long *ldata = (long *) data;
-	
-    fd = open ("/dev/random", O_RDONLY);
-    if (fd > 0) {
-		ret = read (fd, data, 16);
-		close (fd);
-		if (ret == 16) return TRUE;
-    }
-	
-    /* fall back to the usual crappy rng */
-	
-    srand48 (getpid () ^ time (NULL));
-	
-    for (i = 0; i < 4; i++)
-		ldata[i] = lrand48 ();
-	
-    return TRUE;
-}
-
-/* Create the keys we'll be using for the display named NAME. */
-static int
-make_auth_keys (const char *name)
-{
-    Xauth auth;
-    char key[16];
-	
-    if (auth_file == NULL)
-		return FALSE;
-	
-    auth.name = "MIT-MAGIC-COOKIE-1";
-    auth.name_length = strlen (auth.name);
-	
-    if (!generate_mit_magic_cookie (key))
-    {
-		auth_file = NULL;
-		return FALSE;
-    }
-	
-    auth.data = key;
-    auth.data_length = 16;
-	
-    set_auth_number (&auth, name);
-	
-    define_named (&auth, host_name ());
-    define_local (&auth);
-	
-    free (auth.number);
-	
-    return TRUE;
-}
-
-/* If ADD-ENTRIES is true, merge our auth entries into the existing
- Xauthority file. If ADD-ENTRIES is false, remove our entries. */
-static int
-write_auth_file (int add_entries)
-{
-    char *home, newname[1024];
-    int fd, ret;
-    FILE *new_fh, *old_fh;
-    addr_list *addr;
-    Xauth *auth;
-	
-    if (auth_file == NULL)
-		return FALSE;
-	
-    home = getenv ("HOME");
-    if (home == NULL)
-    {
-		auth_file = NULL;
-		return FALSE;
-    }
-	
-    snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home);
-    mktemp (newname);
-	
-    if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS)
-    {
-		/* FIXME: do something here? */
-		
-		auth_file = NULL;
-		return FALSE;
-    }
-	
-    fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
-    if (fd >= 0)
-    {
-		new_fh = fdopen (fd, "w");
-		if (new_fh != NULL)
-		{
-			if (add_entries)
-			{
-				for (addr = addresses; addr != NULL; addr = addr->next)
-				{
-					XauWriteAuth (new_fh, &addr->auth);
-				}
-			}
-			
-			old_fh = fopen (auth_file, "r");
-			if (old_fh != NULL)
-			{
-				while ((auth = XauReadAuth (old_fh)) != NULL)
-				{
-					if (!check_auth_item (auth))
-						XauWriteAuth (new_fh, auth);
-					XauDisposeAuth (auth);
-				}
-				fclose (old_fh);
-			}
-			
-			fclose (new_fh);
-			unlink (auth_file);
-			
-			ret = rename (newname, auth_file);
-			
-			if (ret != 0)
-				auth_file = NULL;
-			
-			XauUnlockAuth (auth_file);
-			return ret == 0;
-		}
-		
-		close (fd);
-    }
-	
-    XauUnlockAuth (auth_file);
-    auth_file = NULL;
-    return FALSE;
-}
-
-
-/* Subprocess management functions. */
-
-static int
-start_server (char **xargv)
-{
-    int child;
-	
-    child = fork ();
-	
-    switch (child)
-    {
-    case -1:				/* error */
-		perror ("fork");
-		return FALSE;
-		
-    case 0:				/* child */
-		execv (X_SERVER, xargv);
-		perror ("Couldn't exec " X_SERVER);
-		_exit (1);
-		
-    default:				/* parent */
-		server_pid = child;
-		return TRUE;
-    }
-}
-
-static int
-wait_for_server (void)
-{
-    int count = 100;
-	
-    while (count-- > 0)
-    {
-		int status;
-		
-		server_dpy = XOpenDisplay (server_name);
-		if (server_dpy != NULL)
-			return TRUE;
-		
-		if (waitpid (server_pid, &status, WNOHANG) == server_pid)
-			return FALSE;
-		
-		sleep (1);
-    }
-	
-    return FALSE;
-}
-
-static int
-start_client (void)
-{
-    int child;
-	
-    child = fork();
-	
-    switch (child) {
-		char *temp, buf[1024];		
-
-	case -1:				/* error */
-		perror("fork");
-		return FALSE;
-
-	case 0:					/* child */
-		/* Setup environment */
-		temp = getenv("DISPLAY");
-//		if (temp == NULL && temp[0] != 0)
-			setenv("DISPLAY", server_name, TRUE);
-
-		temp = getenv("PATH");
-		if (temp == NULL || temp[0] == 0) 
-			setenv ("PATH", DEFAULT_PATH, TRUE);
-		else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
-			snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);		
-			setenv("PATH", buf, TRUE);	
-		}
-		
-		/* First try value of $XINITRC, if set. */
-		temp = getenv("XINITRC");
-		if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0)
-			execlp (SHELL, SHELL, temp, NULL);
-
-		/* Then look for .xinitrc in user's home directory. */
-		temp = getenv("HOME");
-		if (temp != NULL && temp[0] != 0) {
-			chdir(temp);
-			snprintf (buf, sizeof (buf), "%s/.xinitrc", temp);
-			if (access(buf, R_OK) == 0)
-				execlp(SHELL, SHELL, buf, NULL);
-		}
-		
-		/* Then try the default xinitrc in the lib directory. */
-		
-		if (access(DEFAULT_XINITRC, R_OK) == 0)
-			execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL);
-		
-		/* Then fallback to hardcoding an xterm and the window manager. */
-		
-		//		system(XTERM_PATH " &");
-		execl(WM_PATH, WM_PATH, NULL);
-		
-		perror("exec");
-		_exit(1);
-		
-    default:				/* parent */
-		client_pid = child;
-		return TRUE;
-    }
-}
-
-static void
-sigchld_handler (int sig)
-{
-    int pid, status;
-	
-	again:
-    pid = waitpid (WAIT_ANY, &status, WNOHANG);
-	
-    if (pid > 0)
-    {
-		if (pid == server_pid)
-		{
-			server_pid = -1;
-			
-			if (client_pid >= 0)
-				kill (client_pid, SIGTERM);
-		}
-		else if (pid == client_pid)
-		{
-			client_pid = -1;
-			
-			if (server_pid >= 0 && xinit_kills_server)
-				kill (server_pid, SIGTERM);
-		}
-		goto again;
-    }
-	
-    if (server_pid == -1 && client_pid == -1)
-		longjmp (exit_continuation, 1);
-	
-    signal (SIGCHLD, sigchld_handler);
-}
-
-
-/* Server utilities. */
-
-static Boolean
-display_exists_p (int number)
-{
-    char buf[64];
-    xcb_connection_t *conn;
-    char *fullname = NULL;
-    int idisplay, iscreen;
-    char *conn_auth_name, *conn_auth_data;
-    int conn_auth_namelen, conn_auth_datalen;
-    
-    //    extern void *_X11TransConnectDisplay ();
-    //    extern void _XDisconnectDisplay ();
-	
-    /* Since connecting to the display waits for a few seconds if the
-	 display doesn't exist, check for trivial non-existence - if the
-	 socket in /tmp exists or not.. (note: if the socket exists, the
-	 server may still not, so we need to try to connect in that case..) */
-	
-    sprintf (buf, "/tmp/.X11-unix/X%d", number);
-    if (access (buf, F_OK) != 0)
-		return FALSE;
-    
-    sprintf (buf, ":%d", number);
-    conn = xcb_connect(buf, NULL);
-    if (xcb_connection_has_error(conn)) return FALSE;
-	
-    xcb_disconnect(conn);
-    return TRUE;
-}
-
-
-/* Monitoring when the system's ip addresses change. */
-
-static Boolean pending_timer;
-
-static void
-timer_callback (CFRunLoopTimerRef timer, void *info)
-{
-    pending_timer = FALSE;
-	
-    /* Update authentication names. Need to write .Xauthority file first
-	 without the existing entries, then again with the new entries.. */
-	
-    write_auth_file (FALSE);
-	
-    free_auth_items ();
-    make_auth_keys (server_name);
-	
-    write_auth_file (TRUE);
-}
-
-/* This function is called when the system's ip addresses may have changed. */
-static void
-ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info)
-{
-#if DEBUG
-    if (changed_keys != NULL) {
-		fprintf (stderr, "x11: changed sc keys: ");
-		CFShow (changed_keys);
-    }
-#endif
-
-    if (auth_file != NULL && !pending_timer)
-    {
-		CFRunLoopTimerRef timer;
-		
-		timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0,
-									  0.0, 0, 0, timer_callback, NULL);
-		CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer,
-						   kCFRunLoopDefaultMode);
-		CFRelease (timer);
-		
-		pending_timer = TRUE;
-    }
-}
-
-/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */
-static Boolean
-install_ipaddr_source (void)
-{
-    CFRunLoopSourceRef source = NULL;
-	
-    SCDynamicStoreContext context = {0};
-    SCDynamicStoreRef ref;
-	
-    ref = SCDynamicStoreCreate (NULL,
-								CFSTR ("AddIPAddressListChangeCallbackSCF"),
-								ipaddr_callback, &context);
-	
-    if (ref != NULL)
-    {
-		const void *keys[4], *patterns[2];
-		int i;
-		
-		keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
-		keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
-		keys[2] = SCDynamicStoreKeyCreateComputerName (NULL);
-		keys[3] = SCDynamicStoreKeyCreateHostNames (NULL);
-		
-		patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
-		patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
-		
-		if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL
-			&& keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL)
-		{
-			CFArrayRef key_array, pattern_array;
-			
-			key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks);
-			pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks);
-			
-			if (key_array != NULL || pattern_array != NULL)
-			{
-				SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array);
-				source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0);
-			}
-			
-			if (key_array != NULL)
-				CFRelease (key_array);
-			if (pattern_array != NULL)
-				CFRelease (pattern_array);
-		}
-		
-		
-		for (i = 0; i < 4; i++)
-			if (keys[i] != NULL)
-			CFRelease (keys[i]);
-		for (i = 0; i < 2; i++)
-			if (patterns[i] != NULL)
-			CFRelease (patterns[i]);
-		
-		CFRelease (ref); 
-    }
-	
-    if (source != NULL)
-    {
-		CFRunLoopAddSource (CFRunLoopGetCurrent (),
-							source, kCFRunLoopDefaultMode);
-		CFRelease (source);
-    }
-	
-    return source != NULL;
-}
-
-
-/* Entrypoint. */
-
-void
-termination_signal_handler (int unused_sig)
-{
-    signal (SIGTERM, SIG_DFL);
-    signal (SIGHUP, SIG_DFL);
-    signal (SIGINT, SIG_DFL);
-    signal (SIGQUIT, SIG_DFL);
-
-    longjmp (exit_continuation, 1);
-}
-
-int
-server_main (int argc, char **argv)
-{
-    char **xargv;
-    int i, j;
-    int fd;
-	
-    xargv = alloca (sizeof (char *) * (argc + 32));
-	
-    if (!read_boolean_pref (CFSTR ("no_auth"), FALSE))
-		auth_file = XauFileName ();
-	
-    /* The standard X11 behaviour is for the server to quit when the first
-	 client exits. But it can be useful for debugging (and to mimic our
-	 behaviour in the beta releases) to not do that. */
-	
-    xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE);
-	
-    for (i = 1; i < argc; i++)
-    {
-		if (argv[i][0] == ':')
-			server_name = argv[i];
-    }
-	
-    if (server_name == NULL)
-    {
-		static char name[8];
-		
-		/* No display number specified, so search for the first unused.
-		 
-		 There's a big old race condition here if two servers start at
-		 the same time, but that's fairly unlikely. We could create
-		 lockfiles or something, but that's seems more likely to cause
-		 problems than the race condition itself.. */
-		
-		for (i = 0; i < MAX_DISPLAYS; i++)
-		{
-			if (!display_exists_p (i))
-				break;
-		}
-		
-		if (i == MAX_DISPLAYS)
-		{
-			fprintf (stderr, "%s: couldn't allocate a display number", argv[0]);
-			exit (1);
-		}
-		
-		sprintf (name, ":%d", i);
-		server_name = name;
-    }
-	
-    if (auth_file != NULL)
-    {
-		/* Create new Xauth keys and add them to the .Xauthority file */
-		
-		make_auth_keys (server_name);
-		write_auth_file (TRUE);
-    }
-	
-    /* Construct our new argv */
-	
-    i = j = 0;
-	
-    xargv[i++] = argv[j++];
-	
-    if (auth_file != NULL)
-    {
-		xargv[i++] = "-auth";
-		xargv[i++] = auth_file;
-    }
-	
-    /* By default, don't listen on tcp sockets if Xauth is disabled. */
-	
-    if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL))
-    {
-		xargv[i++] = "-nolisten";
-		xargv[i++] = "tcp";
-    }
-	
-    while (j < argc)
-    {
-		if (argv[j++][0] != ':')
-			xargv[i++] = argv[j-1];
-    }
-	
-    xargv[i++] = (char *) server_name;
-    xargv[i++] = NULL;
-	
-    /* Detach from any controlling terminal and connect stdin to /dev/null */
-	
-#ifdef TIOCNOTTY
-    fd = open ("/dev/tty", O_RDONLY);
-    if (fd != -1)
-    {
-		ioctl (fd, TIOCNOTTY, 0);
-		close (fd);
-    }
-#endif
-	
-    fd = open ("/dev/null", O_RDWR, 0);
-    if (fd >= 0)
-    {
-		dup2 (fd, 0);
-		if (fd > 0)
-			close (fd);
-    }
-	
-    if (!start_server (xargv))
-		return 1;
-	
-    if (!wait_for_server ())
-    {
-		kill (server_pid, SIGTERM);
-		return 1;
-    }
-	
-    if (!start_client ())
-    {
-		kill (server_pid, SIGTERM);
-		return 1;
-    }
-	
-    signal (SIGCHLD, sigchld_handler);
-	
-    signal (SIGTERM, termination_signal_handler);
-    signal (SIGHUP, termination_signal_handler);
-    signal (SIGINT, termination_signal_handler);
-    signal (SIGQUIT, termination_signal_handler);
-
-    if (setjmp (exit_continuation) == 0)
-    {
-		if (install_ipaddr_source ())
-			CFRunLoopRun ();
-		else
-			while (1) pause ();
-    }
-	
-    signal (SIGCHLD, SIG_IGN);
-
-    if (client_pid >= 0) kill (client_pid, SIGTERM);
-    if (server_pid >= 0) kill (server_pid, SIGTERM);
-	
-    if (auth_file != NULL)
-    {
-		/* Remove our Xauth keys */
-		
-		write_auth_file (FALSE);
-    }
-	
-    free_auth_items ();
-	
-    return 0;
-}
diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am
index f5199df..38f48d0 100644
--- a/hw/darwin/quartz/Makefile.am
+++ b/hw/darwin/quartz/Makefile.am
@@ -1,14 +1,21 @@
-noinst_LIBRARIES = libXQuartz.a
+noinst_LTLIBRARIES = libXQuartz.la
 
 AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+
+# TODO: This should not pull in rootless... rootless should all be in xpr
 AM_CPPFLAGS = \
 	-I$(srcdir) -I$(srcdir)/.. \
 	-I$(top_srcdir)/miext/rootless
 
-SUBDIRS = xpr
+if X11APP
+X11APP_SUBDIRS = apple
+endif
+
+SUBDIRS = . xpr $(X11APP_SUBDIRS)
+DIST_SUBDIRS = xpr apple
 
-libXQuartz_a_SOURCES = \
+libXQuartz_la_SOURCES = \
 	X11Application.m \
 	X11Controller.m \
 	applewm.c \
diff --git a/hw/darwin/quartz/X11Application.m b/hw/darwin/quartz/X11Application.m
index aef0699..3e37dd4 100644
--- a/hw/darwin/quartz/X11Application.m
+++ b/hw/darwin/quartz/X11Application.m
@@ -59,8 +59,7 @@ int X11EnableKeyEquivalents = TRUE;
 int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
 
 extern int darwinFakeButtons, input_check_flag;
-// extern Bool enable_stereo; 
-Bool enable_stereo;  //<-- this needs to go back to being an extern once glxCGL is fixed
+extern Bool enable_stereo; 
 
 extern xEvent *darwinEvents;
 
diff --git a/hw/darwin/quartz/apple/English.lproj/InfoPlist.strings b/hw/darwin/quartz/apple/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..88e1f04
Binary files /dev/null and b/hw/darwin/quartz/apple/English.lproj/InfoPlist.strings differ
diff --git a/hw/darwin/quartz/apple/English.lproj/Localizable.strings b/hw/darwin/quartz/apple/English.lproj/Localizable.strings
new file mode 100644
index 0000000..c83b085
Binary files /dev/null and b/hw/darwin/quartz/apple/English.lproj/Localizable.strings differ
diff --git a/hw/darwin/quartz/apple/English.lproj/main.nib/classes.nib b/hw/darwin/quartz/apple/English.lproj/main.nib/classes.nib
new file mode 100644
index 0000000..a82159b
--- /dev/null
+++ b/hw/darwin/quartz/apple/English.lproj/main.nib/classes.nib
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBClasses</key>
+	<array>
+		<dict>
+			<key>CLASS</key>
+			<string>IBLibraryObjectTemplate</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>OUTLETS</key>
+			<dict>
+				<key>draggedView</key>
+				<string>NSView</string>
+				<key>representedObject</key>
+				<string>NSObject</string>
+			</dict>
+			<key>SUPERCLASS</key>
+			<string>NSView</string>
+		</dict>
+		<dict>
+			<key>CLASS</key>
+			<string>IBInspector</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>OUTLETS</key>
+			<dict>
+				<key>inspectorView</key>
+				<string>NSView</string>
+			</dict>
+			<key>SUPERCLASS</key>
+			<string>NSObject</string>
+		</dict>
+		<dict>
+			<key>CLASS</key>
+			<string>NSDateFormatter</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>SUPERCLASS</key>
+			<string>NSFormatter</string>
+		</dict>
+		<dict>
+			<key>ACTIONS</key>
+			<dict>
+				<key>apps_table_cancel</key>
+				<string>id</string>
+				<key>apps_table_delete</key>
+				<string>id</string>
+				<key>apps_table_done</key>
+				<string>id</string>
+				<key>apps_table_duplicate</key>
+				<string>id</string>
+				<key>apps_table_new</key>
+				<string>id</string>
+				<key>apps_table_show</key>
+				<string>id</string>
+				<key>bring_to_front</key>
+				<string>id</string>
+				<key>close_window</key>
+				<string>id</string>
+				<key>enable_fullscreen_changed</key>
+				<string>id</string>
+				<key>minimize_window</key>
+				<string>id</string>
+				<key>next_window</key>
+				<string>id</string>
+				<key>prefs_changed</key>
+				<string>id</string>
+				<key>prefs_show</key>
+				<string>id</string>
+				<key>previous_window</key>
+				<string>id</string>
+				<key>toggle_fullscreen</key>
+				<string>id</string>
+				<key>x11_help</key>
+				<string>id</string>
+				<key>zoom_window</key>
+				<string>id</string>
+			</dict>
+			<key>CLASS</key>
+			<string>X11Controller</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>OUTLETS</key>
+			<dict>
+				<key>apps_separator</key>
+				<string>id</string>
+				<key>apps_table</key>
+				<string>id</string>
+				<key>depth</key>
+				<string>id</string>
+				<key>dock_apps_menu</key>
+				<string>id</string>
+				<key>dock_menu</key>
+				<string>id</string>
+				<key>dock_window_separator</key>
+				<string>id</string>
+				<key>enable_auth</key>
+				<string>id</string>
+				<key>enable_fullscreen</key>
+				<string>id</string>
+				<key>enable_keyequivs</key>
+				<string>id</string>
+				<key>enable_tcp</key>
+				<string>id</string>
+				<key>fake_buttons</key>
+				<string>id</string>
+				<key>prefs_panel</key>
+				<string>id</string>
+				<key>sync_keymap</key>
+				<string>id</string>
+				<key>toggle_fullscreen_item</key>
+				<string>id</string>
+				<key>use_sysbeep</key>
+				<string>id</string>
+				<key>window_separator</key>
+				<string>id</string>
+				<key>x11_about_item</key>
+				<string>id</string>
+			</dict>
+			<key>SUPERCLASS</key>
+			<string>NSObject</string>
+		</dict>
+		<dict>
+			<key>CLASS</key>
+			<string>NSNumberFormatter</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>SUPERCLASS</key>
+			<string>NSFormatter</string>
+		</dict>
+		<dict>
+			<key>CLASS</key>
+			<string>NSFormatter</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>SUPERCLASS</key>
+			<string>NSObject</string>
+		</dict>
+		<dict>
+			<key>ACTIONS</key>
+			<dict>
+				<key>alignCenter:</key>
+				<string>id</string>
+				<key>alignJustified:</key>
+				<string>id</string>
+				<key>alignLeft:</key>
+				<string>id</string>
+				<key>alignRight:</key>
+				<string>id</string>
+				<key>arrangeInFront:</key>
+				<string>id</string>
+				<key>centerSelectionInVisibleArea:</key>
+				<string>id</string>
+				<key>changeFont:</key>
+				<string>id</string>
+				<key>checkSpelling:</key>
+				<string>id</string>
+				<key>clear:</key>
+				<string>id</string>
+				<key>clearRecentDocuments:</key>
+				<string>id</string>
+				<key>complete:</key>
+				<string>id</string>
+				<key>copy:</key>
+				<string>id</string>
+				<key>copyFont:</key>
+				<string>id</string>
+				<key>copyRuler:</key>
+				<string>id</string>
+				<key>cut:</key>
+				<string>id</string>
+				<key>delete:</key>
+				<string>id</string>
+				<key>deminiaturize:</key>
+				<string>id</string>
+				<key>fax:</key>
+				<string>id</string>
+				<key>hide:</key>
+				<string>id</string>
+				<key>hideOtherApplications:</key>
+				<string>id</string>
+				<key>loosenKerning:</key>
+				<string>id</string>
+				<key>lowerBaseline:</key>
+				<string>id</string>
+				<key>makeKeyAndOrderFront:</key>
+				<string>id</string>
+				<key>miniaturize:</key>
+				<string>id</string>
+				<key>newDocument:</key>
+				<string>id</string>
+				<key>openDocument:</key>
+				<string>id</string>
+				<key>orderBack:</key>
+				<string>id</string>
+				<key>orderFront:</key>
+				<string>id</string>
+				<key>orderFrontColorPanel:</key>
+				<string>id</string>
+				<key>orderFrontHelpPanel:</key>
+				<string>id</string>
+				<key>orderOut:</key>
+				<string>id</string>
+				<key>outline:</key>
+				<string>id</string>
+				<key>paste:</key>
+				<string>id</string>
+				<key>pasteAsPlainText:</key>
+				<string>id</string>
+				<key>pasteAsRichText:</key>
+				<string>id</string>
+				<key>pasteFont:</key>
+				<string>id</string>
+				<key>pasteRuler:</key>
+				<string>id</string>
+				<key>pause:</key>
+				<string>id</string>
+				<key>performClose:</key>
+				<string>id</string>
+				<key>performFindPanelAction:</key>
+				<string>id</string>
+				<key>performMiniaturize:</key>
+				<string>id</string>
+				<key>performZoom:</key>
+				<string>id</string>
+				<key>play:</key>
+				<string>id</string>
+				<key>print:</key>
+				<string>id</string>
+				<key>printDocument:</key>
+				<string>id</string>
+				<key>raiseBaseline:</key>
+				<string>id</string>
+				<key>record:</key>
+				<string>id</string>
+				<key>redo:</key>
+				<string>id</string>
+				<key>resume:</key>
+				<string>id</string>
+				<key>revertDocumentToSaved:</key>
+				<string>id</string>
+				<key>run:</key>
+				<string>id</string>
+				<key>runPageLayout:</key>
+				<string>id</string>
+				<key>runToolbarCustomizationPalette:</key>
+				<string>id</string>
+				<key>saveAllDocuments:</key>
+				<string>id</string>
+				<key>saveDocument:</key>
+				<string>id</string>
+				<key>saveDocumentAs:</key>
+				<string>id</string>
+				<key>saveDocumentTo:</key>
+				<string>id</string>
+				<key>selectAll:</key>
+				<string>id</string>
+				<key>selectText:</key>
+				<string>id</string>
+				<key>showGuessPanel:</key>
+				<string>id</string>
+				<key>showHelp:</key>
+				<string>id</string>
+				<key>start:</key>
+				<string>id</string>
+				<key>startSpeaking:</key>
+				<string>id</string>
+				<key>stop:</key>
+				<string>id</string>
+				<key>stopSpeaking:</key>
+				<string>id</string>
+				<key>subscript:</key>
+				<string>id</string>
+				<key>superscript:</key>
+				<string>id</string>
+				<key>terminate:</key>
+				<string>id</string>
+				<key>tightenKerning:</key>
+				<string>id</string>
+				<key>toggleContinuousSpellChecking:</key>
+				<string>id</string>
+				<key>toggleRuler:</key>
+				<string>id</string>
+				<key>toggleToolbarShown:</key>
+				<string>id</string>
+				<key>turnOffKerning:</key>
+				<string>id</string>
+				<key>turnOffLigatures:</key>
+				<string>id</string>
+				<key>underline:</key>
+				<string>id</string>
+				<key>undo:</key>
+				<string>id</string>
+				<key>unhideAllApplications:</key>
+				<string>id</string>
+				<key>unscript:</key>
+				<string>id</string>
+				<key>useAllLigatures:</key>
+				<string>id</string>
+				<key>useStandardKerning:</key>
+				<string>id</string>
+				<key>useStandardLigatures:</key>
+				<string>id</string>
+			</dict>
+			<key>CLASS</key>
+			<string>FirstResponder</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>SUPERCLASS</key>
+			<string>NSObject</string>
+		</dict>
+	</array>
+	<key>IBVersion</key>
+	<integer>1</integer>
+</dict>
+</plist>
diff --git a/hw/darwin/quartz/apple/English.lproj/main.nib/info.nib b/hw/darwin/quartz/apple/English.lproj/main.nib/info.nib
new file mode 100644
index 0000000..88bc626
--- /dev/null
+++ b/hw/darwin/quartz/apple/English.lproj/main.nib/info.nib
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBFramework Version</key>
+	<string>588</string>
+	<key>IBOpenObjects</key>
+	<array>
+		<integer>244</integer>
+		<integer>29</integer>
+		<integer>423</integer>
+	</array>
+	<key>IBSystem Version</key>
+	<string>9A356</string>
+	<key>targetFramework</key>
+	<string>IBCocoaFramework</string>
+</dict>
+</plist>
diff --git a/hw/darwin/quartz/apple/English.lproj/main.nib/keyedobjects.nib b/hw/darwin/quartz/apple/English.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 0000000..8b31450
Binary files /dev/null and b/hw/darwin/quartz/apple/English.lproj/main.nib/keyedobjects.nib differ
diff --git a/hw/darwin/quartz/apple/Info.plist b/hw/darwin/quartz/apple/Info.plist
new file mode 100644
index 0000000..66f1f6b
--- /dev/null
+++ b/hw/darwin/quartz/apple/Info.plist
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>X11</string>
+	<key>CFBundleGetInfoString</key>
+	<string>X11</string>
+	<key>CFBundleIconFile</key>
+	<string>X11.icns</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.x.X11</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>X11</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>2.0</string>
+	<key>CFBundleSignature</key>
+	<string>x11a</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+	<key>NSHumanReadableCopyright</key>
+	<string>Copyright © 2003-2007, Apple Inc.
+Copyright © 2003, XFree86 Project, Inc.</string>
+	<key>NSMainNibFile</key>
+	<string>main</string>
+	<key>NSPrincipalClass</key>
+	<string>X11Application</string>
+</dict>
+</plist>
diff --git a/hw/darwin/quartz/apple/Makefile.am b/hw/darwin/quartz/apple/Makefile.am
new file mode 100644
index 0000000..a6e2dfb
--- /dev/null
+++ b/hw/darwin/quartz/apple/Makefile.am
@@ -0,0 +1,28 @@
+bin_SCRIPTS = x11app
+
+.PHONY: x11app
+
+x11app:
+	xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
+
+install-data-hook:
+	xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+	$(MKDIR_P) "$(DESTDIR)/System/Library/LaunchAgents/"
+	$(INSTALL) org.x.X11.plist "$(DESTDIR)/System/Library/LaunchAgents/"
+
+clean-local:
+	rm -rf build
+
+EXTRA_DIST = \
+	org.x.X11.plist \
+	Info.plist \
+	X11.icns \
+	bundle-main.c \
+	launcher-main.c \
+	server-main.c \
+	English.lproj/InfoPlist.strings \
+	English.lproj/Localizable.strings \
+	English.lproj/main.nib/classes.nib \
+	English.lproj/main.nib/info.nib \
+	English.lproj/main.nib/keyedobjects.nib \
+	X11.xcodeproj/project.pbxproj
diff --git a/hw/darwin/quartz/apple/X11.icns b/hw/darwin/quartz/apple/X11.icns
new file mode 100644
index 0000000..d770e61
Binary files /dev/null and b/hw/darwin/quartz/apple/X11.icns differ
diff --git a/hw/darwin/quartz/apple/X11.xcodeproj/project.pbxproj b/hw/darwin/quartz/apple/X11.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..225f371
--- /dev/null
+++ b/hw/darwin/quartz/apple/X11.xcodeproj/project.pbxproj
@@ -0,0 +1,344 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDE0D04BF110020CA24 /* launcher-main.c */; };
+		3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDF0D04BF110020CA24 /* server-main.c */; };
+		527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
+		527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
+		527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; };
+		527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; };
+		527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; };
+		527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; };
+		527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; };
+		52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
+		3F5E1BDE0D04BF110020CA24 /* launcher-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "launcher-main.c"; sourceTree = "<group>"; };
+		3F5E1BDF0D04BF110020CA24 /* server-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "server-main.c"; sourceTree = "<group>"; };
+		50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; };
+		50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; };
+		50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+		527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+		527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
+		570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		527F241E0B5D938C007840A7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */,
+				527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		195DF8CFFE9D517E11CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				527F24270B5D938C007840A7 /* X11.app */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		20286C29FDCF999611CA2CEA /* X11 */ = {
+			isa = PBXGroup;
+			children = (
+				20286C2AFDCF999611CA2CEA /* Sources */,
+				20286C2CFDCF999611CA2CEA /* Resources */,
+				20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
+				195DF8CFFE9D517E11CA2CBB /* Products */,
+				527F24260B5D938C007840A7 /* Info.plist */,
+			);
+			name = X11;
+			sourceTree = "<group>";
+		};
+		20286C2AFDCF999611CA2CEA /* Sources */ = {
+			isa = PBXGroup;
+			children = (
+				3F5E1BDE0D04BF110020CA24 /* launcher-main.c */,
+				3F5E1BDF0D04BF110020CA24 /* server-main.c */,
+				50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
+			);
+			name = Sources;
+			sourceTree = "<group>";
+		};
+		20286C2CFDCF999611CA2CEA /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */,
+				50459C5F038587C60ECA21EC /* X11.icns */,
+				0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */,
+				02345980000FD03B11CA0E72 /* main.nib */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */,
+				570C5748047186C400ACF82F /* SystemConfiguration.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		527F24170B5D938C007840A7 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		527F24160B5D938C007840A7 /* X11 */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */;
+			buildPhases = (
+				527F24170B5D938C007840A7 /* Headers */,
+				527F24180B5D938C007840A7 /* Resources */,
+				527F241C0B5D938C007840A7 /* Sources */,
+				527F241E0B5D938C007840A7 /* Frameworks */,
+				527F24210B5D938C007840A7 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = X11;
+			productName = X11;
+			productReference = 527F24270B5D938C007840A7 /* X11.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		20286C28FDCF999611CA2CEA /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */;
+			compatibilityVersion = "Xcode 2.4";
+			hasScannedForEncodings = 1;
+			mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				527F24160B5D938C007840A7 /* X11 */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		527F24180B5D938C007840A7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				527F24370B5D9D89007840A7 /* Info.plist in Resources */,
+				527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */,
+				527F241A0B5D938C007840A7 /* main.nib in Resources */,
+				527F241B0B5D938C007840A7 /* X11.icns in Resources */,
+				52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		527F24210B5D938C007840A7 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		527F241C0B5D938C007840A7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
+				3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */,
+				3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		02345980000FD03B11CA0E72 /* main.nib */ = {
+			isa = PBXVariantGroup;
+			children = (
+				1870340FFE93FCAF11CA0CD7 /* English */,
+			);
+			name = main.nib;
+			sourceTree = "<group>";
+		};
+		0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				0867D6ABFE840B52C02AAC07 /* English */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+		52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				52D9C0EC0BCDDF6B00CD2AFC /* English */,
+			);
+			name = Localizable.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		527F24090B5D8FFC007840A7 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				INSTALL_MODE_FLAG = "a+rX";
+			};
+			name = Development;
+		};
+		527F240A0B5D8FFC007840A7 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				INSTALL_MODE_FLAG = "a+rX";
+			};
+			name = Deployment;
+		};
+		527F240B0B5D8FFC007840A7 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				INSTALL_MODE_FLAG = "a+rX";
+			};
+			name = Default;
+		};
+		527F24230B5D938C007840A7 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = /usr/X11/include;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = /usr/X11;
+				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-lXau",
+					"-lxcb",
+					"-lX11",
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = X11;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				WRAPPER_EXTENSION = app;
+			};
+			name = Development;
+		};
+		527F24240B5D938C007840A7 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = /usr/X11/include;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = /usr/X11;
+				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-lXau",
+					"-lxcb",
+					"-lX11",
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = X11;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				WRAPPER_EXTENSION = app;
+			};
+			name = Deployment;
+		};
+		527F24250B5D938C007840A7 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = /usr/X11/include;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = /usr/X11;
+				LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-lXau",
+					"-lxcb",
+					"-lX11",
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = X11;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				WRAPPER_EXTENSION = app;
+			};
+			name = Default;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				527F24090B5D8FFC007840A7 /* Development */,
+				527F240A0B5D8FFC007840A7 /* Deployment */,
+				527F240B0B5D8FFC007840A7 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				527F24230B5D938C007840A7 /* Development */,
+				527F24240B5D938C007840A7 /* Deployment */,
+				527F24250B5D938C007840A7 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 20286C28FDCF999611CA2CEA /* Project object */;
+}
diff --git a/hw/darwin/quartz/apple/bundle-main.c b/hw/darwin/quartz/apple/bundle-main.c
new file mode 100644
index 0000000..c436d51
--- /dev/null
+++ b/hw/darwin/quartz/apple/bundle-main.c
@@ -0,0 +1,82 @@
+/* main.c -- X application launcher
+ 
+ Copyright (c) 2007 Jeremy Huddleston
+ Copyright (c) 2007 Apple Inc
+ 
+ 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 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 ABOVE LISTED COPYRIGHT
+ HOLDER(S) 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.
+ 
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <X11/Xlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+int launcher_main(int argc, char **argv);
+int server_main(int argc, char **argv);
+
+int main(int argc, char **argv) {
+    Display *display;
+  
+    fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+    int i;
+    for(i=0; i < argc; i++) {
+        fprintf(stderr, "\targv[%d] = %s\n", i, argv[i]);
+    }
+    
+    /* First check if launchd started us */
+    if(argc == 2 && !strncmp(argv[1], "--launchd", 9)) {
+        argc--;
+        argv[1] = argv[0];
+        argv++;
+        fprintf(stderr, "X11.app: main(): launchd called us, running server_main()");
+        return server_main(argc, argv);
+    }
+
+    /* If we have a process serial number and it's our only arg, act as if
+     * the user double clicked the app bundle: launch app_to_run if possible
+     */
+    if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
+        /* Now, try to open a display, if so, run the launcher */
+        display = XOpenDisplay(NULL);
+        if(display) {
+            fprintf(stderr, "X11.app: main(): closing the display");
+            /* Could open the display, start the launcher */
+            XCloseDisplay(display);
+
+            /* Give 2 seconds for the server to start... 
+             * TODO: *Really* fix this race condition
+             */
+            usleep(2000);
+            fprintf(stderr, "X11.app: main(): running launcher_main()");
+            return launcher_main(argc, argv);
+        }
+    }
+
+    /* Couldn't open the display or we were called with arguments,
+     * just want to start a server.
+     */
+    fprintf(stderr, "X11.app: main(): running server_main()");
+    return server_main(argc, argv);
+}
diff --git a/hw/darwin/quartz/apple/launcher-main.c b/hw/darwin/quartz/apple/launcher-main.c
new file mode 100644
index 0000000..60a1624
--- /dev/null
+++ b/hw/darwin/quartz/apple/launcher-main.c
@@ -0,0 +1,81 @@
+/* main.c -- X application launcher
+ 
+ Copyright (c) 2007 Apple Inc.
+ 
+ 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 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 ABOVE LISTED COPYRIGHT
+ HOLDER(S) 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.
+ 
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#define DEFAULT_APP "/usr/X11/bin/xterm"
+
+int launcher_main (int argc, char **argv) {
+  char *command = DEFAULT_APP;
+  const char *newargv[7];
+  int child;
+  
+
+	CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(CFSTR("app_to_run"),
+									kCFPreferencesCurrentApplication);
+	
+	if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
+		CFPreferencesSetAppValue(CFSTR("app_to_run"), CFSTR(DEFAULT_APP), 
+								 kCFPreferencesCurrentApplication);
+		CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+	} else {
+		int len = CFStringGetLength((CFStringRef)PlistRef)+1;
+		command = (char *) malloc(len);
+		CFStringGetCString((CFStringRef)PlistRef, command, len,  kCFStringEncodingASCII);
+		fprintf(stderr, "command=%s\n", command);
+	}
+	
+	if (PlistRef) CFRelease(PlistRef);
+	
+	newargv[0] = "/usr/bin/login";
+	newargv[1] = "-fp";
+	newargv[2] = getlogin();
+	newargv[3] = "/bin/sh";
+	newargv[4] = "-c";
+	newargv[5] = command;
+	newargv[6] = NULL;
+
+    child = fork();
+	
+    switch (child) {
+    case -1:				/* error */
+      perror ("fork");
+      return EXIT_FAILURE;		
+    case 0:				    /* child */
+      execvp (newargv[0], (char **const) newargv);
+      perror ("Couldn't exec");
+      _exit (1);
+   }
+	
+    return 0;
+}
diff --git a/hw/darwin/quartz/apple/org.x.X11.plist b/hw/darwin/quartz/apple/org.x.X11.plist
new file mode 100644
index 0000000..6c6be91
--- /dev/null
+++ b/hw/darwin/quartz/apple/org.x.X11.plist
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>Label</key>
+		<string>org.x.X11</string>
+	<key>Program</key>
+		<string>/Applications/Utilities/X11.app/Contents/MacOS/X11</string>
+	<key>ProgramArguments</key>
+		<array>
+		<string>/Applications/Utilities/X11.app/Contents/MacOS/X11</string>
+		<string>--launchd</string>
+		</array>
+	<key>Sockets</key>
+		<dict>
+		<key>:0</key>
+			<dict>
+			<key>SecureSocketWithKey</key>
+				<string>DISPLAY</string>
+			</dict>
+		</dict>
+	<key>ServiceIPC</key>
+		<true/>
+</dict>
+</plist>
diff --git a/hw/darwin/quartz/apple/server-main.c b/hw/darwin/quartz/apple/server-main.c
new file mode 100644
index 0000000..26fcbb0
--- /dev/null
+++ b/hw/darwin/quartz/apple/server-main.c
@@ -0,0 +1,904 @@
+/* bundle-main.c -- X server launcher
+ 
+ Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+ 
+ 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 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 ABOVE LISTED COPYRIGHT
+ HOLDER(S) 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.
+ 
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization.
+ 
+ Parts of this file are derived from xdm, which has this copyright:
+ 
+ Copyright 1988, 1998  The Open Group
+ 
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and
+ that both that copyright notice and this permission notice appear in
+ supporting documentation.
+ 
+ The above copyright notice and this permission notice 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 OPEN GROUP 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.
+ 
+ Except as contained in this notice, the name of The Open Group shall
+ not be used in advertising or otherwise to promote the sale, use or
+ other dealings in this Software without prior written authorization
+ from The Open Group. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <time.h>
+#include <sys/wait.h>
+#include <setjmp.h>
+#include <sys/ioctl.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xauth.h>
+#include <xcb/xcb.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+#define X_SERVER "/usr/X11/bin/Xquartz"
+#define XTERM_PATH "/usr/X11/bin/xterm"
+#define WM_PATH "/usr/bin/quartz-wm"
+#define DEFAULT_XINITRC "/usr/X11/lib/X11/xinit/xinitrc"
+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
+
+/* what xinit does */
+#ifndef SHELL
+# define SHELL "sh"
+#endif
+
+#undef FALSE
+#define FALSE 0
+#undef TRUE
+#define TRUE 1
+
+#define MAX_DISPLAYS 64
+
+static int server_pid = -1, client_pid = -1;
+static int xinit_kills_server = FALSE;
+static jmp_buf exit_continuation;
+static const char *server_name = NULL;
+static Display *server_dpy;
+
+static char *auth_file;
+
+typedef struct addr_list_struct addr_list;
+
+struct addr_list_struct {
+    addr_list *next;
+    Xauth auth;
+};
+
+static addr_list *addresses;
+
+
+/* Utility functions. */
+
+/* Return the current host name. Matches what Xlib does. */
+static char *
+host_name (void)
+{
+#ifdef NEED_UTSNAME
+    static struct utsname name;
+	
+    uname(&name);
+	
+    return name.nodename;
+#else
+    static char buf[100];
+	
+    gethostname(buf, sizeof(buf));
+	
+    return buf;
+#endif
+}
+
+static int
+read_boolean_pref (CFStringRef name, int default_)
+{
+    int value;
+    Boolean ok;
+	
+    value = CFPreferencesGetAppBooleanValue (name,
+											 CFSTR ("com.apple.x11"), &ok);
+    return ok ? value : default_;
+}
+
+static inline int
+binary_equal (const void *a, const void *b, int length)
+{
+    return memcmp (a, b, length) == 0;
+}
+
+static inline void *
+binary_dup (const void *a, int length)
+{
+    void *b = malloc (length);
+    if (b != NULL)
+		memcpy (b, a, length);
+    return b;
+}
+
+static inline void
+binary_free (void *data, int length)
+{
+    if (data != NULL)
+		free (data);
+}
+
+
+/* Functions for managing the authentication entries. */
+
+/* Returns true if something matching AUTH is in our list of auth items */
+static int
+check_auth_item (Xauth *auth)
+{
+    addr_list *a;
+	
+    for (a = addresses; a != NULL; a = a->next)
+    {
+		if (a->auth.family == auth->family
+			&& a->auth.address_length == auth->address_length
+			&& binary_equal (a->auth.address, auth->address, auth->address_length)
+			&& a->auth.number_length == auth->number_length
+			&& binary_equal (a->auth.number, auth->number, auth->number_length)
+			&& a->auth.name_length == auth->name_length
+			&& binary_equal (a->auth.name, auth->name, auth->name_length))
+		{
+			return TRUE;
+		}
+    }
+	
+    return FALSE;
+}
+
+/* Add one item to our list of auth items. */
+static void
+add_auth_item (Xauth *auth)
+{
+    addr_list *a = malloc (sizeof (addr_list));
+	
+    a->auth.family = auth->family;
+    a->auth.address_length = auth->address_length;
+    a->auth.address = binary_dup (auth->address, auth->address_length);
+    a->auth.number_length = auth->number_length;
+    a->auth.number = binary_dup (auth->number, auth->number_length);
+    a->auth.name_length = auth->name_length;
+    a->auth.name = binary_dup (auth->name, auth->name_length);
+    a->auth.data_length = auth->data_length;
+    a->auth.data = binary_dup (auth->data, auth->data_length);
+	
+    a->next = addresses;
+    addresses = a;
+}
+
+/* Free all allocated auth items. */
+static void
+free_auth_items (void)
+{
+    addr_list *a;
+	
+    while ((a = addresses) != NULL)
+    {
+		addresses = a->next;
+		
+		binary_free (a->auth.address, a->auth.address_length);
+		binary_free (a->auth.number, a->auth.number_length);
+		binary_free (a->auth.name, a->auth.name_length);
+		binary_free (a->auth.data, a->auth.data_length);
+		free (a);
+    }
+}
+
+/* Add the unix domain auth item. */
+static void
+define_local (Xauth *auth)
+{
+    char *host = host_name ();
+	
+#ifdef DEBUG
+    fprintf (stderr, "x11: hostname is %s\n", host);
+#endif
+	
+    auth->family = FamilyLocal;
+    auth->address_length = strlen (host);
+    auth->address = host;
+	
+    add_auth_item (auth);
+}
+
+/* Add the tcp auth item. */
+static void
+define_named (Xauth *auth, const char *name)
+{
+    struct ifaddrs *addrs, *ptr;
+	
+    if (getifaddrs (&addrs) != 0)
+		return;
+	
+    for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next)
+    {
+		if (ptr->ifa_addr->sa_family != AF_INET)
+			continue;
+		
+		auth->family = FamilyInternet;
+		auth->address_length = sizeof (struct in_addr);
+		auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr);
+		
+#ifdef DEBUG
+		fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n",
+				 (unsigned char) auth->address[0],
+				 (unsigned char) auth->address[1],
+				 (unsigned char) auth->address[2],
+				 (unsigned char) auth->address[3]);
+#endif
+		
+		add_auth_item (auth);
+    }
+	
+    freeifaddrs (addrs);
+}
+
+/* Parse the display number from NAME and add it to AUTH. */
+static void
+set_auth_number (Xauth *auth, const char *name)
+{
+    char *colon;
+    char *dot, *number;
+	
+    colon = strrchr(name, ':');
+    if (colon != NULL)
+    {
+		colon++;
+		dot = strchr(colon, '.');
+		
+		if (dot != NULL)
+			auth->number_length = dot - colon;
+		else
+			auth->number_length = strlen (colon);
+		
+		number = malloc (auth->number_length + 1);
+		if (number != NULL)
+		{
+			strncpy (number, colon, auth->number_length);
+			number[auth->number_length] = '\0';
+		}
+		else
+		{
+			auth->number_length = 0;
+		}
+		
+		auth->number = number;
+    }
+}
+
+/* Put 128 bits of random data into DATA. If possible, it will be "high
+ quality" */
+static int
+generate_mit_magic_cookie (char data[16])
+{
+    int fd, ret, i;
+    long *ldata = (long *) data;
+	
+    fd = open ("/dev/random", O_RDONLY);
+    if (fd > 0) {
+		ret = read (fd, data, 16);
+		close (fd);
+		if (ret == 16) return TRUE;
+    }
+	
+    /* fall back to the usual crappy rng */
+	
+    srand48 (getpid () ^ time (NULL));
+	
+    for (i = 0; i < 4; i++)
+		ldata[i] = lrand48 ();
+	
+    return TRUE;
+}
+
+/* Create the keys we'll be using for the display named NAME. */
+static int
+make_auth_keys (const char *name)
+{
+    Xauth auth;
+    char key[16];
+	
+    if (auth_file == NULL)
+		return FALSE;
+	
+    auth.name = "MIT-MAGIC-COOKIE-1";
+    auth.name_length = strlen (auth.name);
+	
+    if (!generate_mit_magic_cookie (key))
+    {
+		auth_file = NULL;
+		return FALSE;
+    }
+	
+    auth.data = key;
+    auth.data_length = 16;
+	
+    set_auth_number (&auth, name);
+	
+    define_named (&auth, host_name ());
+    define_local (&auth);
+	
+    free (auth.number);
+	
+    return TRUE;
+}
+
+/* If ADD-ENTRIES is true, merge our auth entries into the existing
+ Xauthority file. If ADD-ENTRIES is false, remove our entries. */
+static int
+write_auth_file (int add_entries)
+{
+    char *home, newname[1024];
+    int fd, ret;
+    FILE *new_fh, *old_fh;
+    addr_list *addr;
+    Xauth *auth;
+	
+    if (auth_file == NULL)
+		return FALSE;
+	
+    home = getenv ("HOME");
+    if (home == NULL)
+    {
+		auth_file = NULL;
+		return FALSE;
+    }
+	
+    snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home);
+    mktemp (newname);
+	
+    if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS)
+    {
+		/* FIXME: do something here? */
+		
+		auth_file = NULL;
+		return FALSE;
+    }
+	
+    fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+    if (fd >= 0)
+    {
+		new_fh = fdopen (fd, "w");
+		if (new_fh != NULL)
+		{
+			if (add_entries)
+			{
+				for (addr = addresses; addr != NULL; addr = addr->next)
+				{
+					XauWriteAuth (new_fh, &addr->auth);
+				}
+			}
+			
+			old_fh = fopen (auth_file, "r");
+			if (old_fh != NULL)
+			{
+				while ((auth = XauReadAuth (old_fh)) != NULL)
+				{
+					if (!check_auth_item (auth))
+						XauWriteAuth (new_fh, auth);
+					XauDisposeAuth (auth);
+				}
+				fclose (old_fh);
+			}
+			
+			fclose (new_fh);
+			unlink (auth_file);
+			
+			ret = rename (newname, auth_file);
+			
+			if (ret != 0)
+				auth_file = NULL;
+			
+			XauUnlockAuth (auth_file);
+			return ret == 0;
+		}
+		
+		close (fd);
+    }
+	
+    XauUnlockAuth (auth_file);
+    auth_file = NULL;
+    return FALSE;
+}
+
+
+/* Subprocess management functions. */
+
+static int
+start_server (char **xargv)
+{
+    int child;
+	
+    child = fork ();
+	
+    switch (child)
+    {
+    case -1:				/* error */
+		perror ("fork");
+		return FALSE;
+		
+    case 0:				/* child */
+		execv (X_SERVER, xargv);
+		perror ("Couldn't exec " X_SERVER);
+		_exit (1);
+		
+    default:				/* parent */
+		server_pid = child;
+		return TRUE;
+    }
+}
+
+static int
+wait_for_server (void)
+{
+    int count = 100;
+	
+    while (count-- > 0)
+    {
+		int status;
+		
+		server_dpy = XOpenDisplay (server_name);
+		if (server_dpy != NULL)
+			return TRUE;
+		
+		if (waitpid (server_pid, &status, WNOHANG) == server_pid)
+			return FALSE;
+		
+		sleep (1);
+    }
+	
+    return FALSE;
+}
+
+static int
+start_client (void)
+{
+    int child;
+	
+    child = fork();
+	
+    switch (child) {
+		char *temp, buf[1024];		
+
+	case -1:				/* error */
+		perror("fork");
+		return FALSE;
+
+	case 0:					/* child */
+		/* Setup environment */
+		temp = getenv("DISPLAY");
+//		if (temp == NULL && temp[0] != 0)
+			setenv("DISPLAY", server_name, TRUE);
+
+		temp = getenv("PATH");
+		if (temp == NULL || temp[0] == 0) 
+			setenv ("PATH", DEFAULT_PATH, TRUE);
+		else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
+			snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);		
+			setenv("PATH", buf, TRUE);	
+		}
+		
+		/* First try value of $XINITRC, if set. */
+		temp = getenv("XINITRC");
+		if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0)
+			execlp (SHELL, SHELL, temp, NULL);
+
+		/* Then look for .xinitrc in user's home directory. */
+		temp = getenv("HOME");
+		if (temp != NULL && temp[0] != 0) {
+			chdir(temp);
+			snprintf (buf, sizeof (buf), "%s/.xinitrc", temp);
+			if (access(buf, R_OK) == 0)
+				execlp(SHELL, SHELL, buf, NULL);
+		}
+		
+		/* Then try the default xinitrc in the lib directory. */
+		
+		if (access(DEFAULT_XINITRC, R_OK) == 0)
+			execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL);
+		
+		/* Then fallback to hardcoding an xterm and the window manager. */
+		
+		//		system(XTERM_PATH " &");
+		execl(WM_PATH, WM_PATH, NULL);
+		
+		perror("exec");
+		_exit(1);
+		
+    default:				/* parent */
+		client_pid = child;
+		return TRUE;
+    }
+}
+
+static void
+sigchld_handler (int sig)
+{
+    int pid, status;
+	
+	again:
+    pid = waitpid (WAIT_ANY, &status, WNOHANG);
+	
+    if (pid > 0)
+    {
+		if (pid == server_pid)
+		{
+			server_pid = -1;
+			
+			if (client_pid >= 0)
+				kill (client_pid, SIGTERM);
+		}
+		else if (pid == client_pid)
+		{
+			client_pid = -1;
+			
+			if (server_pid >= 0 && xinit_kills_server)
+				kill (server_pid, SIGTERM);
+		}
+		goto again;
+    }
+	
+    if (server_pid == -1 && client_pid == -1)
+		longjmp (exit_continuation, 1);
+	
+    signal (SIGCHLD, sigchld_handler);
+}
+
+
+/* Server utilities. */
+
+static Boolean
+display_exists_p (int number)
+{
+    char buf[64];
+    xcb_connection_t *conn;
+    char *fullname = NULL;
+    int idisplay, iscreen;
+    char *conn_auth_name, *conn_auth_data;
+    int conn_auth_namelen, conn_auth_datalen;
+    
+    //    extern void *_X11TransConnectDisplay ();
+    //    extern void _XDisconnectDisplay ();
+	
+    /* Since connecting to the display waits for a few seconds if the
+	 display doesn't exist, check for trivial non-existence - if the
+	 socket in /tmp exists or not.. (note: if the socket exists, the
+	 server may still not, so we need to try to connect in that case..) */
+	
+    sprintf (buf, "/tmp/.X11-unix/X%d", number);
+    if (access (buf, F_OK) != 0)
+		return FALSE;
+    
+    sprintf (buf, ":%d", number);
+    conn = xcb_connect(buf, NULL);
+    if (xcb_connection_has_error(conn)) return FALSE;
+	
+    xcb_disconnect(conn);
+    return TRUE;
+}
+
+
+/* Monitoring when the system's ip addresses change. */
+
+static Boolean pending_timer;
+
+static void
+timer_callback (CFRunLoopTimerRef timer, void *info)
+{
+    pending_timer = FALSE;
+	
+    /* Update authentication names. Need to write .Xauthority file first
+	 without the existing entries, then again with the new entries.. */
+	
+    write_auth_file (FALSE);
+	
+    free_auth_items ();
+    make_auth_keys (server_name);
+	
+    write_auth_file (TRUE);
+}
+
+/* This function is called when the system's ip addresses may have changed. */
+static void
+ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info)
+{
+#if DEBUG
+    if (changed_keys != NULL) {
+		fprintf (stderr, "x11: changed sc keys: ");
+		CFShow (changed_keys);
+    }
+#endif
+
+    if (auth_file != NULL && !pending_timer)
+    {
+		CFRunLoopTimerRef timer;
+		
+		timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0,
+									  0.0, 0, 0, timer_callback, NULL);
+		CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer,
+						   kCFRunLoopDefaultMode);
+		CFRelease (timer);
+		
+		pending_timer = TRUE;
+    }
+}
+
+/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */
+static Boolean
+install_ipaddr_source (void)
+{
+    CFRunLoopSourceRef source = NULL;
+	
+    SCDynamicStoreContext context = {0};
+    SCDynamicStoreRef ref;
+	
+    ref = SCDynamicStoreCreate (NULL,
+								CFSTR ("AddIPAddressListChangeCallbackSCF"),
+								ipaddr_callback, &context);
+	
+    if (ref != NULL)
+    {
+		const void *keys[4], *patterns[2];
+		int i;
+		
+		keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
+		keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
+		keys[2] = SCDynamicStoreKeyCreateComputerName (NULL);
+		keys[3] = SCDynamicStoreKeyCreateHostNames (NULL);
+		
+		patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
+		patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
+		
+		if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL
+			&& keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL)
+		{
+			CFArrayRef key_array, pattern_array;
+			
+			key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks);
+			pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks);
+			
+			if (key_array != NULL || pattern_array != NULL)
+			{
+				SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array);
+				source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0);
+			}
+			
+			if (key_array != NULL)
+				CFRelease (key_array);
+			if (pattern_array != NULL)
+				CFRelease (pattern_array);
+		}
+		
+		
+		for (i = 0; i < 4; i++)
+			if (keys[i] != NULL)
+			CFRelease (keys[i]);
+		for (i = 0; i < 2; i++)
+			if (patterns[i] != NULL)
+			CFRelease (patterns[i]);
+		
+		CFRelease (ref); 
+    }
+	
+    if (source != NULL)
+    {
+		CFRunLoopAddSource (CFRunLoopGetCurrent (),
+							source, kCFRunLoopDefaultMode);
+		CFRelease (source);
+    }
+	
+    return source != NULL;
+}
+
+
+/* Entrypoint. */
+
+void
+termination_signal_handler (int unused_sig)
+{
+    signal (SIGTERM, SIG_DFL);
+    signal (SIGHUP, SIG_DFL);
+    signal (SIGINT, SIG_DFL);
+    signal (SIGQUIT, SIG_DFL);
+
+    longjmp (exit_continuation, 1);
+}
+
+int
+server_main (int argc, char **argv)
+{
+    char **xargv;
+    int i, j;
+    int fd;
+	
+    xargv = alloca (sizeof (char *) * (argc + 32));
+	
+    if (!read_boolean_pref (CFSTR ("no_auth"), FALSE))
+		auth_file = XauFileName ();
+	
+    /* The standard X11 behaviour is for the server to quit when the first
+	 client exits. But it can be useful for debugging (and to mimic our
+	 behaviour in the beta releases) to not do that. */
+	
+    xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE);
+	
+    for (i = 1; i < argc; i++)
+    {
+		if (argv[i][0] == ':')
+			server_name = argv[i];
+    }
+	
+    if (server_name == NULL)
+    {
+		static char name[8];
+		
+		/* No display number specified, so search for the first unused.
+		 
+		 There's a big old race condition here if two servers start at
+		 the same time, but that's fairly unlikely. We could create
+		 lockfiles or something, but that's seems more likely to cause
+		 problems than the race condition itself.. */
+		
+		for (i = 0; i < MAX_DISPLAYS; i++)
+		{
+			if (!display_exists_p (i))
+				break;
+		}
+		
+		if (i == MAX_DISPLAYS)
+		{
+			fprintf (stderr, "%s: couldn't allocate a display number", argv[0]);
+			exit (1);
+		}
+		
+		sprintf (name, ":%d", i);
+		server_name = name;
+    }
+	
+    if (auth_file != NULL)
+    {
+		/* Create new Xauth keys and add them to the .Xauthority file */
+		
+		make_auth_keys (server_name);
+		write_auth_file (TRUE);
+    }
+	
+    /* Construct our new argv */
+	
+    i = j = 0;
+	
+    xargv[i++] = argv[j++];
+	
+    if (auth_file != NULL)
+    {
+		xargv[i++] = "-auth";
+		xargv[i++] = auth_file;
+    }
+	
+    /* By default, don't listen on tcp sockets if Xauth is disabled. */
+	
+    if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL))
+    {
+		xargv[i++] = "-nolisten";
+		xargv[i++] = "tcp";
+    }
+	
+    while (j < argc)
+    {
+		if (argv[j++][0] != ':')
+			xargv[i++] = argv[j-1];
+    }
+	
+    xargv[i++] = (char *) server_name;
+    xargv[i++] = NULL;
+	
+    /* Detach from any controlling terminal and connect stdin to /dev/null */
+	
+#ifdef TIOCNOTTY
+    fd = open ("/dev/tty", O_RDONLY);
+    if (fd != -1)
+    {
+		ioctl (fd, TIOCNOTTY, 0);
+		close (fd);
+    }
+#endif
+	
+    fd = open ("/dev/null", O_RDWR, 0);
+    if (fd >= 0)
+    {
+		dup2 (fd, 0);
+		if (fd > 0)
+			close (fd);
+    }
+	
+    if (!start_server (xargv))
+		return 1;
+	
+    if (!wait_for_server ())
+    {
+		kill (server_pid, SIGTERM);
+		return 1;
+    }
+	
+    if (!start_client ())
+    {
+		kill (server_pid, SIGTERM);
+		return 1;
+    }
+	
+    signal (SIGCHLD, sigchld_handler);
+	
+    signal (SIGTERM, termination_signal_handler);
+    signal (SIGHUP, termination_signal_handler);
+    signal (SIGINT, termination_signal_handler);
+    signal (SIGQUIT, termination_signal_handler);
+
+    if (setjmp (exit_continuation) == 0)
+    {
+		if (install_ipaddr_source ())
+			CFRunLoopRun ();
+		else
+			while (1) pause ();
+    }
+	
+    signal (SIGCHLD, SIG_IGN);
+
+    if (client_pid >= 0) kill (client_pid, SIGTERM);
+    if (server_pid >= 0) kill (server_pid, SIGTERM);
+	
+    if (auth_file != NULL)
+    {
+		/* Remove our Xauth keys */
+		
+		write_auth_file (FALSE);
+    }
+	
+    free_auth_items ();
+	
+    return 0;
+}
diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am
index 8980ad7..7696622 100644
--- a/hw/darwin/quartz/xpr/Makefile.am
+++ b/hw/darwin/quartz/xpr/Makefile.am
@@ -1,12 +1,16 @@
-noinst_LIBRARIES = libxpr.a
+bin_PROGRAMS = Xquartz
+
+# TODO: This man page needs sed magic and cleanup
+man1_MANS = Xquartz.man
+
 AM_CFLAGS =  $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
-	   -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
-	   -I$(top_srcdir)/miext \
-	   -I$(top_srcdir)/miext/rootless \
-	   -I$(top_srcdir)/miext/rootless/safeAlpha
+	-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
+	-I$(top_srcdir)/miext \
+	-I$(top_srcdir)/miext/rootless \
+	-I$(top_srcdir)/miext/rootless/safeAlpha
 
-libxpr_a_SOURCES = \
+Xquartz_SOURCES = \
 	appledri.c \
 	dri.c \
 	xprAppleWM.c \
@@ -17,7 +21,45 @@ libxpr_a_SOURCES = \
 	x-hook.c \
 	x-list.c
 
+Xquartz_LDADD = \
+	$(top_builddir)/hw/darwin/quartz/libXquartz.la \
+	$(top_builddir)/hw/darwin/libXdarwin.la \
+	$(top_builddir)/dix/dixfonts.lo \
+	$(top_builddir)/dix/libdix.la \
+	$(top_builddir)/os/libos.la \
+	$(top_builddir)/dix/libxpstubs.la \
+	$(top_builddir)/miext/shadow/libshadow.la \
+	$(top_builddir)/fb/libfb.la \
+	$(top_builddir)/mi/libmi.la \
+	$(top_builddir)/composite/libcomposite.la \
+	$(top_builddir)/damageext/libdamageext.la \
+	$(top_builddir)/miext/damage/libdamage.la \
+	$(top_builddir)/xfixes/libxfixes.la \
+	$(top_builddir)/miext/cw/libcw.la \
+	$(top_builddir)/Xext/libXext.la \
+	$(top_builddir)/xkb/libxkb.la \
+	$(top_builddir)/xkb/libxkbstubs.la \
+	$(top_builddir)/Xi/libXi.la \
+	$(top_builddir)/dbe/libdbe.la \
+	$(top_builddir)/record/librecord.la \
+	$(top_builddir)/XTrap/libxtrap.la \
+	$(top_builddir)/miext/rootless/librootless.la \
+	$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+	$(top_builddir)/miext/rootless/accel/librlAccel.la \
+	$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
+
+Xquartz_LDFLAGS =  \
+	-XCClinker -Objc \
+	-Wl,-u,_miDCInitialize \
+	-Wl,-framework,Carbon \
+	-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \
+	-Wl,-framework,OpenGL \
+	-Wl,-framework,Cocoa \
+	-Wl,-framework,CoreAudio \
+	-Wl,-framework,IOKit
+
 EXTRA_DIST = \
+	Xquartz.man \
 	dri.h \
 	dristruct.h \
 	appledri.h \
diff --git a/hw/darwin/quartz/xpr/Xquartz.man b/hw/darwin/quartz/xpr/Xquartz.man
new file mode 100644
index 0000000..37a7f1a
--- /dev/null
+++ b/hw/darwin/quartz/xpr/Xquartz.man
@@ -0,0 +1,156 @@
+.TH XQUARTZ 1 __vendorversion__
+.SH NAME
+Xquartz \- X window system server for Quartz operating system
+.SH SYNOPSIS
+.B Xquartz
+[ options ] ...
+.SH DESCRIPTION
+.I Xquartz
+is the X window server for Mac OS X provided by Apple.
+.I Xquartz
+runs in parallel with Aqua in rootless mode. In rootless mode, the X
+window system and Mac OS X share your display.  The root window of the
+X11 display is the size of the screen and contains all the other
+windows. The X11 root window is not displayed in rootless mode as Mac
+OS X handles the desktop background.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXquartz\fP accepts the following command line switches:
+.TP 8
+.B \-fakebuttons
+Emulates a 3 button mouse using modifier keys. By default, the Command modifier
+is used to emulate button 2 and Option is used for button 3. Thus, clicking the
+first mouse button while holding down Command will act like clicking
+button 2. Holding down Option will simulate button 3.
+.TP 8
+.B \-nofakebuttons
+Do not emulate a 3 button mouse. This is the default.
+.TP 8
+.B "\-fakemouse2 \fImodifiers\fP"
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: Shift, Option, Control, Command, Fn. For example,
+.B \-fakemouse2 """Option,Shift""
+will set holding Option, Shift and clicking on button one as equivalent to
+clicking the second mouse button.
+.TP 8
+.B "\-fakemouse3 \fImodifiers\fP"
+Change the modifier keys used to emulate the third mouse button. By default,
+Option is used to emulate the third button. Any combination of the following
+modifier names may be used: Shift, Option, Control, Command, Fn. For example,
+.B \-fakemouse3 """Control,Shift""
+will set holding Control, Shift and clicking on button one as equivalent to
+clicking the third mouse button.
+.TP 8
+.B "\-swapAltMeta"
+Swaps the meaning of the Alt and Meta modifier keys.
+.TP 8
+.B "\-keymap \fIfile\fP"
+On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
+The default is to read this keymapping from USA.keymapping. With this option
+the keymapping will be read from \fIfile\fP instead. If the file's path is
+not specified, it will be searched for in Library/Keyboards/ underneath the
+following directories (in order): ~, /, /Network, /System.
+.TP 8
+.B \-nokeymap
+On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
+With this option \fIXquartz\fP queries the kernel for the current keymapping
+instead of reading it from a file. This will often fail on newer kernels.
+.TP 8
+.B "\-depth \fIdepth\fP"
+Specifies the color bit depth to use. Currently only 15, and 24 color
+bits per pixel are supported. If not specified, defaults to the depth
+of the main display.
+.SH CUSTOMIZATION
+\fIXquartz\fP can also be customized using the defaults(1) command. The available options are:
+.TP 8
+.B defaults write com.apple.x11 enable_fake_buttons -boolean true
+Equivalent to the \fB-fakebuttons\fP command line option.
+.TP 8
+.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP
+Equivalent to the \fB-fakemouse2\fP option.
+.TP 8
+.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP
+Equivalent to the \fB-fakemouse3\fP option.
+.TP 8
+.B defaults write com.apple.x11 swap_alt_meta -boolean true
+Equivalent to the \fB-swapAltMeta\fP option.
+.TP 8
+.B defaults write com.apple.x11 keymap_file \fIfilename\fP
+Equivalent to the \fB-keymap\fP option.
+.TP 8
+.B defaults write com.apple.x11 no_quit_alert -boolean true
+Disables the alert dialog displayed when attempting to quit X11.
+.TP 8
+.B defaults write com.apple.x11 no_auth -boolean true
+Stops the X server requiring that clients authenticate themselves when
+connecting. See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write com.apple.x11 nolisten_tcp -boolean true
+Prevents the X server accepting remote connections.
+.TP 8
+.B defaults write com.apple.x11 xinit_kills_server -boolean false
+Stops the X server exiting when the xinitrc script terminates.
+.TP 8
+.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false
+Allows system hotkeys to be handled while in X11 fullscreen mode.
+.TP 8
+.B defaults write com.apple.x11 enable_system_beep -boolean false
+Don't use the standard system beep effect for X11 alerts.
+.TP 8
+.B defaults write com.apple.x11 enable_key_equivalents -boolean false
+Disable menu keyboard equivalents while X11 windows are focused.
+.TP 8
+.B defaults write com.apple.x11 depth \fIdepth\fP
+Equivalent to the \fB-depth\fP option.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1)
+.PP
+.SH AUTHORS
+XFree86 was originally ported to Mac OS X Server by John Carmack. Dave
+Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
+Torrey T. Lyons improved and integrated this code into the XFree86
+Project's mainline for the 4.0.2 release.
+.PP
+The following members of the XonX Team contributed to the following
+releases (in alphabetical order):
+.TP 4
+XFree86 4.1.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - Cocoa version of XDarwin front end
+.br
+Gregory Robert Parker - Original Quartz implementation
+.br
+Christoph Pfisterer - Dynamic shared X libraries
+.br
+Toshimitsu Tanaka - Japanese localization
+.TP 4
+XFree86 4.2.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Pablo Di Noto - Spanish localization
+.br
+Paul Edens - Dutch localization
+.br
+Kyunghwan Kim - Korean localization
+.br
+Mario Klebsch - Non-US keyboard support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - German localization
+.br
+Patrik Montgomery - Swedish localization
+.br
+Greg Parker - Rootless support
+.br
+Toshimitsu Tanaka - Japanese localization
+.br
+Olivier Verdier - French localization


More information about the xorg-commit mailing list