From 6b09f66d8c6ebcee70382b5cca1ba82b68f20afa Mon Sep 17 00:00:00 2001 From: "Pierre-Loup A. Griffais" Date: Fri, 2 Apr 2010 12:48:21 -0700 Subject: [PATCH 1/8] Don't keep a pointer to a possibly freed cursor when changing screens, preventing a crash in xf86CursorEnableDisableFBAccess() trying to restore it. Signed-off-by: Pierre-Loup A. Griffais Signed-off-by: Peter Hutterer --- hw/xfree86/ramdac/xf86Cursor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index 7f23d9ef3..f5f087314 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -312,6 +312,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } + ScreenPriv->CurrentCursor = NullCursor; return; } From c8a608cb6ce8f9c86258c1ab49084f691fa9cc51 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 7 Apr 2010 10:04:38 +1000 Subject: [PATCH 2/8] config: only match sane devices in 10-evdev.conf Having a generic catchall also adds devices like accelerometers. These devices make X unusable, hence restrict matching to "known sane" devices like pointers, touchpads, keyboards, tablets and touchscreens. Signed-off-by: Peter Hutterer Acked-by: Julien Cristau Acked-by: Dan Nicholson Acked-by: James Cloos --- config/10-evdev.conf | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/config/10-evdev.conf b/config/10-evdev.conf index 7406f4ef2..cc83ab232 100644 --- a/config/10-evdev.conf +++ b/config/10-evdev.conf @@ -1,8 +1,40 @@ # # Catch-all evdev loader for udev-based systems -# +# We don't simply match on any device since that also adds accelerometers +# and other devices that we don't really want to use. The list below +# matches everything but joysticks. + Section "InputClass" - Identifier "evdev-catchall" - Driver "evdev" + Identifier "evdev pointer catchall" + MatchIsPointer "on" MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev keyboard catchall" + MatchIsKeyboard "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev tablet catchall" + MatchIsTablet "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev touchscreen catchall" + MatchIsTouchscreen "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" EndSection From 2460e921d18fd264e6f6374be0908f4100442650 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 3 Apr 2010 09:33:47 -0700 Subject: [PATCH 3/8] xfree86: Allow adding sysconfdir and datadir to config search paths We could just use $projectroot/etc and $projectroot/share, but the user might have other plans for them. Signed-off-by: Dan Nicholson Signed-off-by: Peter Hutterer --- hw/xfree86/parser/Makefile.am | 4 +++- hw/xfree86/parser/scan.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am index 49c191f2a..caf7079d4 100644 --- a/hw/xfree86/parser/Makefile.am +++ b/hw/xfree86/parser/Makefile.am @@ -34,7 +34,9 @@ libxf86config_a_SOURCES = \ $(INTERNAL_SOURCES) libxf86config_a_CFLAGS = $(AM_CFLAGS) -AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DDATADIR=\"$(datadir)\" EXTRA_DIST = \ Configint.h \ diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index cdca9ca1c..8aab0cf41 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -599,6 +599,8 @@ xf86pathIsSafe(const char *path) * %F config file environment ($XORGCONFIG) as a relative path * %G config file environment ($XORGCONFIG) as a safe path * %P projroot + * %C sysconfdir + * %D datadir * %M major version number * %% % */ @@ -615,6 +617,12 @@ xf86pathIsSafe(const char *path) #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif +#ifndef SYSCONFDIR +#define SYSCONFDIR PROJECTROOT "/etc" +#endif +#ifndef DATADIR +#define DATADIR PROJECTROOT "/share" +#endif #ifndef XCONFENV #define XCONFENV "XORGCONFIG" #endif @@ -755,6 +763,12 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot, else BAIL_OUT; break; + case 'C': + APPEND_STR(SYSCONFDIR); + break; + case 'D': + APPEND_STR(DATADIR); + break; case 'M': if (!majorvers[0]) { if (XF86_VERSION_MAJOR < 0 || XF86_VERSION_MAJOR > 99) { From 2ac33888a9a5766aaf88bc92a8bd1d489873524c Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 3 Apr 2010 09:33:48 -0700 Subject: [PATCH 4/8] xfree86: Document how -configdir affects the xorg.conf.d search path Explain the "safe" path dance for -configdir, too. Signed-off-by: Dan Nicholson Signed-off-by: Peter Hutterer --- hw/xfree86/doc/man/xorg.conf.man.pre | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 93c8ac41d..9a40ce33f 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -102,10 +102,12 @@ is the machine's hostname as reported by .BR gethostname (__libmansuffix__). .PP Additional configuration files are searched for in the following -directories: +directories when the server is started as a normal user: .PP .RS 4 .nf +.IR /etc/X11/ +.IR __projectroot__/etc/X11/ .I /etc/X11/__xconfigdir__\-4 .I /etc/X11/__xconfigdir__ .I /etc/__xconfigdir__ @@ -118,6 +120,38 @@ directories: .fi .RE .PP +where +.I +is a relative path (with no \(lq..\(rq components) specified with the +.B \-configdir +command line option. +.PP +When the __xservername__ server is started by the \(lqroot\(rq user, the +config directory search locations are as follows: +.PP +.RS 4 +.nf + +.IR /etc/X11/ +.IR __projectroot__/etc/X11/ +.I /etc/X11/__xconfigdir__\-4 +.I /etc/X11/__xconfigdir__ +.I /etc/__xconfigdir__ +.IR __projectroot__/etc/X11/__xconfigdir__. +.I __projectroot__/etc/X11/__xconfigdir__\-4 +.I __projectroot__/etc/X11/__xconfigdir__ +.IR __projectroot__/lib/X11/__xconfigdir__. +.I __projectroot__/lib/X11/__xconfigdir__\-4 +.I __projectroot__/lib/X11/__xconfigdir__ +.fi +.RE +.PP +where +.I +is the path specified with the +.B \-configdir +command line option (which may be absolute or relative). +.PP The .I __xconfigfile__ and From a1bae63dc634a5a79861eab128c63506081f7ed9 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 3 Apr 2010 09:33:49 -0700 Subject: [PATCH 5/8] xfree86: Set a saner search path for xorg.conf.d There's no reason to carry all the oddities from xorg.conf like appended hostname to the search path for xorg.conf.d. This changes it to something very simple: /etc/X11/ $sysconfdir/X11/ /etc/X11/xorg.conf.d $sysconfdir/X11/xorg.conf.d Signed-off-by: Dan Nicholson Signed-off-by: Peter Hutterer --- cpprules.in | 1 + hw/xfree86/common/xf86Config.c | 16 ++++------------ hw/xfree86/doc/man/xorg.conf.man.pre | 22 ++++------------------ 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/cpprules.in b/cpprules.in index 301305e58..6e435785a 100644 --- a/cpprules.in +++ b/cpprules.in @@ -34,6 +34,7 @@ MANDEFS = \ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \ -D__mandir__=$(mandir) \ -D__projectroot__=$(prefix) \ + -D__sysconfdir__=$(sysconfdir) \ -D__datadir__=$(datadir) \ -D__xconfigfile__=$(__XCONFIGFILE__) \ -D__xconfigdir__=$(__XCONFIGDIR__) \ diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 718a07860..d02c22ac1 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -97,20 +97,12 @@ extern DeviceAssocRec mouse_assoc; #endif #ifndef ROOT_CONFIGDIRPATH #define ROOT_CONFIGDIRPATH "%A," "%R," \ - "/etc/X11/%R," "%P/etc/X11/%R," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" + "/etc/X11/%R," "%C/X11/%R," \ + "/etc/X11/%X," "%C/X11/%X" #endif #ifndef USER_CONFIGDIRPATH -#define USER_CONFIGDIRPATH "/etc/X11/%S," "%P/etc/X11/%S," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" +#define USER_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ + "/etc/X11/%X," "%C/X11/%X" #endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 9a40ce33f..acfa1caa6 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -107,16 +107,9 @@ directories when the server is started as a normal user: .RS 4 .nf .IR /etc/X11/ -.IR __projectroot__/etc/X11/ -.I /etc/X11/__xconfigdir__\-4 +.IR __sysconfdir__/X11/ .I /etc/X11/__xconfigdir__ -.I /etc/__xconfigdir__ -.IR __projectroot__/etc/X11/__xconfigdir__. -.I __projectroot__/etc/X11/__xconfigdir__\-4 -.I __projectroot__/etc/X11/__xconfigdir__ -.IR __projectroot__/lib/X11/__xconfigdir__. -.I __projectroot__/lib/X11/__xconfigdir__\-4 -.I __projectroot__/lib/X11/__xconfigdir__ +.I __sysconfdir__/X11/__xconfigdir__ .fi .RE .PP @@ -133,16 +126,9 @@ config directory search locations are as follows: .nf .IR /etc/X11/ -.IR __projectroot__/etc/X11/ -.I /etc/X11/__xconfigdir__\-4 +.IR __sysconfdir__/X11/ .I /etc/X11/__xconfigdir__ -.I /etc/__xconfigdir__ -.IR __projectroot__/etc/X11/__xconfigdir__. -.I __projectroot__/etc/X11/__xconfigdir__\-4 -.I __projectroot__/etc/X11/__xconfigdir__ -.IR __projectroot__/lib/X11/__xconfigdir__. -.I __projectroot__/lib/X11/__xconfigdir__\-4 -.I __projectroot__/lib/X11/__xconfigdir__ +.I __sysconfdir__/X11/__xconfigdir__ .fi .RE .PP From 95f01bdfee8241371675f0089170fa6b2908d815 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 3 Apr 2010 10:08:25 -0700 Subject: [PATCH 6/8] xfree86: Search for a system xorg.conf.d In addition to the conf files found in /etc/X11 or $sysconfdir/X11 used for local administration, we also reserve a system directory for vendor and package usage. The simple search path is: /usr/share/X11/xorg.conf.d $datadir/X11/xorg.conf.d Files from these directories will have the lowest config priority. The directory $datadir/X11/xorg.conf.d is exported from xorg-server.pc in the variable "sysconfigdir". Packages should install their .conf files to the directory specified by: `pkg-config --variable=sysconfigdir xorg-server` Signed-off-by: Dan Nicholson Signed-off-by: Peter Hutterer --- configure.ac | 2 ++ hw/xfree86/common/xf86Config.c | 12 ++++++++++-- hw/xfree86/doc/man/xorg.conf.man.pre | 12 ++++++++++++ xorg-server.pc.in | 2 ++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 591d2b445..0d0dffdec 100644 --- a/configure.ac +++ b/configure.ac @@ -1792,8 +1792,10 @@ if test "x$XORG" = xyes; then AC_SUBST([driverdir]) sdkdir="$includedir/xorg" extdir="$includedir/X11/extensions" + sysconfigdir="$datadir/X11/$XF86CONFIGDIR" AC_SUBST([sdkdir]) AC_SUBST([extdir]) + AC_SUBST([sysconfigdir]) AC_SUBST([logdir]) # stuff the ABI versions into the pc file too diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index d02c22ac1..1e9543fa2 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -104,6 +104,9 @@ extern DeviceAssocRec mouse_assoc; #define USER_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ "/etc/X11/%X," "%C/X11/%X" #endif +#ifndef SYS_CONFIGDIRPATH +#define SYS_CONFIGDIRPATH "/usr/share/X11/%X," "%D/X11/%X" +#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -2421,7 +2424,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) { ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - const char *filename, *dirname; + const char *filename, *dirname, *sysdirname; char *filesearch, *dirsearch; MessageType filefrom = X_DEFAULT; MessageType dirfrom = X_DEFAULT; @@ -2444,6 +2447,8 @@ xf86HandleConfigFile(Bool autoconfig) dirfrom = X_CMDLINE; xf86initConfigFiles(); + sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL, + PROJECTROOT); dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT); filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT); if (filename) { @@ -2464,7 +2469,10 @@ xf86HandleConfigFile(Bool autoconfig) "Unable to locate/open config directory: \"%s\"\n", xf86ConfigDir); } - if (!filename && !dirname) + if (sysdirname) + xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n", + sysdirname); + if (!filename && !dirname && !sysdirname) return CONFIG_NOFILE; } diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index acfa1caa6..4782d61ba 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -138,6 +138,18 @@ is the path specified with the .B \-configdir command line option (which may be absolute or relative). .PP +Finally, configuration files will also be searched for in directories +reserved for system use. These are to separate configuration files from +the vendor or 3rd party packages from those of local administration. +These files are found in the following directories: +.PP +.RS 4 +.nf +.I /usr/share/X11/__xconfigdir__ +.I __datadir__/X11/__xconfigdir__ +.fi +.RE +.PP The .I __xconfigfile__ and diff --git a/xorg-server.pc.in b/xorg-server.pc.in index 3d58dabbf..376cb933d 100644 --- a/xorg-server.pc.in +++ b/xorg-server.pc.in @@ -2,8 +2,10 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ +datarootdir=@datarootdir@ moduledir=@moduledir@ sdkdir=@sdkdir@ +sysconfigdir=@sysconfigdir@ abi_ansic=@abi_ansic@ abi_videodrv=@abi_videodrv@ From d4dd3d0085f8eaca8c989aaeace1a1a24c5ebf49 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 3 Apr 2010 09:33:51 -0700 Subject: [PATCH 7/8] Move 10-evdev.conf to system config dir $datadir/X11/xorg.conf.d Since the server searches in a vendor specific path now, we can install the evdev catchall there without disturbing local administration files. Signed-off-by: Dan Nicholson Signed-off-by: Peter Hutterer --- config/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Makefile.am b/config/Makefile.am index eed745483..675a3b260 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -9,7 +9,7 @@ AM_CFLAGS += $(UDEV_CFLAGS) libconfig_la_SOURCES += udev.c libconfig_la_LIBADD = $(UDEV_LIBS) -xorgconfddir = $(prefix)/etc/X11/$(XF86CONFIGDIR) +xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) xorgconfd_DATA = 10-evdev.conf else From 03ccbd2579948d11e5f16f88cdf68a55f57c9d26 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 8 Apr 2010 13:47:26 +1000 Subject: [PATCH 8/8] xfree86: remove dead input drivers from xorg.conf man page. These drivers have been deactivated for over a year now, let's not refer potential users to them. Signed-off-by: Peter Hutterer --- hw/xfree86/doc/man/xorg.conf.man.pre | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 4782d61ba..f7ff6f617 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -2405,25 +2405,16 @@ Display drivers: .PP Input drivers: .BR acecad (__drivermansuffix__), -.BR calcomp (__drivermansuffix__), .BR citron (__drivermansuffix__), -.BR dmc (__drivermansuffix__), -.BR dynapro (__drivermansuffix__), .BR elographics (__drivermansuffix__), .BR evdev (__drivermansuffix__), .BR fpit (__drivermansuffix__), -.BR js_x (__drivermansuffix__), .BR joystick (__drivermansuffix__), .BR kbd (__drivermansuffix__), -.BR magictouch (__drivermansuffix__), -.BR microtouch (__drivermansuffix__), .BR mousedrv (__drivermansuffix__), .BR mutouch (__drivermansuffix__), -.BR palmax (__drivermansuffix__), .BR penmount (__drivermansuffix__), .BR synaptics (__drivermansuffix__), -.BR tek4957 (__drivermansuffix__), -.BR ur98 (__drivermansuffix__), .BR vmmouse (__drivermansuffix__), .BR void (__drivermansuffix__), .BR wacom (__drivermansuffix__).