[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xinit: Changes to 'upstream-unstable'



 .gitignore          |    2 
 Makefile.am         |   58 ++++------------
 configure.ac        |   38 +++++++++-
 cpprules.in         |   37 ++++++++++
 org.x.X11.plist.cpp |   27 +++++++
 startx.cpp          |  188 ++++++++++++++++++++++++++++++++++------------------
 xinit.c             |   98 +++++++++++++++++++++------
 xinitrc.cpp         |   28 +++++++
 8 files changed, 348 insertions(+), 128 deletions(-)

New commits:
commit 3eaee22196a03d88c419c42470baf562552c1a3b
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu Mar 6 17:09:45 2008 -0500

    xinit 1.0.8

diff --git a/configure.ac b/configure.ac
index 2a364ee..0d13f8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ([2.57])
-AC_INIT(xinit,[1.0.7], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
+AC_INIT(xinit,[1.0.8], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
 AM_INIT_AUTOMAKE([dist-bzip2])
 AM_MAINTAINER_MODE
 

commit 96c8650369a99e344b4e3510f713b331d83c4272
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Sun Mar 2 10:32:58 2008 -0800

    Apple: Use -c in the launchd plist, so broken .profile/.bashrc don't much up startx

diff --git a/org.x.X11.plist.cpp b/org.x.X11.plist.cpp
index 2e597ca..3ee22bd 100644
--- a/org.x.X11.plist.cpp
+++ b/org.x.X11.plist.cpp
@@ -9,6 +9,7 @@
 #ifdef __APPLE__
 			<string>/bin/bash</string>
 			<string>--login</string>
+			<string>-c</string>
 #endif
 			<string>__bindir__/startx</string>
 		</array>

commit aa026deef43a8c1479e6a558194e0a473bbdaeb0
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Sat Mar 1 17:30:47 2008 -0800

    Apple: Adding support for an xinitrc.d directory on OSX, so fink doesn't need to clobber files

diff --git a/cpprules.in b/cpprules.in
index 2e50207..f32eafc 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -10,6 +10,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                        -e '/^[ 	]*XCOMM$$/s/XCOMM/\#/' \
                        -e '/^[ 	]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
                        -e '/^[ 	]*XHASH/s/XHASH/\#/' \
+                       -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
                        -e '/\@\@$$/s/\@\@$$/\\/'
 
 # Strings to replace in man pages
diff --git a/xinitrc.cpp b/xinitrc.cpp
index e42002d..89a65ca 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -87,20 +87,13 @@ XCOMM This is the fallback case if nothing else is executed above
 
 #ifdef __APPLE__
 
-if [ -x /usr/X11/bin/xset ] ; then
-	fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled"
-
-	[ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
-	[ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
-	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
-	[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
-
-	/usr/X11/bin/xset fp= "$fontpath"
-	unset fontpath
+if [ -d XINITDIR/xinitrc.d ] ; then
+	for f in XINITDIR/xinitrc.dXSLASHGLOB.sh ; do
+		[ -x "$f" ] && . "$f"
+	done
+	unset f
 fi
 
-[ -x /usr/bin/quartz-wm ] && exec /usr/bin/quartz-wm
-
 #endif
 
 TWM &

commit 916b1ab10d10efbdf3a544534acb95f9d28692cf
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Mon Feb 18 15:53:46 2008 -0800

    Apple: font caching and defaults
    Quieted defaults "error" messages by initializing default values
    Do font caching in startx, so users with custom ~/.xinitrc won't have to
    worry about updating it.
    Add "cache_fonts" defaults item to toggle whether or not to cache fonts at startup
    Fall back on fc-cache if font_cache.sh is not present.

diff --git a/startx.cpp b/startx.cpp
index bde93fb..c31fd7f 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -79,7 +79,30 @@ clientargs=""
 serverargs=""
 
 #ifdef __APPLE__
-if [ x`defaults read org.x.X11 no_auth` = x0 ] || ! defaults read org.x.X11 no_auth ; then
+
+XCOMM Initialize defaults (this will cut down on "safe" error messages)
+if ! defaults read org.x.X11 cache_fonts >& /dev/null ; then
+    defaults write org.x.X11 cache_fonts -bool true
+fi
+
+if ! defaults read org.x.X11 no_auth >& /dev/null ; then
+    defaults write org.x.X11 no_auth -bool false
+fi
+
+if ! defaults read org.x.X11 nolisten_tcp >& /dev/null ; then
+    defaults write org.x.X11 nolisten_tcp -bool true
+fi
+
+XCOMM First, start caching fonts
+if [ x`defaults read org.x.X11 cache_fonts` = x1 ] ; then
+    if [ -x /usr/X11/bin/font_cache.sh ] ; then
+        /usr/X11/bin/font_cache.sh &
+    elif [ -x /usr/X11/bin/fc-cache ] ; then
+        /usr/X11/bin/fc-cache &
+    fi
+fi
+
+if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
     enable_xauth=1
 else
     enable_xauth=0
diff --git a/xinitrc.cpp b/xinitrc.cpp
index 74424ad..e42002d 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -87,8 +87,6 @@ XCOMM This is the fallback case if nothing else is executed above
 
 #ifdef __APPLE__
 
-[ -x /usr/X11/bin/font_cache.sh ] && /usr/X11/bin/font_cache.sh
-
 if [ -x /usr/X11/bin/xset ] ; then
 	fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled"
 

commit 19fa8408a2c707081ba984537a3dcab744b0a565
Author: Jeremy Huddleston <jeremy@tifa-2.local>
Date:   Sat Feb 16 02:50:47 2008 -0800

    Added org.x.X11.plist.cpp to EXTRA_DIST

diff --git a/Makefile.am b/Makefile.am
index d170510..a1d76c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,7 +74,7 @@ xinitrc_DATA = xinitrc
 
 CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)
 
-EXTRA_DIST = xinitrc.cpp startx.cpp $(appman_PRE)	\
+EXTRA_DIST = xinitrc.cpp startx.cpp org.x.X11.plist.cpp $(appman_PRE)	\
 		startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
 
 .PHONY: ChangeLog

commit 9259740a2d69c6c2fc1786508dbd08ae2cfef101
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Sun Feb 10 18:49:06 2008 -0800

    Apple: Support spaces in $HOME for font path, and remove duplicate entry

diff --git a/xinitrc.cpp b/xinitrc.cpp
index 01fbf17..74424ad 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -92,9 +92,8 @@ XCOMM This is the fallback case if nothing else is executed above
 if [ -x /usr/X11/bin/xset ] ; then
 	fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled"
 
-	[ -e $HOME/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
-	[ -e $HOME/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
-	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
+	[ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
+	[ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
 	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
 	[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
 

commit 4e899293d7f7bb0a67b094402fad7db55169acec
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Sun Feb 10 02:04:16 2008 -0800

    Apple: Cleaned up font path setting and added font caching to xinitrc

diff --git a/xinitrc.cpp b/xinitrc.cpp
index c44e0fd..01fbf17 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -87,17 +87,14 @@ XCOMM This is the fallback case if nothing else is executed above
 
 #ifdef __APPLE__
 
+[ -x /usr/X11/bin/font_cache.sh ] && /usr/X11/bin/font_cache.sh
+
 if [ -x /usr/X11/bin/xset ] ; then
 	fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled"
 
-	if [ -d "$HOME/Library/Fonts" ] ; then
-		if [ ! -e $HOME/Library/Fonts/fonts.dir ] ; then
-			[ -x /usr/X11/bin/mkfontdir ] && mkfontdir $HOME/Library/Fonts
-			[ -x /usr/X11/bin/mkfontscale ] && mkfontscale $HOME/Library/Fonts
-		fi
-		[ -e $HOME/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
-	fi
-
+	[ -e $HOME/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
+	[ -e $HOME/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
+	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
 	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
 	[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
 

commit 238b74a47eb66bfa24627b099bf9c6a06e91d35a
Author: Jeremy Huddleston <jeremy@tifa.local>
Date:   Sat Feb 9 22:17:02 2008 -0800

    Apple: use -nocpp arg to xrdb if cpp is not installed

diff --git a/xinitrc.cpp b/xinitrc.cpp
index e01b9e7..c44e0fd 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -9,7 +9,15 @@ sysmodmap=XINITDIR/.Xmodmap
 XCOMM merge in defaults and keymaps
 
 if [ -f $sysresources ]; then
+#ifdef __APPLE__
+    if [ -x /usr/bin/cpp ] ; then
+        XRDB -merge $sysresources
+    else
+        XRDB -nocpp -merge $sysresources
+    fi
+#else
     XRDB -merge $sysresources
+#endif
 fi
 
 if [ -f $sysmodmap ]; then
@@ -17,7 +25,15 @@ if [ -f $sysmodmap ]; then
 fi
 
 if [ -f $userresources ]; then
+#ifdef __APPLE__
+    if [ -x /usr/bin/cpp ] ; then
+        XRDB -merge $userresources
+    else
+        XRDB -nocpp -merge $userresources
+    fi
+#else
     XRDB -merge $userresources
+#endif
 fi
 
 if [ -f $usermodmap ]; then

commit b9a2f211eff9f7fdc1399146d175923ca589cf2a
Author: David Nusinow <dnusinow@debian.org>
Date:   Tue Feb 5 11:58:40 2008 -0500

    Unbreak installs on non-launchd systems
    
    Thanks to cjb for running the tinderbox that spotted this
    breakage.

diff --git a/configure.ac b/configure.ac
index df672aa..2a364ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,7 +98,6 @@ AC_ARG_WITH(launchagents-dir,AS_HELP_STRING([--with-launchagents-dir=PATH], [Pat
 h to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
                                 [ launchagentsdir="${withval}" ],
                                 [ launchagentsdir="/Library/LaunchAgents" ])
-AC_SUBST([launchagentsdir])
 
 if test "x$LAUNCHD" = "xauto"; then
 	unset LAUNCHD
@@ -121,7 +120,9 @@ if test "x$LAUNCHD" = "xyes" ; then
 	esac
 else
 	AM_CONDITIONAL(APPLE,false)
+        launchagentsdir=""
 fi
+AC_SUBST([launchagentsdir])
 AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
 
 # Checks for pkg-config packages

commit 6403e53a1fef9fd7dd8c77640d01bb8aaee09f91
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Fri Feb 1 00:35:27 2008 -0800

    OS-X: Set fontpath in xinitrc to include system / user fonts.  Additionally fixed font scaling issues (trac #52)

diff --git a/xinitrc.cpp b/xinitrc.cpp
index c24bcd0..e01b9e7 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -70,7 +70,27 @@ XCOMM This is the fallback case if nothing else is executed above
 #endif /* !defined(__SCO__)  && !defined(__UNIXWARE__) */
 
 #ifdef __APPLE__
+
+if [ -x /usr/X11/bin/xset ] ; then
+	fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr/X11/lib/X11/fonts/100dpi/:unscaled"
+
+	if [ -d "$HOME/Library/Fonts" ] ; then
+		if [ ! -e $HOME/Library/Fonts/fonts.dir ] ; then
+			[ -x /usr/X11/bin/mkfontdir ] && mkfontdir $HOME/Library/Fonts
+			[ -x /usr/X11/bin/mkfontscale ] && mkfontscale $HOME/Library/Fonts
+		fi
+		[ -e $HOME/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
+	fi
+
+	[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
+	[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
+
+	/usr/X11/bin/xset fp= "$fontpath"
+	unset fontpath
+fi
+
 [ -x /usr/bin/quartz-wm ] && exec /usr/bin/quartz-wm
+
 #endif
 
 TWM &

commit d9d43955a03fb3d5b2d87d9c1a7de463f1a027b6
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Fri Feb 1 00:23:54 2008 -0800

    OS-X: Fixed typo

diff --git a/startx.cpp b/startx.cpp
index dad3346..bde93fb 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -33,7 +33,7 @@ esac
 
 XCOMM Now the "old" compiled path
 #ifdef __APPLE__
-olddbindir=/usr/X11R6/bin
+oldbindir=/usr/X11R6/bin
 #else
 oldbindir=/usr/bin/X11
 #endif

commit 7400760ae1b88d0c514aa119643cd412a4a68b06
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Wed Jan 9 21:03:41 2008 -0800

    OS-X: Add bindir to $PATH in startx if it's not there
    This should also fix this on SCO since it was using the incorrect BINDIR
    instead of __bindir__ in that code block...

diff --git a/org.x.X11.plist.cpp b/org.x.X11.plist.cpp
index bede9b2..2e597ca 100644
--- a/org.x.X11.plist.cpp
+++ b/org.x.X11.plist.cpp
@@ -7,18 +7,18 @@
 	<key>ProgramArguments</key>
 		<array>
 #ifdef __APPLE__
-		<string>/bin/bash</string>
-		<string>--login</string>
+			<string>/bin/bash</string>
+			<string>--login</string>
 #endif
-		<string>__bindir__/startx</string>
+			<string>__bindir__/startx</string>
 		</array>
 	<key>Sockets</key>
 		<dict>
-		<key>:0</key>
-			<dict>
-			<key>SecureSocketWithKey</key>
-				<string>DISPLAY</string>
-			</dict>
+			<key>:0</key>
+				<dict>
+					<key>SecureSocketWithKey</key>
+						<string>DISPLAY</string>
+				</dict>
 		</dict>
 	<key>ServiceIPC</key>
 		<true/>
diff --git a/startx.cpp b/startx.cpp
index 23ea024..dad3346 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -13,37 +13,44 @@ XCOMM Site administrators are STRONGLY urged to write nicer versions.
 XCOMM
 XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
 
-#if defined(__SCO__) || defined(__UNIXWARE__)
+#if defined(__SCO__) || defined(__UNIXWARE__) || defined(__APPLE__)
 
 XCOMM Check for /usr/bin/X11 and BINDIR in the path, if not add them.
 XCOMM This allows startx to be placed in a place like /usr/bin or /usr/local/bin
 XCOMM and people may use X without changing their PATH.
 XCOMM Note that we put our own bin directory at the front of the path, and
-XCOMM the standard SCO path at the back, since if you are using the Xorg
+XCOMM the standard system path at the back, since if you are using the Xorg
 XCOMM server theres a pretty good chance you want to bias the Xorg clients
-XCOMM over the old SCO X11R5 clients.
+XCOMM over the old system's clients.
 
 XCOMM First our compiled path
-
-bindir=BINDIR
-scobindir=/usr/bin/X11
+bindir=__bindir__
 
 case $PATH in
-  *:$bindir | *:$bindir:* | $bindir:*) ;;
-  *) PATH=$bindir:$PATH ;;
+    *:$bindir | *:$bindir:* | $bindir:*) ;;
+    *) PATH=$bindir:$PATH ;;
 esac
 
-XCOMM Now the "SCO" compiled path
+XCOMM Now the "old" compiled path
+#ifdef __APPLE__
+olddbindir=/usr/X11R6/bin
+#else
+oldbindir=/usr/bin/X11
+#endif
 
-case $PATH in
-  *:$scobindir | *:$scobindir:* | $scobindir:*) ;;
-  *) PATH=$PATH:$scobindir ;;
-esac
+if [ -d "$oldbindir" ] ; then
+    case $PATH in
+        *:$oldbindir | *:$oldbindir:* | $oldbindir:*) ;;
+        *) PATH=$PATH:$oldbindir ;;
+    esac
+fi
 
 XCOMM Bourne shell does not automatically export modified environment variables
 XCOMM so export the new PATH just in case the user changes the shell
 export PATH
+#endif
 
+#if defined(__SCO__) || defined(__UNIXWARE__)
 XCOMM Set up the XMERGE env var so that dos merge is happy under X
 
 if [ -f /usr/lib/merge/xmergeset.sh ]; then

commit 0f740f75ececc9742c6f407d53b482897ef5f698
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Fri Jan 4 11:36:26 2008 -0800

    OS-X: Properly set enable_xauth if the user has no defaults set and choose a valid $display for fast-user-switching.

diff --git a/startx.cpp b/startx.cpp
index 4469ee4..23ea024 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -72,15 +72,21 @@ clientargs=""
 serverargs=""
 
 #ifdef __APPLE__
-if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
+if [ x`defaults read org.x.X11 no_auth` = x0 ] || ! defaults read org.x.X11 no_auth ; then
     enable_xauth=1
 else
     enable_xauth=0
 fi
 
 if [ x`defaults read org.x.X11 nolisten_tcp` = x1 ] ; then
-    defaultserverargs="-nolisten tcp"
+    defaultserverargs="$defaultserverargs -nolisten tcp"
 fi
+
+for ((d=0; ; d++)) ; do
+    [[ -e /tmp/.X$d-lock ]] || break
+done
+defaultdisplay=":$d"
+
 #else
 enable_xauth=1
 #endif
@@ -173,6 +179,9 @@ if [ x"$server" = x ]; then
     XCOMM if no server arguments or display either, use rc file instead
     if [ x"$serverargs" = x -a x"$display" = x ]; then
 	server="$defaultserverargs"
+#ifdef __APPLE__
+	display="$defaultdisplay"
+#endif
     else
 	server=$defaultserver
     fi

commit 9c57524fde57284daae2309dce17dbf56a8643de
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Dec 20 18:26:38 2007 -0800

    XQuartz doesn't need the -launchd command line argument anymore.

diff --git a/org.x.X11.plist.cpp b/org.x.X11.plist.cpp
index cff3fc0..bede9b2 100644
--- a/org.x.X11.plist.cpp
+++ b/org.x.X11.plist.cpp
@@ -11,10 +11,6 @@
 		<string>--login</string>
 #endif
 		<string>__bindir__/startx</string>
-#ifdef __APPLE__
-		<string>--</string>
-		<string>-launchd</string>
-#endif
 		</array>
 	<key>Sockets</key>
 		<dict>

commit f31042ae688d75c2043e9df56f66cabdd56fdf75
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Dec 20 17:22:16 2007 -0800

    OS-X: Need to use bash --login to setup the environment from launchd.

diff --git a/org.x.X11.plist.cpp b/org.x.X11.plist.cpp
index 3a76a9d..cff3fc0 100644
--- a/org.x.X11.plist.cpp
+++ b/org.x.X11.plist.cpp
@@ -6,6 +6,10 @@
 		<string>org.x.X11</string>
 	<key>ProgramArguments</key>
 		<array>
+#ifdef __APPLE__
+		<string>/bin/bash</string>
+		<string>--login</string>
+#endif
 		<string>__bindir__/startx</string>
 #ifdef __APPLE__
 		<string>--</string>

commit d1c968926fa2fe36b612d4ebc948d73e6e0f6c01
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Dec 20 16:50:39 2007 -0800

    OS-X: Made defaults test more robust

diff --git a/startx.cpp b/startx.cpp
index e1e4271..4469ee4 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -72,13 +72,13 @@ clientargs=""
 serverargs=""
 
 #ifdef __APPLE__
-if [ `defaults read org.x.X11 no_auth` = 0 ] ; then
+if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
     enable_xauth=1
 else
     enable_xauth=0
 fi
 
-if [ `defaults read org.x.X11 nolisten_tcpip` = 1 ] ; then
+if [ x`defaults read org.x.X11 nolisten_tcp` = x1 ] ; then
     defaultserverargs="-nolisten tcp"
 fi
 #else

commit 73a2dd64576328de712ee792d569a88550e4ddb4
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Dec 20 16:13:27 2007 -0800

    Added support for OS-X preferences to disable tcp/ip connections and xauth

diff --git a/startx.cpp b/startx.cpp
index 81e776f..e1e4271 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -71,6 +71,21 @@ defaultserverargs=""
 clientargs=""
 serverargs=""
 
+#ifdef __APPLE__
+if [ `defaults read org.x.X11 no_auth` = 0 ] ; then
+    enable_xauth=1
+else
+    enable_xauth=0
+fi
+
+if [ `defaults read org.x.X11 nolisten_tcpip` = 1 ] ; then
+    defaultserverargs="-nolisten tcp"
+fi
+#else
+enable_xauth=1
+#endif
+
+
 if [ -f $userclientrc ]; then
     defaultclientargs=$userclientrc
 elif [ -f $sysclientrc ]; then
@@ -163,65 +178,67 @@ if [ x"$server" = x ]; then
     fi
 fi
 
-if [ x"$XAUTHORITY" = x ]; then
-    XAUTHORITY=$HOME/.Xauthority
-    export XAUTHORITY
-fi
+if [ x"$enable_xauth" = x1 ] ; then
+    if [ x"$XAUTHORITY" = x ]; then
+        XAUTHORITY=$HOME/.Xauthority
+        export XAUTHORITY
+    fi
 
-removelist=
+    removelist=
 
-XCOMM set up default Xauth info for this machine
-case `uname` in
-Linux*)
-	if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
-		hostname=`hostname -f`
-	else
-		hostname=`hostname`
-	fi
-	;;
-*)
-	hostname=`hostname`
-	;;
-esac
+    XCOMM set up default Xauth info for this machine
+    case `uname` in
+    Linux*)
+        if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
+            hostname=`hostname -f`
+        else
+            hostname=`hostname`
+        fi
+        ;;
+    *)
+        hostname=`hostname`
+        ;;
+    esac
 
-authdisplay=${display:-:0}
+    authdisplay=${display:-:0}
 #if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
-mcookie=`MK_COOKIE`
+    mcookie=`MK_COOKIE`
 #else
-mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
-if test x"$mcookie" = x; then
-                echo "Couldn't create cookie"
-                exit 1
-fi
+    mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
+    if test x"$mcookie" = x; then
+        echo "Couldn't create cookie"
+        exit 1
+    fi
 #endif
-dummy=0
+    dummy=0
 
-XCOMM create a file with auth information for the server. ':0' is a dummy.
-xserverauthfile=$HOME/.serverauth.$$
-trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
-xauth -q -f $xserverauthfile << EOF
+    XCOMM create a file with auth information for the server. ':0' is a dummy.
+    xserverauthfile=$HOME/.serverauth.$$
+    trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
+    xauth -q -f $xserverauthfile << EOF
 add :$dummy . $mcookie
 EOF
-serverargs=${serverargs}" -auth "${xserverauthfile}
-
-XCOMM now add the same credentials to the client authority file
-XCOMM if '$displayname' already exists do not overwrite it as another
-XCOMM server man need it. Add them to the '$xserverauthfile' instead.
-for displayname in $authdisplay $hostname$authdisplay; do
-     authcookie=`XAUTH list "$displayname" @@
-       | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
-    if [ "z${authcookie}" = "z" ] ; then
-        XAUTH -q << EOF 
+    serverargs=${serverargs}" -auth "${xserverauthfile}
+
+    XCOMM now add the same credentials to the client authority file
+    XCOMM if '$displayname' already exists do not overwrite it as another
+    XCOMM server man need it. Add them to the '$xserverauthfile' instead.
+    for displayname in $authdisplay $hostname$authdisplay; do
+        authcookie=`XAUTH list "$displayname" @@
+        | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
+        if [ "z${authcookie}" = "z" ] ; then
+            XAUTH -q << EOF 
 add $displayname . $mcookie
 EOF
-	removelist="$displayname $removelist"
-    else
-        dummy=$(($dummy+1));
-        XAUTH -q -f $xserverauthfile << EOF
+        removelist="$displayname $removelist"
+        else
+            dummy=$(($dummy+1));
+            XAUTH -q -f $xserverauthfile << EOF
 add :$dummy . $authcookie
 EOF
-    fi
-done
+        fi
+    done
+fi
 
 #if defined(__SCO__) || defined(__UNIXWARE__)
 if [ "$REMOTE_SERVER" = "TRUE" ]; then
@@ -233,13 +250,15 @@ fi
 XINIT $client $clientargs -- $server $display $serverargs
 #endif
 
-if [ x"$removelist" != x ]; then
-    XAUTH remove $removelist
-fi
-if [ x"$xserverauthfile" != x ]; then
-    rm -f $xserverauthfile
+if [ x"$enable_xauth" = x1 ] ; then
+    if [ x"$removelist" != x ]; then
+        XAUTH remove $removelist
+    fi
+    if [ x"$xserverauthfile" != x ]; then
+        rm -f $xserverauthfile
+    fi
 fi
-    
+
 /*
  * various machines need special cleaning up
  */

commit 4afcc5afa0dc7a1d14e93f18289c4490c9f2decd
Author: root <root@tinderbox.wearablelab.ml.unisa.edu.au>
Date:   Fri Dec 21 00:53:45 2007 +1030

    Define APPLE for the rest of us
    
    APPLE was only defined when, well on an APPLE. However Makefile.am
    unconditionally required it. Hence define APPLE to false when
    we're not on an APPLE.
    
    Found by: Tinderbox

diff --git a/configure.ac b/configure.ac
index 57def24..df672aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,8 +114,13 @@ if test "x$LAUNCHD" = "xyes" ; then
 			# A future version of launchd should let us do this cleaner
 			#XSERVER=\'\`'$(libexecdir)/x11-exec'\`\'
 			AM_CONDITIONAL(APPLE, true)
-	;;
+		;;
+		*)
+			AM_CONDITIONAL(APPLE, false)
+		;;
 	esac
+else
+	AM_CONDITIONAL(APPLE,false)
 fi
 AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
 

commit cced740b1e1c8220701e59cec1be04498f851296
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Sun Dec 16 01:12:20 2007 -0800

    OS-X: Added argv[0] hack for finding Xquartz UI and icon as well as claiming its dock icon
    Partially removes need for x11-exec on OS-X.  We still need to handle options set in defaults.

diff --git a/.gitignore b/.gitignore
index 6356185..363b8c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,5 +22,4 @@ xinit.1
 xinitrc
 *~
 *.o
-launchd/org.x.X11.plist
-launchd/x11-exec
+org.x.X11.plist
diff --git a/Makefile.am b/Makefile.am
index fe39364..d170510 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,10 @@ bin_SCRIPTS = startx
 xinit_CFLAGS = $(XINIT_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
 xinit_LDADD = $(XINIT_LIBS)
 
+if APPLE
+xinit_LDFLAGS = -framework CoreServices
+endif
+
 xinit_SOURCES =	\
         xinit.c
 
@@ -54,14 +58,21 @@ PROGCPPDEFS = \
 
 CPP_FILES_FLAGS = \
 	-DXINITDIR=$(XINITDIR) $(PROGCPPDEFS) -DLIBDIR=$(libdir) \
-	-DSHELL_CMD=$(SHELL_CMD) $(STARTX_COOKIE_FLAGS)
+	-DSHELL_CMD=$(SHELL_CMD) $(STARTX_COOKIE_FLAGS) \
+	-D__libexecdir__="$(libexecdir)" \
+	-D__bindir__="$(bindir)"
+
+if LAUNCHD
+launchagents_PRE = org.x.X11.plist.pre
+launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
+endif
 
 xinitrc: xinitrc.cpp Makefile
 startx: startx.cpp Makefile
 
 xinitrc_DATA = xinitrc
 
-CLEANFILES = xinitrc startx $(appman_DATA)
+CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)
 
 EXTRA_DIST = xinitrc.cpp startx.cpp $(appman_PRE)	\
 		startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
@@ -72,10 +83,3 @@ ChangeLog:
 	(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
 
 dist-hook: ChangeLog
-
-if LAUNCHD
-LAUNCHD_SUBDIRS = launchd
-endif
-
-SUBDIRS = $(LAUNCHD_SUBDIRS)
-DIST_SUBDIRS = launchd
diff --git a/configure.ac b/configure.ac
index 1413595..57def24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ AM_MAINTAINER_MODE
 AM_CONFIG_HEADER(config.h)
 
 AC_PROG_CC
+AM_PROG_CC_C_O
 XORG_PROG_RAWCPP
 AC_PROG_INSTALL
 AC_PATH_PROG(SED,sed)
@@ -175,4 +176,3 @@ XORG_MANPAGE_SECTIONS
 XORG_RELEASE_VERSION
 
 AC_OUTPUT([Makefile])
-AC_OUTPUT([launchd/Makefile])
diff --git a/launchd/Makefile.am b/launchd/Makefile.am
deleted file mode 100644
index b841df8..0000000
--- a/launchd/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-if APPLE
-libexec_PROGRAMS = x11-exec
-x11_exec_LDFLAGS = -framework CoreServices
-endif
-
-launchagents_PRE = org.x.X11.plist.pre
-launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
-
-CPP_FILES_FLAGS = \
-	-D__libexecdir__="$(libexecdir)" \
-	-D__bindir__="$(bindir)"
-
-CLEANFILES = $(launchagents_DATA)
-
-include $(top_srcdir)/cpprules.in
diff --git a/launchd/org.x.X11.plist.cpp b/launchd/org.x.X11.plist.cpp
deleted file mode 100644
index 6aed8d8..0000000
--- a/launchd/org.x.X11.plist.cpp
+++ /dev/null
@@ -1,27 +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>ProgramArguments</key>
-		<array>
-#ifdef __APPLE__
-		<string>__libexecdir__/x11-exec</string>
-		<string>-launchd</string>
-#else
-		<string>__bindir__/startx</string>
-#endif
-		</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/launchd/x11-exec.c b/launchd/x11-exec.c
deleted file mode 100644
index bc1a233..0000000
--- a/launchd/x11-exec.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* x11-exec.c -- Find X11.app by bundle-id and report its path.
- This is so launchd can correctly find X11.app, even if the user moved it.
-
- 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 <CoreServices/CoreServices.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#define kX11AppBundleId "org.x.X11"
-#define kX11AppBundlePath "/Contents/MacOS/X11"
-
-int main(int argc, char **argv) {
-    char x11_path[PATH_MAX];
-    char** args = NULL;
-    CFURLRef appURL = NULL;
-    OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
-    
-    switch (osstatus) {
-        case noErr:
-            if (appURL == NULL) {
-                fprintf(stderr, "%s: Invalid response from LSFindApplicationForInfo(%s)\n", 
-                        argv[0], kX11AppBundleId);
-                exit(1);
-            }
-
-            if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
-                fprintf(stderr, "%s: Error resolving URL for %s\n", argv[0], kX11AppBundleId);
-                exit(2);
-            }
-
-            strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
-            fprintf(stderr, "X11.app = %s\n", x11_path);
-
-            args = (char**)malloc(sizeof (char*) * (argc + 1));
-            if (args) {
-                int i;
-                args[0] = x11_path;
-                for (i = 1; i < argc; ++i) {
-                    args[i] = argv[i];


Reply to: