xinit: Changes to 'upstream-unstable'
configure.ac | 10 ++++++----
launchd/user_startx/Makefile.am | 4 ++++
launchd/user_startx/launchd_startx.c | 22 +++++++++++++++++++++-
launchd/user_startx/startx.plist.cpp | 4 ++++
startx.cpp | 34 ++++++++++++++++++++++------------
xinit.c | 2 --
6 files changed, 57 insertions(+), 19 deletions(-)
New commits:
commit f5ef7a3f8c1e8ac3f715e4059bf3b9a03aafd5a7
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Jan 27 23:13:48 2012 -0800
configure.ac: 1.3.2
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/configure.ac b/configure.ac
index 4402ba5..d18c4b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([xinit], [1.3.1],
+AC_INIT([xinit], [1.3.2],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
commit ec55c94dfe1bf43ece808d984c672602faddd91b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Tue Nov 8 14:14:19 2011 -0800
Use default clientargs, serverargs, and display if none were set
Previously, we did not use the default values unless server or client weren't
set, but we should still use the defaults if they were not set but the server
was. This is most evident when you want to tell startx which server to use,
but you want startx to figure out which display to use automatically.
This fixes a regression introduced by the previous patch on XQuartz:
http://xquartz.macosforge.org/trac/ticket/523
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/startx.cpp b/startx.cpp
index 9135da8..c92c51c 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -201,7 +201,7 @@ XCOMM process client arguments
if [ x"$client" = x ]; then
client=$defaultclient
- XCOMM if no client arguments either, use rc file instead
+ XCOMM For compatibility reasons, only use startxrc if there were no client command line arguments
if [ x"$clientargs" = x ]; then
if [ -f "$userclientrc" ]; then
client=$userclientrc
@@ -214,29 +214,38 @@ if [ x"$client" = x ]; then
client=$scosysclientrc
#endif
fi
-
- clientargs=$defaultclientargs
fi
fi
+XCOMM if no client arguments, use defaults
+if [ x"$clientargs" = x ]; then
+ clientargs=$defaultclientargs
+fi
+
XCOMM process server arguments
if [ x"$server" = x ]; then
server=$defaultserver
- XCOMM if no server arguments or display either, use defaults
+ XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
if [ x"$serverargs" = x -a x"$display" = x ]; then
- XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
if [ -f "$userserverrc" ]; then
server=$userserverrc
elif [ -f "$sysserverrc" ]; then
server=$sysserverrc
fi
-
- serverargs=$defaultserverargs
- display=$defaultdisplay
fi
fi
+XCOMM if no server arguments, use defaults
+if [ x"$serverargs" = x ]; then
+ serverargs=$defaultserverargs
+fi
+
+XCOMM if no display, use default
+if [ x"$display" = x ]; then
+ display=$defaultdisplay
+fi
+
if [ x"$enable_xauth" = x1 ] ; then
if [ x"$XAUTHORITY" = x ]; then
XAUTHORITY=$HOME/.Xauthority
commit 98b85a1ac235dbf421d1a49b41599e8bcaf490d3
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Oct 19 23:00:56 2011 -0700
launchd: Add an option (--with-launchagent-xserver) to set the default X11 server
This allows the LaunchAgent and startx to have different default servers
which will be useful as the Xorg DDX becomes available on darwin.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/configure.ac b/configure.ac
index 4e808ec..4402ba5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,9 @@ AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with sup
AC_ARG_WITH(launchagents-dir, AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
[ launchagentsdir="${withval}" ],
[ launchagentsdir="/Library/LaunchAgents" ])
+AC_ARG_WITH(launchagent-xserver, AS_HELP_STRING([--with-launchagent-xserver=PATH], [Path to the X server which the LaunchAgent should start (if not provided, let startx decide)"]),
+ [ launchagentxserver="${withval}" ],
+ [ launchagentxserver="no" ])
AC_ARG_WITH(launchdaemons-dir, AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
[ launchdaemonsdir="${withval}" ],
[ launchdaemonsdir="/Library/LaunchDaemons" ])
@@ -126,17 +129,16 @@ if test "x$LAUNCHD" = "xyes" ; then
AC_CHECK_FUNC(dispatch_async,
AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
[])
-else
- launchagentsdir=""
- launchdaemonsdir=""
fi
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
AC_SUBST([launchagentsdir])
AC_SUBST([launchdaemonsdir])
AC_SUBST([bundleidprefix])
+AC_SUBST([launchagentxserver])
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
+AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XINIT, x11)
diff --git a/launchd/user_startx/Makefile.am b/launchd/user_startx/Makefile.am
index ce00e73..bf18fb0 100644
--- a/launchd/user_startx/Makefile.am
+++ b/launchd/user_startx/Makefile.am
@@ -36,6 +36,10 @@ CPP_FILES_FLAGS = \
-D__bindir__="$(bindir)" \
-DBUNDLE_ID_PREFIX="$(bundleidprefix)"
+if LAUNCHAGENT_XSERVER
+CPP_FILES_FLAGS += -DLAUNCHAGENT_XSERVER_PATH="$(launchagentxserver)"
+endif
+
$(bundleidprefix).startx.plist.cpp: startx.plist.cpp
cp $< $@
diff --git a/launchd/user_startx/startx.plist.cpp b/launchd/user_startx/startx.plist.cpp
index 9d9c1a4..a43025f 100644
--- a/launchd/user_startx/startx.plist.cpp
+++ b/launchd/user_startx/startx.plist.cpp
@@ -8,6 +8,10 @@
<array>
<string>__xinitrcdir__/launchd_startx</string>
<string>__bindir__/startx</string>
+#ifdef LAUNCHAGENT_XSERVER_PATH
+ <string>--</string>
+ <string>LAUNCHAGENT_XSERVER_PATH</string>
+#endif
</array>
<key>Sockets</key>
<dict>
commit 27be391123f5143fdccdfe975bf18bbff7517537
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Mon Oct 17 03:53:17 2011 -0700
startx: Choose an unused $DISPLAY by default on all platforms
Now everyone can benefit from this code that I previously added for darwin
https://bugs.freedesktop.org/show_bug.cgi?id=1789
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/startx.cpp b/startx.cpp
index 9f6561d..9135da8 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -130,6 +130,11 @@ if defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
fi
+#else
+enable_xauth=1
+#endif
+
+XCOMM Automatically determine an unused $DISPLAY
d=0
while true ; do
[ -e /tmp/.X$d-lock ] || break
@@ -138,10 +143,6 @@ done
defaultdisplay=":$d"
unset d
-#else
-enable_xauth=1
-#endif
-
#if defined(__SCO__) || defined(__UNIXWARE__)
XCOMM SCO -t option: do not start an X server
commit 45cc81cd7abafe61bddb3ddce9f4fb8a9aa06c12
Author: Julien Cristau <jcristau@debian.org>
Date: Thu Sep 8 22:11:15 2011 +0200
Include <sys/time.h> and <sys/resource.h> unconditionally
Suggested by Mark Kettenis.
X.Org bug#40632 <https://bugs.freedesktop.org/show_bug.cgi?id=40632>
Signed-off-by: Julien Cristau <jcristau@debian.org>
diff --git a/xinit.c b/xinit.c
index 42ff008..2ab817f 100644
--- a/xinit.c
+++ b/xinit.c
@@ -49,10 +49,8 @@ in this Software without prior written authorization from The Open Group.
#endif
/* For PRIO_PROCESS and setpriority() */
-#ifdef __DragonFly__
#include <sys/time.h>
#include <sys/resource.h>
-#endif /* __DragonFly__ */
#include <stdlib.h>
commit 727706ffda344a1a752df296cd230ff3fb3940a5
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sun Jul 31 09:11:01 2011 -0700
darwin: Buildfix for Tiger which doesn't have posix_spawn
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/launchd/user_startx/launchd_startx.c b/launchd/user_startx/launchd_startx.c
index e3fae76..f83cd61 100644
--- a/launchd/user_startx/launchd_startx.c
+++ b/launchd/user_startx/launchd_startx.c
@@ -34,11 +34,19 @@
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <spawn.h>
#include <sys/wait.h>
#include <string.h>
#include <stdlib.h>
+/* Using MIN_REQUIRED instead of MAX_ALLOWED logic due to posix_spawn not
+ * being marked with availability macros until 10.7
+ */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+#include <spawn.h>
+#else
+#include <errno.h>
+#endif
+
#include "console_redirect.h"
int main(int argc, char **argv, char **envp) {
@@ -56,7 +64,19 @@ int main(int argc, char **argv, char **envp) {
xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0);
+#else
+ switch(child = fork()) {
+ case -1:
+ perror("fork");
+ return errno;
+ case 0:
+ return execvp(argv[1], &argv[1]);
+ default:
+ break;
+ }
+#endif
wait4(child, &pstat, 0, (struct rusage *)0);
Reply to: