summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/seat-local.c18
-rw-r--r--tests/scripts/multi-seat-wayland.conf5
2 files changed, 23 insertions, 0 deletions
diff --git a/src/seat-local.c b/src/seat-local.c
index 90bb1455..65207145 100644
--- a/src/seat-local.c
+++ b/src/seat-local.c
@@ -261,6 +261,24 @@ seat_local_set_active_session (Seat *seat, Session *session)
static Session *
seat_local_get_active_session (Seat *seat)
{
+ /*
+ * In the past, virtual terminal switching was the only way to switch
+ * between multiple sessions associated with a seat. Due to operating
+ * system limitations, virtual terminal switching is limited to seat0, so
+ * the vt_* family of functions from vt.h must only be used with seat0.
+ *
+ * Nowadays, systemd-logind (via the org.freedesktop.login1 dbus interface)
+ * can be used to switch sessions. logind supports multiple sessions even
+ * on non-seat0 seats. Whenever logind switches sessions, a callback
+ * updates priv->active_session, so seat_get_expected_active_session should
+ * always return the currently active session.
+ *
+ * FIXME: Use seat_get_expected_active_session even for seat0, falling back
+ * to VT probing if the systemd-logind service is unavailable.
+ */
+ if (strcmp (seat_get_name (seat), "seat0") != 0)
+ return seat_get_expected_active_session (seat);
+
gint vt = vt_get_active ();
if (vt < 0)
return NULL;
diff --git a/tests/scripts/multi-seat-wayland.conf b/tests/scripts/multi-seat-wayland.conf
index a9b6871c..a3356214 100644
--- a/tests/scripts/multi-seat-wayland.conf
+++ b/tests/scripts/multi-seat-wayland.conf
@@ -42,6 +42,11 @@ user-session=wayland
#?SESSION-WAYLAND START XDG_SEAT=seat1 XDG_GREETER_DATA_DIR=.*/no-password2 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=wayland USER=no-password2
#?LOGIN1 ACTIVATE-SESSION SESSION=c2
+# Ensure that the X server and greeter for seat1 are not restarted until after
+# the user logs out.
+#?*WAIT
+#?*FENCE
+
# Log out. The X server and greeter for seat1 should start again.
#?*SESSION-WAYLAND LOGOUT
#?XSERVER-1 START SEAT=seat1