summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2015-08-10 15:58:47 +1200
committerRobert Ancell <robert.ancell@canonical.com>2015-08-10 15:58:47 +1200
commit079bdde18c7a3d0a5751871704b05a0095ec74a1 (patch)
treea3c06d2c377c06545cc5d9f116664c101dff8dd0
parent0a33e905a363a9e820f2f67809a328099c62ec5b (diff)
parentae3bded5035ecad0076b9b38ae5cb6e3723f67c2 (diff)
downloadlightdm-079bdde18c7a3d0a5751871704b05a0095ec74a1.tar.gz
Support Wayland sessions
-rw-r--r--data/lightdm.conf2
-rw-r--r--liblightdm-gobject/Makefile.am3
-rw-r--r--liblightdm-gobject/session.c30
-rw-r--r--liblightdm-qt/Makefile.am3
-rw-r--r--src/Makefile.am5
-rw-r--r--src/seat-xlocal.c18
-rw-r--r--src/seat.c6
-rw-r--r--src/session-config.c4
-rw-r--r--src/session-config.h2
-rw-r--r--src/wayland-session.c106
-rw-r--r--src/wayland-session.h45
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/data/greeters/test-mir-greeter.desktop4
-rw-r--r--tests/data/greeters/test-wayland-greeter.desktop5
-rw-r--r--tests/data/sessions/wayland.desktop5
-rw-r--r--tests/scripts/wayland-autologin.conf19
-rw-r--r--tests/scripts/wayland-greeter.conf17
-rw-r--r--tests/scripts/wayland-session.conf46
-rw-r--r--tests/src/test-gobject-greeter.c5
-rw-r--r--tests/src/test-session.c2
-rwxr-xr-xtests/test-wayland-autologin2
-rwxr-xr-xtests/test-wayland-greeter2
-rwxr-xr-xtests/test-wayland-session2
23 files changed, 318 insertions, 23 deletions
diff --git a/data/lightdm.conf b/data/lightdm.conf
index 5dcc4ce9..72a4a908 100644
--- a/data/lightdm.conf
+++ b/data/lightdm.conf
@@ -28,7 +28,7 @@
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
-#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions
+#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions:/usr/share/wayland-sessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=/usr/share/lightdm/greeters:/usr/share/xgreeters
diff --git a/liblightdm-gobject/Makefile.am b/liblightdm-gobject/Makefile.am
index bb02275f..5db00557 100644
--- a/liblightdm-gobject/Makefile.am
+++ b/liblightdm-gobject/Makefile.am
@@ -8,7 +8,8 @@ liblightdm_gobject_1_la_CFLAGS = $(LIBLIGHTDM_GOBJECT_CFLAGS) \
$(WARN_CFLAGS) \
-I"$(top_srcdir)/common" \
-DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
- -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions\" \
+ -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions:$(datadir)/wayland-sessions\" \
+ -DWAYLAND_SESSIONS_DIR=\"$(datadir)/wayland-sessions\" \
-DREMOTE_SESSIONS_DIR=\"$(pkgdatadir)/remote-sessions\"
mainheader_HEADERS = lightdm.h
diff --git a/liblightdm-gobject/session.c b/liblightdm-gobject/session.c
index d635f330..9af02bc8 100644
--- a/liblightdm-gobject/session.c
+++ b/liblightdm-gobject/session.c
@@ -46,9 +46,9 @@ compare_session (gconstpointer a, gconstpointer b)
}
static LightDMSession *
-load_session (GKeyFile *key_file, const gchar *key)
+load_session (GKeyFile *key_file, const gchar *key, const gchar *default_type)
{
- gchar *type, *domain, *name;
+ gchar *domain, *name, *type;
LightDMSession *session;
LightDMSessionPrivate *priv;
gchar *try_exec;
@@ -57,10 +57,6 @@ load_session (GKeyFile *key_file, const gchar *key)
g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL))
return NULL;
- type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
- if (!type)
- type = "x";
-
#ifdef G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN
domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN, NULL);
#else
@@ -91,6 +87,10 @@ load_session (GKeyFile *key_file, const gchar *key)
g_free (full_path);
}
+ type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
+ if (!type)
+ type = strdup (default_type);
+
session = g_object_new (LIGHTDM_TYPE_SESSION, NULL);
priv = GET_PRIVATE (session);
@@ -98,7 +98,7 @@ load_session (GKeyFile *key_file, const gchar *key)
priv->key = g_strdup (key);
g_free (priv->type);
- priv->type = g_strdup (type);
+ priv->type = type;
g_free (priv->name);
priv->name = name;
@@ -114,7 +114,7 @@ load_session (GKeyFile *key_file, const gchar *key)
}
static GList *
-load_sessions_dir (GList *sessions, const gchar *sessions_dir)
+load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *default_type)
{
GDir *directory;
GError *error = NULL;
@@ -154,7 +154,7 @@ load_sessions_dir (GList *sessions, const gchar *sessions_dir)
LightDMSession *session;
key = g_strndup (filename, strlen (filename) - strlen (".desktop"));
- session = load_session (key_file, key);
+ session = load_session (key_file, key, default_type);
if (session)
{
g_debug ("Loaded session %s (%s, %s)", path, GET_PRIVATE (session)->name, GET_PRIVATE (session)->comment);
@@ -182,8 +182,16 @@ load_sessions (const gchar *sessions_dir)
int i;
dirs = g_strsplit (sessions_dir, ":", -1);
- for (i = 0; dirs[i]; i++)
- sessions = load_sessions_dir (sessions, dirs[i]);
+ for (i = 0; dirs[i]; i++)
+ {
+ const gchar *default_type = "x";
+
+ if (strcmp (dirs[i], WAYLAND_SESSIONS_DIR) == 0)
+ default_type = "wayland";
+
+ sessions = load_sessions_dir (sessions, dirs[i], default_type);
+ }
+
g_strfreev (dirs);
return sessions;
diff --git a/liblightdm-qt/Makefile.am b/liblightdm-qt/Makefile.am
index aa19d2ad..2bf17f29 100644
--- a/liblightdm-qt/Makefile.am
+++ b/liblightdm-qt/Makefile.am
@@ -12,8 +12,7 @@ common_cflags = \
$(WARN_CXXFLAGS) \
-I$(top_srcdir)/liblightdm-gobject \
$(GLIB_CFLAGS) \
- -DQT_NO_KEYWORDS \
- -DXSESSIONS_DIR=\"$(datadir)/xsessions\"
+ -DQT_NO_KEYWORDS
liblightdm_qt_3_la_CXXFLAGS = \
$(LIBLIGHTDM_QT4_CFLAGS) \
$(common_cflags)
diff --git a/src/Makefile.am b/src/Makefile.am
index 496c23ea..b56b9140 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,6 +51,8 @@ lightdm_SOURCES = \
vnc-server.h \
vt.c \
vt.h \
+ wayland-session.c \
+ wayland-session.h \
x-authority.c \
x-authority.h \
x-server-local.c \
@@ -78,7 +80,8 @@ lightdm_CFLAGS = \
-DLOG_DIR=\"$(localstatedir)/log/lightdm\" \
-DRUN_DIR=\"$(localstatedir)/run/lightdm\" \
-DCACHE_DIR=\"$(localstatedir)/cache/lightdm\" \
- -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions\" \
+ -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions:$(datadir)/wayland-sessions\" \
+ -DWAYLAND_SESSIONS_DIR=\"$(datadir)/wayland-sessions\" \
-DREMOTE_SESSIONS_DIR=\"$(pkgdatadir)/remote-sessions\" \
-DGREETERS_DIR=\"$(pkgdatadir)/greeters:$(datadir)/xgreeters\"
diff --git a/src/seat-xlocal.c b/src/seat-xlocal.c
index 7b5ec7ed..74cf183e 100644
--- a/src/seat-xlocal.c
+++ b/src/seat-xlocal.c
@@ -15,6 +15,7 @@
#include "configuration.h"
#include "x-server-local.h"
#include "unity-system-compositor.h"
+#include "wayland-session.h"
#include "plymouth.h"
#include "vt.h"
@@ -248,6 +249,21 @@ create_unity_system_compositor (Seat *seat)
}
static DisplayServer *
+create_wayland_session (Seat *seat)
+{
+ WaylandSession *session;
+ gint vt;
+
+ session = wayland_session_new ();
+
+ vt = get_vt (seat, DISPLAY_SERVER (session));
+ if (vt >= 0)
+ wayland_session_set_vt (session, vt);
+
+ return DISPLAY_SERVER (session);
+}
+
+static DisplayServer *
seat_xlocal_create_display_server (Seat *seat, Session *session)
{
const gchar *session_type;
@@ -257,6 +273,8 @@ seat_xlocal_create_display_server (Seat *seat, Session *session)
return DISPLAY_SERVER (create_x_server (seat));
else if (strcmp (session_type, "mir") == 0)
return create_unity_system_compositor (seat);
+ else if (strcmp (session_type, "wayland") == 0)
+ return create_wayland_session (seat);
else if (strcmp (session_type, "mir-container") == 0)
{
DisplayServer *compositor;
diff --git a/src/seat.c b/src/seat.c
index bc97d672..33b73152 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -962,11 +962,15 @@ find_session_config (Seat *seat, const gchar *sessions_dir, const gchar *session
for (i = 0; dirs[i]; i++)
{
gchar *filename, *path;
+ const gchar *default_session_type = "x";
+
+ if (strcmp (dirs[i], WAYLAND_SESSIONS_DIR) == 0)
+ default_session_type = "wayland";
filename = g_strdup_printf ("%s.desktop", session_name);
path = g_build_filename (dirs[i], filename, NULL);
g_free (filename);
- session_config = session_config_new_from_file (path, &error);
+ session_config = session_config_new_from_file (path, default_session_type, &error);
g_free (path);
if (session_config)
break;
diff --git a/src/session-config.c b/src/session-config.c
index b5ea7228..34f3a970 100644
--- a/src/session-config.c
+++ b/src/session-config.c
@@ -29,7 +29,7 @@ struct SessionConfigPrivate
G_DEFINE_TYPE (SessionConfig, session_config, G_TYPE_OBJECT);
SessionConfig *
-session_config_new_from_file (const gchar *filename, GError **error)
+session_config_new_from_file (const gchar *filename, const gchar *default_session_type, GError **error)
{
GKeyFile *desktop_file;
SessionConfig *config;
@@ -52,7 +52,7 @@ session_config_new_from_file (const gchar *filename, GError **error)
config->priv->command = command;
config->priv->session_type = g_key_file_get_string (desktop_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
if (!config->priv->session_type)
- config->priv->session_type = g_strdup ("x");
+ config->priv->session_type = g_strdup (default_session_type);
config->priv->desktop_names = g_key_file_get_string_list (desktop_file, G_KEY_FILE_DESKTOP_GROUP, "DesktopNames", NULL, NULL);
if (!config->priv->desktop_names)
diff --git a/src/session-config.h b/src/session-config.h
index 2d3d5288..aea59599 100644
--- a/src/session-config.h
+++ b/src/session-config.h
@@ -36,7 +36,7 @@ typedef struct
GType session_config_get_type (void);
-SessionConfig *session_config_new_from_file (const gchar *filename, GError **error);
+SessionConfig *session_config_new_from_file (const gchar *filename, const gchar *default_session_type, GError **error);
const gchar *session_config_get_command (SessionConfig *config);
diff --git a/src/wayland-session.c b/src/wayland-session.c
new file mode 100644
index 00000000..19a50aa5
--- /dev/null
+++ b/src/wayland-session.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd.
+ * Author: Robert Ancell <robert.ancell@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+#include "wayland-session.h"
+#include "vt.h"
+
+struct WaylandSessionPrivate
+{
+ /* VT to run on */
+ gint vt;
+ gboolean have_vt_ref;
+};
+
+G_DEFINE_TYPE (WaylandSession, wayland_session, DISPLAY_SERVER_TYPE);
+
+WaylandSession *
+wayland_session_new (void)
+{
+ return g_object_new (WAYLAND_SESSION_TYPE, NULL);
+}
+
+void
+wayland_session_set_vt (WaylandSession *session, gint vt)
+{
+ g_return_if_fail (session != NULL);
+
+ if (session->priv->have_vt_ref)
+ vt_unref (session->priv->vt);
+ session->priv->have_vt_ref = FALSE;
+ session->priv->vt = vt;
+ if (vt > 0)
+ {
+ vt_ref (vt);
+ session->priv->have_vt_ref = TRUE;
+ }
+}
+
+static gint
+wayland_session_get_vt (DisplayServer *server)
+{
+ g_return_val_if_fail (server != NULL, 0);
+ return WAYLAND_SESSION (server)->priv->vt;
+}
+
+static void
+wayland_session_connect_session (DisplayServer *display_server, Session *session)
+{
+ WaylandSession *wayland_session = WAYLAND_SESSION (display_server);
+
+ session_set_env (session, "XDG_SESSION_TYPE", "wayland");
+
+ if (wayland_session->priv->vt >= 0)
+ {
+ gchar *value = g_strdup_printf ("%d", wayland_session->priv->vt);
+ session_set_env (session, "XDG_VTNR", value);
+ g_free (value);
+ }
+}
+
+static void
+wayland_session_disconnect_session (DisplayServer *display_server, Session *session)
+{
+ session_unset_env (session, "XDG_SESSION_TYPE");
+ session_unset_env (session, "XDG_VTNR");
+}
+
+static void
+wayland_session_init (WaylandSession *session)
+{
+ session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, WAYLAND_SESSION_TYPE, WaylandSessionPrivate);
+}
+
+static void
+wayland_session_finalize (GObject *object)
+{
+ WaylandSession *self;
+
+ self = WAYLAND_SESSION (object);
+
+ if (self->priv->have_vt_ref)
+ vt_unref (self->priv->vt);
+
+ G_OBJECT_CLASS (wayland_session_parent_class)->finalize (object);
+}
+
+static void
+wayland_session_class_init (WaylandSessionClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ DisplayServerClass *display_server_class = DISPLAY_SERVER_CLASS (klass);
+
+ display_server_class->get_vt = wayland_session_get_vt;
+ display_server_class->connect_session = wayland_session_connect_session;
+ display_server_class->disconnect_session = wayland_session_disconnect_session;
+ object_class->finalize = wayland_session_finalize;
+
+ g_type_class_add_private (klass, sizeof (WaylandSessionPrivate));
+}
diff --git a/src/wayland-session.h b/src/wayland-session.h
new file mode 100644
index 00000000..79282ca6
--- /dev/null
+++ b/src/wayland-session.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd.
+ * Author: Robert Ancell <robert.ancell@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+#ifndef WAYLAND_SESSION_H_
+#define WAYLAND_SESSION_H_
+
+#include <glib-object.h>
+#include "display-server.h"
+
+G_BEGIN_DECLS
+
+#define WAYLAND_SESSION_TYPE (wayland_session_get_type())
+#define WAYLAND_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WAYLAND_SESSION_TYPE, WaylandSession))
+#define IS_WAYLAND_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WAYLAND_SESSION_TYPE))
+
+typedef struct WaylandSessionPrivate WaylandSessionPrivate;
+
+typedef struct
+{
+ DisplayServer parent_instance;
+ WaylandSessionPrivate *priv;
+} WaylandSession;
+
+typedef struct
+{
+ DisplayServerClass parent_class;
+} WaylandSessionClass;
+
+GType wayland_session_get_type (void);
+
+WaylandSession *wayland_session_new (void);
+
+void wayland_session_set_vt (WaylandSession *session, gint vt);
+
+G_END_DECLS
+
+#endif /* WAYLAND_SESSION_H_ */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 291a9c97..d509c135 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -199,6 +199,9 @@ TESTS = \
test-mir-session-crash \
test-mir-session-compositor-crash \
test-mir-container-session \
+ test-wayland-autologin \
+ test-wayland-greeter \
+ test-wayland-session \
test-unity-compositor-command \
test-unity-compositor-not-found \
test-unity-compositor-fail-start \
@@ -349,12 +352,14 @@ EXTRA_DIST = \
data/greeters/test-python-greeter.desktop \
data/greeters/test-qt4-greeter.desktop \
data/greeters/test-qt5-greeter.desktop \
+ data/greeters/test-wayland-greeter.desktop \
data/sessions/alternative.desktop \
data/sessions/default.desktop \
data/sessions/mir.desktop \
data/sessions/mir-container.desktop \
data/sessions/named.desktop \
data/sessions/named-legacy.desktop \
+ data/sessions/wayland.desktop \
scripts/0-additional.conf \
scripts/1-additional.conf \
scripts/additional-config.conf \
@@ -567,6 +572,9 @@ EXTRA_DIST = \
scripts/vnc-guest.conf \
scripts/vnc-login.conf \
scripts/vnc-open-file-descriptors.conf \
+ scripts/wayland-autologin.conf \
+ scripts/wayland-greeter.conf \
+ scripts/wayland-session.conf \
scripts/xauthority.conf \
scripts/xdg-current-desktop.conf \
scripts/xdg-current-desktop-legacy.conf \
diff --git a/tests/data/greeters/test-mir-greeter.desktop b/tests/data/greeters/test-mir-greeter.desktop
index d1ca7d52..29f84104 100644
--- a/tests/data/greeters/test-mir-greeter.desktop
+++ b/tests/data/greeters/test-mir-greeter.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-Name=Test GObject Greeter
-Comment=LightDM test GObject greeter
+Name=Test Mir Greeter
+Comment=LightDM test Mir greeter
Exec=test-gobject-greeter
X-LightDM-Session-Type=mir
diff --git a/tests/data/greeters/test-wayland-greeter.desktop b/tests/data/greeters/test-wayland-greeter.desktop
new file mode 100644
index 00000000..a4b3bd28
--- /dev/null
+++ b/tests/data/greeters/test-wayland-greeter.desktop
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=Test Wayland Greeter
+Comment=LightDM test Wayland greeter
+Exec=test-gobject-greeter
+X-LightDM-Session-Type=wayland
diff --git a/tests/data/sessions/wayland.desktop b/tests/data/sessions/wayland.desktop
new file mode 100644
index 00000000..2eb55d16
--- /dev/null
+++ b/tests/data/sessions/wayland.desktop
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=Test Session
+Comment=LightDM test Wayland session
+Exec=test-session
+X-LightDM-Session-Type=wayland
diff --git a/tests/scripts/wayland-autologin.conf b/tests/scripts/wayland-autologin.conf
new file mode 100644
index 00000000..c83dc79f
--- /dev/null
+++ b/tests/scripts/wayland-autologin.conf
@@ -0,0 +1,19 @@
+#
+# Check can automatically log into a Wayland session from a VT based seat
+#
+
+[Seat:*]
+autologin-user=have-password1
+user-session=wayland
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# Session starts
+#?SESSION-WAYLAND START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=wayland USER=have-password1
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-WAYLAND TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/wayland-greeter.conf b/tests/scripts/wayland-greeter.conf
new file mode 100644
index 00000000..1a7bd488
--- /dev/null
+++ b/tests/scripts/wayland-greeter.conf
@@ -0,0 +1,17 @@
+#
+# Check can run a Wayland greeter from a VT based seat
+#
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# Greeter starts
+#?GREETER-WAYLAND START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?GREETER-WAYLAND CONNECT-TO-DAEMON
+#?GREETER-WAYLAND CONNECTED-TO-DAEMON
+
+# Cleanup
+#?*STOP-DAEMON
+#?GREETER-WAYLAND TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/wayland-session.conf b/tests/scripts/wayland-session.conf
new file mode 100644
index 00000000..dfdb39f5
--- /dev/null
+++ b/tests/scripts/wayland-session.conf
@@ -0,0 +1,46 @@
+#
+# Check can login into a Wayland session on a VT based seat
+#
+
+[Seat:*]
+user-session=wayland
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Attempt to log into account
+#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
+#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
+#?*GREETER-X-0 START-SESSION
+
+# Greeter terminates
+#?GREETER-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+
+# Session starts
+#?SESSION-WAYLAND START XDG_SEAT=seat0 XDG_VTNR=8 XDG_GREETER_DATA_DIR=.*/no-password1 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=wayland USER=no-password1
+#?LOGIN1 ACTIVATE-SESSION SESSION=c1
+
+# Switch to session
+#?VT ACTIVATE VT=8
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-WAYLAND TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c
index 5277df00..f2f441cd 100644
--- a/tests/src/test-gobject-greeter.c
+++ b/tests/src/test-gobject-greeter.c
@@ -407,7 +407,7 @@ connect_finished (GObject *object, GAsyncResult *result, gpointer data)
int
main (int argc, char **argv)
{
- gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_cookie, *xdg_session_class, *mir_socket, *mir_vt, *mir_id, *path;
+ gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_cookie, *xdg_session_class, *xdg_session_type, *mir_socket, *mir_vt, *mir_id, *path;
GString *status_text;
#if !defined(GLIB_VERSION_2_36)
@@ -419,6 +419,7 @@ main (int argc, char **argv)
xdg_vtnr = getenv ("XDG_VTNR");
xdg_session_cookie = getenv ("XDG_SESSION_COOKIE");
xdg_session_class = getenv ("XDG_SESSION_CLASS");
+ xdg_session_type = getenv ("XDG_SESSION_TYPE");
mir_socket = getenv ("MIR_SOCKET");
mir_vt = getenv ("MIR_SERVER_VT");
mir_id = getenv ("MIR_SERVER_NAME");
@@ -433,6 +434,8 @@ main (int argc, char **argv)
greeter_id = g_strdup_printf ("GREETER-MIR-%s", mir_id);
else if (mir_socket || mir_vt)
greeter_id = g_strdup ("GREETER-MIR");
+ else if (g_strcmp0 (xdg_session_type, "wayland") == 0)
+ greeter_id = g_strdup ("GREETER-WAYLAND");
else
greeter_id = g_strdup ("GREETER-?");
diff --git a/tests/src/test-session.c b/tests/src/test-session.c
index 24cc2862..28679135 100644
--- a/tests/src/test-session.c
+++ b/tests/src/test-session.c
@@ -256,6 +256,8 @@ main (int argc, char **argv)
session_id = g_strdup_printf ("SESSION-MIR-%s", mir_id);
else if (mir_socket || mir_vt)
session_id = g_strdup ("SESSION-MIR");
+ else if (g_strcmp0 (xdg_session_type, "wayland") == 0)
+ session_id = g_strdup ("SESSION-WAYLAND");
else
session_id = g_strdup ("SESSION-UNKNOWN");
diff --git a/tests/test-wayland-autologin b/tests/test-wayland-autologin
new file mode 100755
index 00000000..42f7eb9a
--- /dev/null
+++ b/tests/test-wayland-autologin
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner wayland-autologin test-gobject-greeter
diff --git a/tests/test-wayland-greeter b/tests/test-wayland-greeter
new file mode 100755
index 00000000..f1d6d388
--- /dev/null
+++ b/tests/test-wayland-greeter
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner wayland-greeter test-wayland-greeter
diff --git a/tests/test-wayland-session b/tests/test-wayland-session
new file mode 100755
index 00000000..3ecaa416
--- /dev/null
+++ b/tests/test-wayland-session
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner wayland-session test-gobject-greeter