summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Taylor <rob.taylor@codethink.co.uk>2007-09-13 12:14:40 +0100
committerRob Taylor <rob.taylor@codethink.co.uk>2007-09-13 12:17:00 +0100
commitf3e2735d7d2a1dcc9a6cff9cdadba79446c5dd7d (patch)
tree1b8e7767e0a32c4daee9a36882f3d82eb2e01c0e
parentdcd3cd3922cff75d4d1314529be560e8d3171d15 (diff)
add --without-xauth configure option
Allow single-user-devices to be configured --without-xauth, which tells ohm that it can connect to the xserver without needing an .Xauthority.
-rw-r--r--configure.in16
-rw-r--r--plugins/glue/xorg/ohm-plugin-xorg.c16
2 files changed, 26 insertions, 6 deletions
diff --git a/configure.in b/configure.in
index 9eda015..1a4ecdd 100644
--- a/configure.in
+++ b/configure.in
@@ -118,16 +118,26 @@ single_user_device="yes"
if test "$single_user_device" = yes; then
AC_DEFINE(OHM_SINGLE_USER_DEVICE, 1, [Whether OHM is built for a single-user device with a known .Xauthority location])
+ AC_ARG_WITH(xauth,
+ [AC_HELP_STRING([--without-xauth],
+ [Whether xauth is needed to access the Xserver.]
+ )],
+ [with_xauth="$withval"], [with_xauth="yes"]
+ )
+
+
AC_ARG_WITH(xauth-dir,
[AC_HELP_STRING([--with-xauth-dir=<dir>],
[directory where we can find .Xauthority (for single-user device)]
)]
)
- if test -z "$with_xauth_dir"; then
- AC_MSG_ERROR([Must use --with-xauth-dir for a single-user device])
+ if test "x$with_xauth" = "xno"; then
+ AC_DEFINE(OHM_DEVICE_NO_XAUTH, 1, [No Xauth needed for Xserver access])
+ elif test -z "$with_xauth_dir"; then
+ AC_MSG_ERROR([Must use --without-xauth or --with-xauth-dir for a single-user device])
else
- AC_DEFINE(OHM_DEVICE_XAUTH_DIR, "$xauth_dir", [Where to find .Xauthority])
+ AC_DEFINE_UNQUOTED(OHM_DEVICE_XAUTH_DIR, "$with_xauth_dir", [Where to find .Xauthority])
fi
fi
diff --git a/plugins/glue/xorg/ohm-plugin-xorg.c b/plugins/glue/xorg/ohm-plugin-xorg.c
index 28b3f1a..3bca47b 100644
--- a/plugins/glue/xorg/ohm-plugin-xorg.c
+++ b/plugins/glue/xorg/ohm-plugin-xorg.c
@@ -32,10 +32,13 @@ static gboolean
plugin_poll_startup (gpointer data)
{
OhmPlugin *plugin = (OhmPlugin *) data;
+
+#ifdef OHM_SINGLE_USER_DEVICE
+#ifndef OHM_DEVICE_NO_XAUTH
+
gboolean ret;
const gchar *xauth;
-#ifdef OHM_SINGLE_USER_DEVICE
xauth = OHM_DEVICE_XAUTH_DIR "/.Xauthority";
g_debug ("xorg: testing %s", xauth);
ret = g_file_test (xauth, G_FILE_TEST_EXISTS);
@@ -53,14 +56,21 @@ plugin_poll_startup (gpointer data)
g_debug ("xorg: no .Xauthority found");
return TRUE;
}
+ setenv ("XAUTHORITY", xauth, 1);
+ g_debug ("Using XAUTHORITY %s", xauth);
+#else
+ g_debug ("Not using XAuth");
+#endif
+
#else
#error ConsoleKit support not yet implemented
#endif
+
+ setenv ("DISPLAY", ":0", 1);
+
/* woot! X is alive */
g_debug ("Got X!");
ohm_plugin_conf_set_key (plugin, "xorg.has_xauthority", 1);
- setenv ("XAUTHORITY", xauth, 1);
- setenv ("DISPLAY", ":0", 1);
/* we don't need to poll anymore */
return FALSE;
}