summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremy@yuffie.local>2008-01-04 11:36:26 -0800
committerJeremy Huddleston <jeremy@yuffie.local>2008-01-04 11:36:26 -0800
commit0f740f75ececc9742c6f407d53b482897ef5f698 (patch)
treec96278d96da773cda8178e5e823d087919633b81
parent9c57524fde57284daae2309dce17dbf56a8643de (diff)
OS-X: Properly set enable_xauth if the user has no defaults set and choose a valid $display for fast-user-switching.
-rw-r--r--startx.cpp13
1 files changed, 11 insertions, 2 deletions
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