[xorg-x11-server] Add support for multi-seat support from the config/udev backend.

Peter Hutterer whot at fedoraproject.org
Wed Jul 27 04:13:25 UTC 2011


commit 37aa2d689a446716c1259ef1afe81168fc30ce59
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jul 27 14:13:05 2011 +1000

    Add support for multi-seat support from the config/udev backend.

 xorg-x11-server.spec                               |   10 +-
 ...onfig-add-udev-systemd-multi-seat-support.patch |  223 ++++++++++++++++++++
 2 files changed, 232 insertions(+), 1 deletions(-)
---
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 3e2e241..5caefe2 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -30,7 +30,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.10.99.1
-Release:   8%{?gitdate:.%{gitdate}}%{dist}
+Release:   9%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -86,6 +86,11 @@ Patch7006: xserver-1.10-pointer-barriers.patch
 # tests require Xorg
 Patch7007: xserver-1.10.99.1-test.patch
 
+# Multi-seat support through config/udev backend.
+# Submitted to upstream but not merged for 1.11
+Patch7009: xserver-1.10.99-config-add-udev-systemd-multi-seat-support.patch
+
+
 %define moduledir	%{_libdir}/xorg/modules
 %define drimoduledir	%{_libdir}/dri
 %define sdkdir		%{_includedir}/xorg
@@ -553,6 +558,9 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Wed Jul 27 2011 Peter Hutterer <peter.hutterer at redhat.com> 1.10.99.1-9.20110511
+- Add support for multi-seat support from the config/udev backend.
+
 * Wed Jun 29 2011 Dan Horák <dan[at]danny.cz> 1.10.99.1-8.20110511
 - don't build tests when --disable-xorg is used like on s390(x)
 
diff --git a/xserver-1.10.99-config-add-udev-systemd-multi-seat-support.patch b/xserver-1.10.99-config-add-udev-systemd-multi-seat-support.patch
new file mode 100644
index 0000000..f07fdba
--- /dev/null
+++ b/xserver-1.10.99-config-add-udev-systemd-multi-seat-support.patch
@@ -0,0 +1,223 @@
+From 8d9371f9035654cbb694ad51cf384a78b044bb9f Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart at poettering.net>
+Date: Mon, 18 Jul 2011 21:19:23 +0200
+Subject: [PATCH] config: add udev/systemd multi-seat support
+
+Add support for multi-seat-aware input device hotplugging. This
+implements the multi-seat scheme explained here:
+
+http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+This introduces a new X server switch "-seat" which allows configuration
+of the seat to enumerate hotplugging devices on. If specified the value
+of this parameter will also be exported as root window property
+Xorg_Seat.
+
+To properly support input hotplugging devices need to be tagged in udev
+according to the seat they are on. Untagged devices are assumed to be on
+the default seat "seat0". If no "-seat" parameter is passed only devices
+on "seat0" are used. This means that the new scheme is perfectly
+compatible with existing setups which have no tagged input devices.
+
+Note that the -seat switch takes a completely generic identifier, and
+that it has no effect on non-Linux systems. In fact, on other OSes a
+completely different identifier scheme for seats could be used but still
+be exposed with the Xorg_Seat and -seat.
+
+I tried to follow the coding style of the surrounding code blocks if
+there was any one could follow.
+
+Signed-off-by: Lennart Poettering <lennart at poettering.net>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+
+Conflicts:
+
+	config/udev.c
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ config/udev.c                |   19 +++++++++++++++++++
+ doc/man/Xserver.man          |    6 ++++++
+ hw/xfree86/common/xf86Init.c |   19 +++++++++++++++++++
+ include/globals.h            |    2 +-
+ include/xserver-properties.h |    3 +++
+ os/utils.c                   |   10 ++++++++++
+ 6 files changed, 58 insertions(+), 1 deletions(-)
+
+diff --git a/config/udev.c b/config/udev.c
+index 9ac34ee..ca978b0 100644
+--- a/config/udev.c
++++ b/config/udev.c
+@@ -35,6 +35,7 @@
+ #include "hotplug.h"
+ #include "config-backends.h"
+ #include "os.h"
++#include "globals.h"
+ 
+ #define UDEV_XKB_PROP_KEY "xkb"
+ 
+@@ -65,6 +66,7 @@ device_added(struct udev_device *udev_device)
+     struct udev_list_entry *set, *entry;
+     struct udev_device *parent;
+     int rc;
++    const char *dev_seat;
+ 
+     path = udev_device_get_devnode(udev_device);
+ 
+@@ -73,6 +75,16 @@ device_added(struct udev_device *udev_device)
+     if (!path || !syspath)
+         return;
+ 
++    dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
++    if (!dev_seat)
++        dev_seat = "seat0";
++
++    if (SeatId && strcmp(dev_seat, SeatId))
++        return;
++
++    if (!SeatId && strcmp(dev_seat, "seat0"))
++        return;
++
+     if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
+         LogMessageVerb(X_INFO, 10,
+                        "config/udev: ignoring device %s without "
+@@ -283,6 +295,9 @@ config_udev_init(void)
+     if (!udev_monitor)
+         return 0;
+ 
++    if (SeatId && strcmp(SeatId, "seat0"))
++        udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
++
+     if (udev_monitor_enable_receiving(udev_monitor)) {
+         ErrorF("config/udev: failed to bind the udev monitor\n");
+         return 0;
+@@ -291,6 +306,10 @@ config_udev_init(void)
+     enumerate = udev_enumerate_new(udev);
+     if (!enumerate)
+         return 0;
++
++    if (SeatId && strcmp(SeatId, "seat0"))
++        udev_enumerate_add_match_tag(enumerate, SeatId);
++
+     udev_enumerate_scan_devices(enumerate);
+     devices = udev_enumerate_get_list_entry(enumerate);
+     udev_list_entry_foreach(device, devices) {
+diff --git a/doc/man/Xserver.man b/doc/man/Xserver.man
+index b725949..8d23894 100644
+--- a/doc/man/Xserver.man
++++ b/doc/man/Xserver.man
+@@ -220,6 +220,12 @@ sets screen-saver timeout time in minutes.
+ .B \-su
+ disables save under support on all screens.
+ .TP 8
++.B \-seat \fIseat\fP
++seat to run on. Takes a string identifying a seat in a platform
++specific syntax. On platforms which support this feature this may be
++used to limit the server to expose only a specific subset of devices
++connected to the system.
++.TP 8
+ .B \-t \fInumber\fP
+ sets pointer acceleration threshold in pixels (i.e. after how many pixels
+ pointer acceleration should take effect).
+diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
+index 0b36163..6dbbd77 100644
+--- a/hw/xfree86/common/xf86Init.c
++++ b/hw/xfree86/common/xf86Init.c
+@@ -80,6 +80,7 @@
+ #include "xf86Bus.h"
+ #include "xf86VGAarbiter.h"
+ #include "globals.h"
++#include "xserver-properties.h"
+ 
+ #ifdef DPMSExtension
+ #include <X11/extensions/dpmsconst.h>
+@@ -654,6 +655,24 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+       }
+     }
+ 
++    if (SeatId) {
++        Atom SeatAtom;
++
++        SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
++
++        for (i = 0; i < xf86NumScreens; i++) {
++            int ret;
++
++            ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
++                                                 SeatAtom, XA_STRING, 8,
++                                                 strlen(SeatId)+1, SeatId );
++            if (ret != Success) {
++                xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
++                           "Failed to register seat property\n");
++            }
++        }
++    }
++
+     /* If a screen uses depth 24, show what the pixmap format is */
+     for (i = 0; i < xf86NumScreens; i++) {
+ 	if (xf86Screens[i]->depth == 24) {
+diff --git a/include/globals.h b/include/globals.h
+index 8b80a65..17bca82 100644
+--- a/include/globals.h
++++ b/include/globals.h
+@@ -21,7 +21,7 @@ extern _X_EXPORT int defaultColorVisualClass;
+ 
+ extern _X_EXPORT int GrabInProgress;
+ extern _X_EXPORT Bool noTestExtensions;
+-
++extern _X_EXPORT char *SeatId;
+ extern _X_EXPORT char *ConnectionInfo;
+ 
+ #ifdef DPMSExtension
+diff --git a/include/xserver-properties.h b/include/xserver-properties.h
+index c6259ae..a0936a5 100644
+--- a/include/xserver-properties.h
++++ b/include/xserver-properties.h
+@@ -30,6 +30,9 @@
+  * byte-ordering. */
+ #define XATOM_FLOAT "FLOAT"
+ 
++/* STRING. Seat name of this display */
++#define SEAT_ATOM_NAME "Xorg_Seat"
++
+ /* BOOL. 0 - device disabled, 1 - device enabled */
+ #define XI_PROP_ENABLED      "Device Enabled"
+ /* BOOL. If present, device is a virtual XTEST device */
+diff --git a/os/utils.c b/os/utils.c
+index 36cb46f..e8ecb71 100644
+--- a/os/utils.c
++++ b/os/utils.c
+@@ -201,6 +201,8 @@ Bool PanoramiXExtensionDisabledHack = FALSE;
+ 
+ int auditTrailLevel = 1;
+ 
++char *SeatId = NULL;
++
+ #if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
+ #define HAS_SAVED_IDS_AND_SETEUID
+ #endif
+@@ -511,6 +513,7 @@ void UseMsg(void)
+     ErrorF("-render [default|mono|gray|color] set render color alloc policy\n");
+     ErrorF("-retro                 start with classic stipple and cursor\n");
+     ErrorF("-s #                   screen-saver timeout (minutes)\n");
++    ErrorF("-seat string           seat to run on\n");
+     ErrorF("-t #                   default pointer threshold (pixels/t)\n");
+     ErrorF("-terminate             terminate at server reset\n");
+     ErrorF("-to #                  connection time out\n");
+@@ -802,6 +805,13 @@ ProcessCommandLine(int argc, char *argv[])
+ 	    else
+ 		UseMsg();
+ 	}
++	else if ( strcmp( argv[i], "-seat") == 0)
++	{
++	    if(++i < argc)
++		SeatId = argv[i];
++	    else
++		UseMsg();
++	}
+ 	else if ( strcmp( argv[i], "-t") == 0)
+ 	{
+ 	    if(++i < argc)
+-- 
+1.7.6
+


More information about the scm-commits mailing list