summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-04-03 10:44:28 -0700
committerKeith Packard <keithp@keithp.com>2014-04-03 10:44:28 -0700
commit84f977467b514af88019ab2791bf7a74530b54df (patch)
tree8241ec207cd077a027ac1d73341daf4311657dd7
parent9d20d18fb9dcc74bfa5392a2da40fd41b3e640d3 (diff)
parent98924719d524bf87cdf301063cd744d1271c33ff (diff)
Merge remote-tracking branch 'whot/for-keith'
-rw-r--r--configure.ac13
-rw-r--r--hw/xfree86/.gitignore1
-rw-r--r--hw/xfree86/Makefile.am3
-rw-r--r--hw/xfree86/common/xf86Globals.c2
-rw-r--r--hw/xfree86/common/xf86Helper.c31
-rw-r--r--hw/xfree86/man/Xorg.man6
-rw-r--r--hw/xfree86/man/xorg.conf.man6
-rw-r--r--hw/xfree86/os-support/linux/systemd-logind.c34
-rw-r--r--include/xorg-config.h.in11
-rw-r--r--include/xwin-config.h.in3
-rw-r--r--xkb/xkbAccessX.c2
11 files changed, 95 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index f589d6d74..c31c7fd61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -624,8 +624,8 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
-AC_ARG_ENABLE(systemd-logind, AC_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
-AC_ARG_ENABLE(suid-wrapper, AC_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
+AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
+AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@@ -2042,7 +2042,9 @@ if test "x$XORG" = xyes; then
XF86CONFIGDIR="xorg.conf.d"
AC_SUBST(XF86CONFIGDIR)
CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
- LOGPREFIX="$logdir/Xorg."
+ LOGPREFIX="Xorg."
+ XDG_DATA_HOME=".local/share"
+ XDG_DATA_HOME_LOGDIR="xorg"
AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
@@ -2055,7 +2057,10 @@ if test "x$XORG" = xyes; then
AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
- AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
+ AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
+ AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
+ AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME])
+ AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
if test "x$VGAHW" = xyes; then
AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
diff --git a/hw/xfree86/.gitignore b/hw/xfree86/.gitignore
index 997a94efe..fb6830b2c 100644
--- a/hw/xfree86/.gitignore
+++ b/hw/xfree86/.gitignore
@@ -1,4 +1,5 @@
Xorg
+Xorg.sh
xorg.conf.example
sdksyms.c
sdksyms.dep
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 18fa99b08..c5992c372 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -89,7 +89,7 @@ endif
BUILT_SOURCES = xorg.conf.example
DISTCLEANFILES = xorg.conf.example
-EXTRA_DIST = xorgconf.cpp Xorg.sh.in
+EXTRA_DIST = xorgconf.cpp
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
@@ -105,6 +105,7 @@ if INSTALL_SETUID
chmod u+s $(DESTDIR)$(bindir)/Xorg
endif
if SUID_WRAPPER
+ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin
${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
-chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 7df7a80c4..984c39bca 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL;
const char *xf86ConfigDir = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH;
MessageType xf86ModPathFrom = X_DEFAULT;
-const char *xf86LogFile = DEFAULT_LOGPREFIX;
+const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE;
serverLayoutRec xf86ConfigLayout = { NULL, };
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 12a877159..e2b32a074 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1217,16 +1217,45 @@ xf86ErrorF(const char *format, ...)
va_end(ap);
}
+/* Note temporarily modifies the passed in buffer! */
+static void xf86_mkdir_p(char *path)
+{
+ char *sep = path;
+
+ while ((sep = strchr(sep + 1, '/'))) {
+ *sep = 0;
+ (void)mkdir(path, 0777);
+ *sep = '/';
+ }
+ (void)mkdir(path, 0777);
+}
+
void
xf86LogInit(void)
{
- char *lf = NULL;
+ char *env, *lf = NULL;
+ char buf[PATH_MAX];
#define LOGSUFFIX ".log"
#define LOGOLDSUFFIX ".old"
/* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) {
+ /* When not running as root, we won't be able to write to /var/log */
+ if (geteuid() != 0) {
+ if ((env = getenv("XDG_DATA_HOME")))
+ snprintf(buf, sizeof(buf), "%s/%s", env,
+ DEFAULT_XDG_DATA_HOME_LOGDIR);
+ else if ((env = getenv("HOME")))
+ snprintf(buf, sizeof(buf), "%s/%s/%s", env,
+ DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR);
+
+ if (env) {
+ xf86_mkdir_p(buf);
+ strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf));
+ xf86LogFile = buf;
+ }
+ }
/* Append the display number and ".log" */
if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
FatalError("Cannot allocate space for the log file name\n");
diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index 0cd5a1068..3ff6aef89 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -301,9 +301,11 @@ Use the file called
.I filename
as the
.B Xorg
-server log file. The default log file is
+server log file. The default log file when running as root is
.BI __logdir__/Xorg. n .log
-on most platforms, where
+and for non root it is
+.BI $XDG_DATA_HOME/xorg/Xorg. n .log
+where
.I n
is the display number of the
.B Xorg
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 85f9f2ee1..6d2652e84 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -442,11 +442,15 @@ __modulepath__
.TP 7
.BI "LogFile \*q" path \*q
sets the name of the Xorg server log file.
-The default log file name is
+The default log file name when running as root is
.PP
.RS 11
.RI __logdir__/Xorg. <n> .log
.RE
+and for non root it is
+.RS 11
+.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log
+.RE
.PP
.RS 7
where
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 62858b062..ed670a88c 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -310,10 +310,31 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
dbus_int32_t major, minor;
char *pause_str;
- if (strcmp(dbus_message_get_path(message), info->session) != 0)
+ dbus_error_init(&error);
+
+ if (dbus_message_is_signal(message,
+ "org.freedesktop.DBus", "NameOwnerChanged")) {
+ char *name, *old_owner, *new_owner;
+
+ dbus_message_get_args(message, &error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &old_owner,
+ DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
+ if (dbus_error_is_set(&error)) {
+ LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
+ error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (name && strcmp(name, "org.freedesktop.login1") == 0)
+ FatalError("systemd-logind disappeared (stopped/restarted?)\n");
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
- dbus_error_init(&error);
+ if (strcmp(dbus_message_get_path(message), info->session) != 0)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
"PauseDevice")) {
@@ -472,6 +493,15 @@ connect_hook(DBusConnection *connection, void *data)
goto cleanup;
}
+ dbus_bus_add_match(connection,
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'",
+ &error);
+ if (dbus_error_is_set(&error)) {
+ LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n",
+ error.message);
+ goto cleanup;
+ }
+
/*
* HdG: This is not useful with systemd <= 208 since the signal only
* contains invalidated property names there, rather than property, val
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 77a1aae55..629ae4057 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -45,9 +45,18 @@
/* Path to installed libraries. */
#undef DEFAULT_LIBRARY_PATH
-/* Path to server log file. */
+/* Default log location */
+#undef DEFAULT_LOGDIR
+
+/* Default logfile prefix */
#undef DEFAULT_LOGPREFIX
+/* Default XDG_DATA dir under HOME */
+#undef DEFAULT_XDG_DATA_HOME
+
+/* Default log dir under XDG_DATA_HOME */
+#undef DEFAULT_XDG_DATA_HOME_LOGDIR
+
/* Building DRI-capable DDX. */
#undef XF86DRI
diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 176c01980..a5e6b17b3 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -26,8 +26,5 @@
/* Vendor web address for support */
#undef __VENDORDWEBSUPPORT__
-/* Default log location */
-#undef DEFAULT_LOGDIR
-
/* Whether we should re-locate the root to where the executable lives */
#undef RELOCATE_PROJECTROOT
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index cb4bca008..5f3de0d9e 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -711,7 +711,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event;
- dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
+ dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
if (dev && dev->key) {
xkbi = dev->key->xkbInfo;