Merge remote-tracking branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2014-04-03 10:44:28 -07:00
commit 84f977467b
11 changed files with 95 additions and 17 deletions

View File

@ -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(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_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(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(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, 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(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. dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) 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" XF86CONFIGDIR="xorg.conf.d"
AC_SUBST(XF86CONFIGDIR) AC_SUBST(XF86CONFIGDIR)
CONFIGFILE="$sysconfdir/$XF86CONFIGFILE" 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(XORG_SERVER, 1, [Building Xorg server])
AC_DEFINE(XORGSERVER, 1, [Building Xorg server]) AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
AC_DEFINE(XFree86Server, 1, [Building XFree86 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(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path]) 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_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]) AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
if test "x$VGAHW" = xyes; then if test "x$VGAHW" = xyes; then
AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module]) AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])

View File

@ -1,4 +1,5 @@
Xorg Xorg
Xorg.sh
xorg.conf.example xorg.conf.example
sdksyms.c sdksyms.c
sdksyms.dep sdksyms.dep

View File

@ -89,7 +89,7 @@ endif
BUILT_SOURCES = xorg.conf.example BUILT_SOURCES = xorg.conf.example
DISTCLEANFILES = 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 # Without logdir, X will post an error on the terminal and will not start
install-data-local: install-data-local:
@ -105,6 +105,7 @@ if INSTALL_SETUID
chmod u+s $(DESTDIR)$(bindir)/Xorg chmod u+s $(DESTDIR)$(bindir)/Xorg
endif endif
if SUID_WRAPPER if SUID_WRAPPER
$(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin
${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg ${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 -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap

View File

@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL;
const char *xf86ConfigDir = NULL; const char *xf86ConfigDir = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH; const char *xf86ModulePath = DEFAULT_MODULE_PATH;
MessageType xf86ModPathFrom = X_DEFAULT; MessageType xf86ModPathFrom = X_DEFAULT;
const char *xf86LogFile = DEFAULT_LOGPREFIX; const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT; MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE; Bool xf86LogFileWasOpened = FALSE;
serverLayoutRec xf86ConfigLayout = { NULL, }; serverLayoutRec xf86ConfigLayout = { NULL, };

View File

@ -1217,16 +1217,45 @@ xf86ErrorF(const char *format, ...)
va_end(ap); 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 void
xf86LogInit(void) xf86LogInit(void)
{ {
char *lf = NULL; char *env, *lf = NULL;
char buf[PATH_MAX];
#define LOGSUFFIX ".log" #define LOGSUFFIX ".log"
#define LOGOLDSUFFIX ".old" #define LOGOLDSUFFIX ".old"
/* Get the log file name */ /* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) { 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" */ /* Append the display number and ".log" */
if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1) if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
FatalError("Cannot allocate space for the log file name\n"); FatalError("Cannot allocate space for the log file name\n");

View File

@ -301,9 +301,11 @@ Use the file called
.I filename .I filename
as the as the
.B Xorg .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 .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 .I n
is the display number of the is the display number of the
.B Xorg .B Xorg

View File

@ -442,11 +442,15 @@ __modulepath__
.TP 7 .TP 7
.BI "LogFile \*q" path \*q .BI "LogFile \*q" path \*q
sets the name of the Xorg server log file. 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 .PP
.RS 11 .RS 11
.RI __logdir__/Xorg. <n> .log .RI __logdir__/Xorg. <n> .log
.RE .RE
and for non root it is
.RS 11
.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log
.RE
.PP .PP
.RS 7 .RS 7
where where

View File

@ -310,11 +310,32 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
dbus_int32_t major, minor; dbus_int32_t major, minor;
char *pause_str; char *pause_str;
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;
}
if (strcmp(dbus_message_get_path(message), info->session) != 0) if (strcmp(dbus_message_get_path(message), info->session) != 0)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
dbus_error_init(&error);
if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
"PauseDevice")) { "PauseDevice")) {
if (!dbus_message_get_args(message, &error, if (!dbus_message_get_args(message, &error,
@ -472,6 +493,15 @@ connect_hook(DBusConnection *connection, void *data)
goto cleanup; 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 * HdG: This is not useful with systemd <= 208 since the signal only
* contains invalidated property names there, rather than property, val * contains invalidated property names there, rather than property, val

View File

@ -45,9 +45,18 @@
/* Path to installed libraries. */ /* Path to installed libraries. */
#undef DEFAULT_LIBRARY_PATH #undef DEFAULT_LIBRARY_PATH
/* Path to server log file. */ /* Default log location */
#undef DEFAULT_LOGDIR
/* Default logfile prefix */
#undef DEFAULT_LOGPREFIX #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. */ /* Building DRI-capable DDX. */
#undef XF86DRI #undef XF86DRI

View File

@ -26,8 +26,5 @@
/* Vendor web address for support */ /* Vendor web address for support */
#undef __VENDORDWEBSUPPORT__ #undef __VENDORDWEBSUPPORT__
/* Default log location */
#undef DEFAULT_LOGDIR
/* Whether we should re-locate the root to where the executable lives */ /* Whether we should re-locate the root to where the executable lives */
#undef RELOCATE_PROJECTROOT #undef RELOCATE_PROJECTROOT

View File

@ -711,7 +711,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event; 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) { if (dev && dev->key) {
xkbi = dev->key->xkbInfo; xkbi = dev->key->xkbInfo;