Merge lp:~robert-ancell/lightdm/mir-sessions into lp:lightdm

Proposed by Robert Ancell on 2013-07-23
Status: Merged
Approved by: Robert Ancell on 2013-07-30
Approved revision: 1659
Merged at revision: 1741
Proposed branch: lp:~robert-ancell/lightdm/mir-sessions
Merge into: lp:lightdm
Diff against target: 1939 lines (+984/-95)
45 files modified
.bzrignore (+1/-0)
doc/lightdm-gobject-1-sections.txt (+1/-0)
doc/tmpl/session.sgml (+9/-0)
liblightdm-gobject/lightdm/session.h (+2/-0)
liblightdm-gobject/session.c (+27/-1)
liblightdm-qt/QLightDM/sessionsmodel.h (+2/-1)
liblightdm-qt/sessionsmodel.cpp (+4/-0)
src/Makefile.am (+2/-0)
src/display-server.c (+7/-0)
src/display-server.h (+3/-0)
src/mir-server.c (+159/-0)
src/mir-server.h (+53/-0)
src/seat-unity.c (+64/-16)
src/seat-xdmcp-session.c (+4/-1)
src/seat-xlocal.c (+9/-3)
src/seat-xremote.c (+7/-1)
src/seat-xvnc.c (+6/-1)
src/seat.c (+77/-35)
src/seat.h (+2/-1)
src/session-config.c (+13/-0)
src/session-config.h (+1/-0)
src/session.c (+19/-0)
src/session.h (+4/-0)
src/x-server.c (+7/-0)
tests/Makefile.am (+50/-32)
tests/data/greeters/test-mir-greeter.desktop (+5/-0)
tests/data/sessions/mir.desktop (+5/-0)
tests/scripts/mir-autologin.conf (+32/-0)
tests/scripts/mir-greeter.conf (+10/-0)
tests/scripts/mir-session.conf (+34/-0)
tests/scripts/unity-mir-autologin.conf (+26/-0)
tests/scripts/unity-mir-greeter-mir-session.conf (+41/-0)
tests/scripts/unity-mir-greeter-x-session.conf (+52/-0)
tests/scripts/unity-mir-session-x-greeter.conf (+52/-0)
tests/src/Makefile.am (+14/-1)
tests/src/test-gobject-greeter.c (+10/-1)
tests/src/test-mir-greeter.c (+146/-0)
tests/src/test-session.c (+10/-1)
tests/test-mir-autologin (+2/-0)
tests/test-mir-greeter (+2/-0)
tests/test-mir-session (+2/-0)
tests/test-unity-mir-autologin (+2/-0)
tests/test-unity-mir-greeter-mir-session (+2/-0)
tests/test-unity-mir-greeter-x-session (+2/-0)
tests/test-unity-mir-session-x-greeter (+2/-0)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/mir-sessions
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2013-07-30
Robert Ancell Approve on 2013-07-29
Review via email: mp+176323@code.launchpad.net

Commit message

Add support for Mir sessions and greeters

To post a comment you must log in.
review: Approve
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1659
http://jenkins.qa.ubuntu.com/job/lightdm-ci/144/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/lightdm-saucy-amd64-ci/60/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/lightdm-ci/144/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1659
http://jenkins.qa.ubuntu.com/job/lightdm-ci/147/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/lightdm-saucy-amd64-ci/63/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/lightdm-ci/147/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-07-19 09:50:32 +0000
3+++ .bzrignore 2013-07-26 05:19:27 +0000
4@@ -69,6 +69,7 @@
5 tests/src/plymouth
6 tests/src/test-gobject-greeter
7 tests/src/test-greeter-wrapper
8+tests/src/test-mir-greeter
9 tests/src/test-qt4-greeter
10 tests/src/test-qt5-greeter
11 tests/src/test-runner
12
13=== modified file 'doc/lightdm-gobject-1-sections.txt'
14--- doc/lightdm-gobject-1-sections.txt 2013-07-02 03:35:40 +0000
15+++ doc/lightdm-gobject-1-sections.txt 2013-07-26 05:19:27 +0000
16@@ -65,6 +65,7 @@
17 lightdm_get_remote_sessions
18 lightdm_get_sessions
19 lightdm_session_get_key
20+lightdm_session_get_session_type
21 lightdm_session_get_name
22 lightdm_session_get_comment
23 <SUBSECTION Standard>
24
25=== modified file 'doc/tmpl/session.sgml'
26--- doc/tmpl/session.sgml 2013-07-02 03:35:40 +0000
27+++ doc/tmpl/session.sgml 2013-07-26 05:19:27 +0000
28@@ -47,6 +47,15 @@
29 @Returns:
30
31
32+<!-- ##### FUNCTION lightdm_session_get_session_type ##### -->
33+<para>
34+
35+</para>
36+
37+@session:
38+@Returns:
39+
40+
41 <!-- ##### FUNCTION lightdm_session_get_name ##### -->
42 <para>
43
44
45=== modified file 'liblightdm-gobject/lightdm/session.h'
46--- liblightdm-gobject/lightdm/session.h 2013-07-02 03:35:20 +0000
47+++ liblightdm-gobject/lightdm/session.h 2013-07-26 05:19:27 +0000
48@@ -48,6 +48,8 @@
49
50 const gchar *lightdm_session_get_key (LightDMSession *session);
51
52+const gchar *lightdm_session_get_session_type (LightDMSession *session);
53+
54 const gchar *lightdm_session_get_name (LightDMSession *session);
55
56 const gchar *lightdm_session_get_comment (LightDMSession *session);
57
58=== modified file 'liblightdm-gobject/session.c'
59--- liblightdm-gobject/session.c 2013-07-11 02:20:58 +0000
60+++ liblightdm-gobject/session.c 2013-07-26 05:19:27 +0000
61@@ -23,6 +23,7 @@
62 typedef struct
63 {
64 gchar *key;
65+ gchar *type;
66 gchar *name;
67 gchar *comment;
68 } LightDMSessionPrivate;
69@@ -34,6 +35,7 @@
70 static gboolean have_sessions = FALSE;
71 static GList *local_sessions = NULL;
72 static GList *remote_sessions = NULL;
73+static GList *mir_sessions = NULL;
74
75 static gint
76 compare_session (gconstpointer a, gconstpointer b)
77@@ -46,7 +48,7 @@
78 static LightDMSession *
79 load_session (GKeyFile *key_file, const gchar *key)
80 {
81- gchar *domain, *name;
82+ gchar *type, *domain, *name;
83 LightDMSession *session;
84 LightDMSessionPrivate *priv;
85 gchar *try_exec;
86@@ -55,6 +57,10 @@
87 g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL))
88 return NULL;
89
90+ type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
91+ if (!type)
92+ type = "x";
93+
94 #ifdef G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN
95 domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN, NULL);
96 #else
97@@ -91,6 +97,9 @@
98 g_free (priv->key);
99 priv->key = g_strdup (key);
100
101+ g_free (priv->type);
102+ priv->type = g_strdup (type);
103+
104 g_free (priv->name);
105 priv->name = name;
106
107@@ -187,6 +196,7 @@
108 gchar *config_path = NULL;
109 gchar *sessions_dir;
110 gchar *remote_sessions_dir;
111+ gchar *mir_sessions_dir;
112 gboolean result;
113 GError *error = NULL;
114
115@@ -278,6 +288,21 @@
116 }
117
118 /**
119+ * lightdm_session_get_session_type:
120+ * @session: A #LightDMSession
121+ *
122+ * Get the type a session
123+ *
124+ * Return value: The session type, e.g. x or mir
125+ **/
126+const gchar *
127+lightdm_session_get_session_type (LightDMSession *session)
128+{
129+ g_return_val_if_fail (LIGHTDM_IS_SESSION (session), NULL);
130+ return GET_PRIVATE (session)->type;
131+}
132+
133+/**
134 * lightdm_session_get_name:
135 * @session: A #LightDMSession
136 *
137@@ -354,6 +379,7 @@
138 LightDMSessionPrivate *priv = GET_PRIVATE (self);
139
140 g_free (priv->key);
141+ g_free (priv->type);
142 g_free (priv->name);
143 g_free (priv->comment);
144 }
145
146=== modified file 'liblightdm-qt/QLightDM/sessionsmodel.h'
147--- liblightdm-qt/QLightDM/sessionsmodel.h 2013-04-16 16:37:08 +0000
148+++ liblightdm-qt/QLightDM/sessionsmodel.h 2013-07-26 05:19:27 +0000
149@@ -27,7 +27,8 @@
150 //name is exposed as Qt::DisplayRole
151 //comment is exposed as Qt::TooltipRole
152 KeyRole = Qt::UserRole,
153- IdRole = KeyRole /** Deprecated */
154+ IdRole = KeyRole, /** Deprecated */
155+ TypeRole
156 };
157
158 enum SessionType {
159
160=== modified file 'liblightdm-qt/sessionsmodel.cpp'
161--- liblightdm-qt/sessionsmodel.cpp 2013-02-06 14:08:25 +0000
162+++ liblightdm-qt/sessionsmodel.cpp 2013-07-26 05:19:27 +0000
163@@ -21,6 +21,7 @@
164 {
165 public:
166 QString key;
167+ QString type;
168 QString name;
169 QString comment;
170 };
171@@ -71,6 +72,7 @@
172
173 SessionItem session;
174 session.key = QString::fromUtf8(lightdm_session_get_key(ldmSession));
175+ session.type = QString::fromUtf8(lightdm_session_get_session_type(ldmSession));
176 session.name = QString::fromUtf8(lightdm_session_get_name(ldmSession));
177 session.comment = QString::fromUtf8(lightdm_session_get_comment(ldmSession));
178
179@@ -137,6 +139,8 @@
180 switch (role) {
181 case SessionsModel::KeyRole:
182 return d->items[row].key;
183+ case SessionsModel::TypeRole:
184+ return d->items[row].type;
185 case Qt::DisplayRole:
186 return d->items[row].name;
187 case Qt::ToolTipRole:
188
189=== modified file 'src/Makefile.am'
190--- src/Makefile.am 2013-07-24 06:45:23 +0000
191+++ src/Makefile.am 2013-07-26 05:19:27 +0000
192@@ -20,6 +20,8 @@
193 lightdm.c \
194 login1.c \
195 login1.h \
196+ mir-server.c \
197+ mir-server.h \
198 plymouth.c \
199 plymouth.h \
200 privileges.c \
201
202=== modified file 'src/display-server.c'
203--- src/display-server.c 2013-07-26 02:14:10 +0000
204+++ src/display-server.c 2013-07-26 05:19:27 +0000
205@@ -49,6 +49,12 @@
206 return server->priv->name;
207 }
208
209+const gchar *
210+display_server_get_session_type (DisplayServer *server)
211+{
212+ return DISPLAY_SERVER_GET_CLASS (server)->get_session_type (server);
213+}
214+
215 gboolean
216 display_server_get_can_share (DisplayServer *server)
217 {
218@@ -64,6 +70,7 @@
219 gint
220 display_server_get_vt (DisplayServer *server)
221 {
222+ g_return_val_if_fail (server != NULL, -1);
223 return DISPLAY_SERVER_GET_CLASS (server)->get_vt (server);
224 }
225
226
227=== modified file 'src/display-server.h'
228--- src/display-server.h 2013-07-26 02:14:10 +0000
229+++ src/display-server.h 2013-07-26 05:19:27 +0000
230@@ -40,6 +40,7 @@
231 void (*ready)(DisplayServer *server);
232 void (*stopped)(DisplayServer *server);
233
234+ const gchar *(*get_session_type)(DisplayServer *server);
235 gboolean (*get_can_share)(DisplayServer *server);
236 gint (*get_vt)(DisplayServer *server);
237 gboolean (*start)(DisplayServer *server);
238@@ -54,6 +55,8 @@
239
240 const gchar *display_server_get_name (DisplayServer *server);
241
242+const gchar *display_server_get_session_type (DisplayServer *server);
243+
244 gboolean display_server_get_can_share (DisplayServer *server);
245
246 gint display_server_get_vt (DisplayServer *server);
247
248=== added file 'src/mir-server.c'
249--- src/mir-server.c 1970-01-01 00:00:00 +0000
250+++ src/mir-server.c 2013-07-26 05:19:27 +0000
251@@ -0,0 +1,159 @@
252+/*
253+ * Copyright (C) 2010-2011 Robert Ancell.
254+ * Author: Robert Ancell <robert.ancell@canonical.com>
255+ *
256+ * This program is free software: you can redistribute it and/or modify it under
257+ * the terms of the GNU General Public License as published by the Free Software
258+ * Foundation, either version 3 of the License, or (at your option) any later
259+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
260+ * license.
261+ */
262+
263+#include <string.h>
264+
265+#include "mir-server.h"
266+#include "configuration.h"
267+#include "vt.h"
268+
269+struct MirServerPrivate
270+{
271+ /* VT to run on */
272+ gint vt;
273+
274+ /* Mir socket for this server to talk to parent */
275+ gchar *parent_socket;
276+
277+ /* ID to use for Mir connection */
278+ gchar *id;
279+};
280+
281+G_DEFINE_TYPE (MirServer, mir_server, DISPLAY_SERVER_TYPE);
282+
283+MirServer *mir_server_new (void)
284+{
285+ return g_object_new (MIR_SERVER_TYPE, NULL);
286+}
287+
288+void
289+mir_server_set_vt (MirServer *server, gint vt)
290+{
291+ g_return_if_fail (server != NULL);
292+ if (server->priv->vt > 0)
293+ vt_unref (server->priv->vt);
294+ server->priv->vt = vt;
295+ if (vt > 0)
296+ vt_ref (vt);
297+}
298+
299+void
300+mir_server_set_parent_socket (MirServer *server, const gchar *parent_socket)
301+{
302+ g_return_if_fail (server != NULL);
303+ g_free (server->priv->parent_socket);
304+ server->priv->parent_socket = g_strdup (parent_socket);
305+}
306+
307+static void
308+update_name (MirServer *server)
309+{
310+ gchar *name;
311+
312+ if (server->priv->id)
313+ name = g_strdup_printf ("mir-%s", server->priv->id);
314+ else
315+ name = g_strdup ("mir");
316+ display_server_set_name (DISPLAY_SERVER (server), name);
317+ g_free (name);
318+}
319+
320+void
321+mir_server_set_id (MirServer *server, const gchar *id)
322+{
323+ g_return_if_fail (server != NULL);
324+ g_free (server->priv->id);
325+ server->priv->id = g_strdup (id);
326+ update_name (server);
327+}
328+
329+const gchar *
330+mir_server_get_id (MirServer *server)
331+{
332+ g_return_val_if_fail (server != NULL, NULL);
333+ return server->priv->id;
334+}
335+
336+static const gchar *
337+mir_server_get_session_type (DisplayServer *server)
338+{
339+ return "mir";
340+}
341+
342+static gint
343+mir_server_get_vt (DisplayServer *server)
344+{
345+ return MIR_SERVER (server)->priv->vt;
346+}
347+
348+static void
349+mir_server_connect_session (DisplayServer *display_server, Session *session)
350+{
351+ MirServer *server;
352+
353+ server = MIR_SERVER (display_server);
354+ if (server->priv->id)
355+ session_set_env (session, "MIR_ID", server->priv->id);
356+ if (server->priv->parent_socket)
357+ session_set_env (session, "MIR_SERVER_FILE", server->priv->parent_socket);
358+ if (server->priv->vt > 0)
359+ {
360+ gchar *value = g_strdup_printf ("%d", server->priv->vt);
361+ session_set_env (session, "MIR_SERVER_VT", value);
362+ g_free (value);
363+ }
364+}
365+
366+static void
367+mir_server_disconnect_session (DisplayServer *display_server, Session *session)
368+{
369+ session_unset_env (session, "MIR_ID");
370+ session_unset_env (session, "MIR_SERVER_FILE");
371+ session_unset_env (session, "MIR_SERVER_VT");
372+}
373+
374+static void
375+mir_server_init (MirServer *server)
376+{
377+ server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, MIR_SERVER_TYPE, MirServerPrivate);
378+ server->priv->vt = -1;
379+ update_name (server);
380+}
381+
382+static void
383+mir_server_finalize (GObject *object)
384+{
385+ MirServer *server;
386+
387+ server = MIR_SERVER (object);
388+
389+ if (server->priv->vt > 0)
390+ vt_unref (server->priv->vt);
391+ g_free (server->priv->id);
392+ g_free (server->priv->parent_socket);
393+
394+ G_OBJECT_CLASS (mir_server_parent_class)->finalize (object);
395+}
396+
397+static void
398+mir_server_class_init (MirServerClass *klass)
399+{
400+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
401+ DisplayServerClass *display_server_class = DISPLAY_SERVER_CLASS (klass);
402+
403+ display_server_class->get_session_type = mir_server_get_session_type;
404+ display_server_class->get_vt = mir_server_get_vt;
405+ display_server_class->connect_session = mir_server_connect_session;
406+ display_server_class->disconnect_session = mir_server_disconnect_session;
407+ object_class->finalize = mir_server_finalize;
408+
409+ g_type_class_add_private (klass, sizeof (MirServerPrivate));
410+}
411
412=== added file 'src/mir-server.h'
413--- src/mir-server.h 1970-01-01 00:00:00 +0000
414+++ src/mir-server.h 2013-07-26 05:19:27 +0000
415@@ -0,0 +1,53 @@
416+/*
417+ * Copyright (C) 2010-2011 Robert Ancell.
418+ * Author: Robert Ancell <robert.ancell@canonical.com>
419+ *
420+ * This program is free software: you can redistribute it and/or modify it under
421+ * the terms of the GNU General Public License as published by the Free Software
422+ * Foundation, either version 3 of the License, or (at your option) any later
423+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
424+ * license.
425+ */
426+
427+#ifndef MIR_SERVER_H_
428+#define MIR_SERVER_H_
429+
430+#include <glib-object.h>
431+#include "display-server.h"
432+
433+G_BEGIN_DECLS
434+
435+#define MIR_SERVER_TYPE (mir_server_get_type())
436+#define MIR_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIR_SERVER_TYPE, MirServer))
437+#define MIR_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIR_SERVER_TYPE, MirServerClass))
438+#define MIR_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIR_SERVER_TYPE, MirServerClass))
439+#define IS_MIR_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIR_SERVER_TYPE))
440+
441+typedef struct MirServerPrivate MirServerPrivate;
442+
443+typedef struct
444+{
445+ DisplayServer parent_instance;
446+ MirServerPrivate *priv;
447+} MirServer;
448+
449+typedef struct
450+{
451+ DisplayServerClass parent_class;
452+} MirServerClass;
453+
454+GType mir_server_get_type (void);
455+
456+MirServer *mir_server_new (void);
457+
458+void mir_server_set_vt (MirServer *server, gint vt);
459+
460+void mir_server_set_parent_socket (MirServer *server, const gchar *parent_socket);
461+
462+void mir_server_set_id (MirServer *server, const gchar *id);
463+
464+const gchar *mir_server_get_id (MirServer *server);
465+
466+G_END_DECLS
467+
468+#endif /* MIR_SERVER_H_ */
469
470=== modified file 'src/seat-unity.c'
471--- src/seat-unity.c 2013-07-25 04:05:28 +0000
472+++ src/seat-unity.c 2013-07-26 05:19:27 +0000
473@@ -17,6 +17,7 @@
474 #include "seat-unity.h"
475 #include "configuration.h"
476 #include "x-server-local.h"
477+#include "mir-server.h"
478 #include "vt.h"
479 #include "plymouth.h"
480
481@@ -378,33 +379,33 @@
482 }
483
484 static DisplayServer *
485-seat_unity_create_display_server (Seat *seat)
486+create_x_server (Seat *seat)
487 {
488 XServerLocal *x_server;
489 const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
490 gboolean allow_tcp;
491 gint port = 0;
492- gchar *id;
493
494 g_debug ("Starting X server on Unity compositor");
495
496 x_server = x_server_local_new ();
497
498- if (!SEAT_UNITY (seat)->priv->use_vt_switching)
499- {
500- id = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->next_id);
501- SEAT_UNITY (seat)->priv->next_id++;
502- x_server_local_set_mir_id (x_server, id);
503- x_server_local_set_mir_socket (x_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
504- g_free (id);
505- }
506-
507 command = seat_get_string_property (seat, "xserver-command");
508 if (command)
509 x_server_local_set_command (x_server, command);
510
511 if (SEAT_UNITY (seat)->priv->use_vt_switching)
512 x_server_local_set_vt (x_server, vt_get_unused ());
513+ else
514+ {
515+ gchar *id;
516+
517+ id = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->next_id);
518+ SEAT_UNITY (seat)->priv->next_id++;
519+ x_server_local_set_mir_id (x_server, id);
520+ x_server_local_set_mir_socket (x_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
521+ g_free (id);
522+ }
523
524 layout = seat_get_string_property (seat, "xserver-layout");
525 if (layout)
526@@ -464,6 +465,44 @@
527 return DISPLAY_SERVER (x_server);
528 }
529
530+static DisplayServer *
531+create_mir_server (Seat *seat)
532+{
533+ MirServer *mir_server;
534+
535+ mir_server = mir_server_new ();
536+ mir_server_set_parent_socket (mir_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
537+
538+ if (SEAT_UNITY (seat)->priv->use_vt_switching)
539+ mir_server_set_vt (mir_server, vt_get_unused ());
540+ else
541+ {
542+ gchar *id;
543+
544+ id = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->next_id);
545+ SEAT_UNITY (seat)->priv->next_id++;
546+ mir_server_set_id (mir_server, id);
547+ mir_server_set_parent_socket (mir_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
548+ g_free (id);
549+ }
550+
551+ return DISPLAY_SERVER (mir_server);
552+}
553+
554+static DisplayServer *
555+seat_unity_create_display_server (Seat *seat, const gchar *session_type)
556+{
557+ if (strcmp (session_type, "x") == 0)
558+ return create_x_server (seat);
559+ else if (strcmp (session_type, "mir") == 0)
560+ return create_mir_server (seat);
561+ else
562+ {
563+ g_warning ("Can't create unsupported display server '%s'", session_type);
564+ return NULL;
565+ }
566+}
567+
568 static Greeter *
569 seat_unity_create_greeter_session (Seat *seat)
570 {
571@@ -509,13 +548,22 @@
572 display_server = session_get_display_server (session);
573 if (SEAT_UNITY (seat)->priv->active_display_server != display_server)
574 {
575- const gchar *id;
576+ const gchar *id = NULL;
577
578 SEAT_UNITY (seat)->priv->active_display_server = g_object_ref (display_server);
579- id = x_server_local_get_mir_id (X_SERVER_LOCAL (display_server));
580-
581- g_debug ("Switching to Mir session %s", id);
582- write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_ACTIVE_SESSION, (const guint8 *) id, strlen (id));
583+
584+ if (IS_X_SERVER_LOCAL (display_server))
585+ id = x_server_local_get_mir_id (X_SERVER_LOCAL (display_server));
586+ else if (IS_MIR_SERVER (display_server))
587+ id = mir_server_get_id (MIR_SERVER (display_server));
588+
589+ if (id)
590+ {
591+ g_debug ("Switching to Mir session %s", id);
592+ write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_ACTIVE_SESSION, (const guint8 *) id, strlen (id));
593+ }
594+ else
595+ g_warning ("Failed to work out session ID");
596 }
597
598 SEAT_CLASS (seat_unity_parent_class)->set_active_session (seat, session);
599
600=== modified file 'src/seat-xdmcp-session.c'
601--- src/seat-xdmcp-session.c 2013-07-24 06:45:23 +0000
602+++ src/seat-xdmcp-session.c 2013-07-26 05:19:27 +0000
603@@ -34,12 +34,15 @@
604 }
605
606 static DisplayServer *
607-seat_xdmcp_session_create_display_server (Seat *seat)
608+seat_xdmcp_session_create_display_server (Seat *seat, const gchar *session_type)
609 {
610 XAuthority *authority;
611 gchar *host;
612 XServerRemote *x_server;
613
614+ if (strcmp (session_type, "x") != 0)
615+ return NULL;
616+
617 authority = xdmcp_session_get_authority (SEAT_XDMCP_SESSION (seat)->priv->session);
618 host = g_inet_address_to_string (xdmcp_session_get_address (SEAT_XDMCP_SESSION (seat)->priv->session));
619 x_server = x_server_remote_new (host, xdmcp_session_get_display_number (SEAT_XDMCP_SESSION (seat)->priv->session), authority);
620
621=== modified file 'src/seat-xlocal.c'
622--- src/seat-xlocal.c 2013-07-25 04:05:28 +0000
623+++ src/seat-xlocal.c 2013-07-26 05:19:27 +0000
624@@ -58,8 +58,11 @@
625 }
626
627 static DisplayServer *
628-seat_xlocal_create_display_server (Seat *seat)
629-{
630+seat_xlocal_create_display_server (Seat *seat, const gchar *session_type)
631+{
632+ if (strcmp (session_type, "x") != 0)
633+ return NULL;
634+
635 XServerLocal *x_server;
636 const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
637 gboolean allow_tcp;
638@@ -204,7 +207,10 @@
639 for (link = seat_get_sessions (seat); link; link = link->next)
640 {
641 Session *session = link->data;
642- if (display_server_get_vt (session_get_display_server (session)) == vt)
643+ DisplayServer *display_server;
644+
645+ display_server = session_get_display_server (session);
646+ if (display_server && display_server_get_vt (display_server) == vt)
647 return session;
648 }
649
650
651=== modified file 'src/seat-xremote.c'
652--- src/seat-xremote.c 2013-07-24 06:45:23 +0000
653+++ src/seat-xremote.c 2013-07-26 05:19:27 +0000
654@@ -25,12 +25,18 @@
655 }
656
657 static DisplayServer *
658-seat_xremote_create_display_server (Seat *seat)
659+seat_xremote_create_display_server (Seat *seat, const gchar *session_type)
660 {
661 XServerRemote *x_server;
662 const gchar *hostname;
663 gint number;
664
665+ if (strcmp (session_type, "x") != 0)
666+ {
667+ g_warning ("X remote seat only supports X display servers, not '%s'", session_type);
668+ return NULL;
669+ }
670+
671 hostname = seat_get_string_property (seat, "xserver-hostname");
672 if (!hostname)
673 hostname = "localhost";
674
675=== modified file 'src/seat-xvnc.c'
676--- src/seat-xvnc.c 2013-07-24 06:45:23 +0000
677+++ src/seat-xvnc.c 2013-07-26 05:19:27 +0000
678@@ -9,6 +9,8 @@
679 * license.
680 */
681
682+#include <string.h>
683+
684 #include "seat-xvnc.h"
685 #include "x-server-xvnc.h"
686 #include "configuration.h"
687@@ -32,11 +34,14 @@
688 }
689
690 static DisplayServer *
691-seat_xvnc_create_display_server (Seat *seat)
692+seat_xvnc_create_display_server (Seat *seat, const gchar *session_type)
693 {
694 XServerXVNC *x_server;
695 const gchar *command = NULL;
696
697+ if (strcmp (session_type, "x") != 0)
698+ return NULL;
699+
700 x_server = x_server_xvnc_new ();
701 x_server_xvnc_set_socket (x_server, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
702
703
704=== modified file 'src/seat.c'
705--- src/seat.c 2013-07-26 03:03:03 +0000
706+++ src/seat.c 2013-07-26 05:19:27 +0000
707@@ -47,6 +47,9 @@
708
709 /* The session to set active when it starts */
710 Session *session_to_activate;
711+
712+ /* TRUE once we have started */
713+ gboolean started;
714
715 /* TRUE if stopping this seat (waiting for displays to stop) */
716 gboolean stopping;
717@@ -70,7 +73,7 @@
718 static GHashTable *seat_modules = NULL;
719
720 // FIXME: Make a get_display_server() that re-uses display servers if supported
721-static DisplayServer *create_display_server (Seat *seat);
722+static DisplayServer *create_display_server (Seat *seat, const gchar *session_type);
723 static Greeter *create_greeter_session (Seat *seat);
724 static void start_session (Seat *seat, Session *session);
725
726@@ -318,7 +321,7 @@
727 g_signal_handlers_disconnect_matched (display_server, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
728 seat->priv->display_servers = g_list_remove (seat->priv->display_servers, display_server);
729
730- if (seat->priv->stopping)
731+ if (seat->priv->stopping || !seat->priv->started)
732 {
733 check_stopped (seat);
734 g_object_unref (display_server);
735@@ -390,7 +393,7 @@
736 {
737 DisplayServer *display_server;
738
739- display_server = create_display_server (seat);
740+ display_server = create_display_server (seat, session_get_session_type (session));
741 if (!display_server_start (display_server))
742 {
743 g_debug ("Failed to start display server for greeter");
744@@ -495,7 +498,15 @@
745
746 g_debug ("Session stopped");
747
748+ g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
749+ seat->priv->sessions = g_list_remove (seat->priv->sessions, session);
750+
751 display_server = session_get_display_server (session);
752+ if (!display_server)
753+ {
754+ g_object_unref (session);
755+ return;
756+ }
757
758 /* Cleanup */
759 if (!IS_GREETER (session))
760@@ -506,9 +517,6 @@
761 run_script (seat, display_server, script, session_get_user (session));
762 }
763
764- g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
765- seat->priv->sessions = g_list_remove (seat->priv->sessions, session);
766-
767 /* We were waiting for this session, but it didn't start :( */
768 // FIXME: Start a greeter on this?
769 if (session == seat->priv->session_to_activate)
770@@ -740,6 +748,7 @@
771 gchar **argv;
772
773 session = create_session (seat, TRUE);
774+ session_set_session_type (session, session_config_get_session_type (session_config));
775 session_set_env (session, "DESKTOP_SESSION", session_name);
776 session_set_env (session, "GDMSESSION", session_name);
777 if (language && language[0] != '\0')
778@@ -782,6 +791,7 @@
779 }
780
781 session = create_session (seat, TRUE);
782+ session_set_session_type (session, session_config_get_session_type (session_config));
783 session_set_do_authenticate (session, TRUE);
784 session_set_is_guest (session, TRUE);
785 argv = get_session_argv (session_config, seat_get_string_property (seat, "session-wrapper"));
786@@ -798,6 +808,7 @@
787 Session *session;
788
789 session = create_session (seat, FALSE);
790+ session_set_session_type (session, session_get_session_type (SESSION (greeter)));
791 session_set_display_server (session, session_get_display_server (SESSION (greeter)));
792
793 return g_object_ref (session);
794@@ -910,6 +921,7 @@
795 return FALSE;
796 }
797
798+ session_set_session_type (session, session_config_get_session_type (session_config));
799 argv = get_session_argv (session_config, seat_get_string_property (seat, "session-wrapper"));
800 session_set_argv (session, argv);
801 g_strfreev (argv);
802@@ -925,7 +937,8 @@
803
804 /* If can re-use the display server, stop the greeter first */
805 display_server = session_get_display_server (SESSION (greeter));
806- if (can_share_display_server (seat, display_server))
807+ if (can_share_display_server (seat, display_server) &&
808+ strcmp (display_server_get_session_type (display_server), session_get_session_type (session)) == 0)
809 {
810 g_debug ("Stopping greeter; display server will be re-used for user session");
811
812@@ -940,7 +953,7 @@
813 /* Otherwise start a new display server for this session */
814 else
815 {
816- display_server = create_display_server (seat);
817+ display_server = create_display_server (seat, session_get_session_type (session));
818 session_set_display_server (session, display_server);
819 if (!display_server_start (display_server))
820 {
821@@ -980,6 +993,7 @@
822 }
823
824 greeter_session = SEAT_GET_CLASS (seat)->create_greeter_session (seat);
825+ session_set_session_type (SESSION (greeter_session), session_config_get_session_type (session_config));
826 seat->priv->sessions = g_list_append (seat->priv->sessions, SESSION (greeter_session));
827 g_signal_connect (greeter_session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat);
828 g_signal_connect (greeter_session, "stopped", G_CALLBACK (session_stopped_cb), seat);
829@@ -1069,13 +1083,16 @@
830 }
831
832 static DisplayServer *
833-create_display_server (Seat *seat)
834+create_display_server (Seat *seat, const gchar *session_type)
835 {
836 DisplayServer *display_server;
837
838- g_debug ("Creating display server");
839-
840- display_server = SEAT_GET_CLASS (seat)->create_display_server (seat);
841+ g_debug ("Creating display server of type %s", session_type);
842+
843+ display_server = SEAT_GET_CLASS (seat)->create_display_server (seat, session_type);
844+ if (!display_server)
845+ return NULL;
846+
847 seat->priv->display_servers = g_list_append (seat->priv->display_servers, display_server);
848 g_signal_connect (display_server, "ready", G_CALLBACK (display_server_ready_cb), seat);
849 g_signal_connect (display_server, "stopped", G_CALLBACK (display_server_stopped_cb), seat);
850@@ -1123,7 +1140,7 @@
851 g_object_unref (seat->priv->session_to_activate);
852 seat->priv->session_to_activate = g_object_ref (greeter_session);
853
854- display_server = create_display_server (seat);
855+ display_server = create_display_server (seat, session_get_session_type (SESSION (greeter_session)));
856 session_set_display_server (SESSION (greeter_session), display_server);
857 if (!display_server_start (display_server))
858 return FALSE;
859@@ -1161,7 +1178,7 @@
860 seat->priv->session_to_activate = g_object_ref (session);
861 session_set_pam_service (session, USER_SERVICE);
862
863- display_server = create_display_server (seat);
864+ display_server = create_display_server (seat, session_get_session_type (session));
865 session_set_display_server (session, display_server);
866 if (!display_server_start (display_server))
867 return FALSE;
868@@ -1208,7 +1225,7 @@
869 if (!session)
870 return FALSE;
871
872- display_server = create_display_server (seat);
873+ display_server = create_display_server (seat, session_get_session_type (session));
874 if (!display_server_start (display_server))
875 return FALSE;
876
877@@ -1247,7 +1264,7 @@
878 if (!greeter_session)
879 return FALSE;
880
881- display_server = create_display_server (seat);
882+ display_server = create_display_server (seat, session_get_session_type (SESSION (greeter_session)));
883 if (!display_server_start (display_server))
884 return FALSE;
885
886@@ -1301,14 +1318,14 @@
887 gboolean autologin_guest;
888 gboolean autologin_in_background;
889 Session *session = NULL, *background_session = NULL;
890- DisplayServer *display_server;
891
892 g_debug ("Starting seat");
893
894 /* If this display server doesn't have a session running on it, just start it */
895 if (!get_start_local_sessions (seat))
896 {
897- display_server = create_display_server (seat);
898+ DisplayServer *display_server;
899+ display_server = create_display_server (seat, "x"); // FIXME: Not necessarily an X seat, but not sure what to put here
900 return display_server_start (display_server);
901 }
902
903@@ -1327,20 +1344,35 @@
904 session = create_guest_session (seat);
905 else if (autologin_username != NULL)
906 session = create_user_session (seat, autologin_username);
907+
908+ if (session)
909+ session_set_pam_service (session, AUTOLOGIN_SERVICE);
910+
911+ /* Load in background if required */
912+ if (autologin_in_background && session)
913+ {
914+ background_session = session;
915+ session = NULL;
916+ }
917
918 if (session)
919 {
920+ DisplayServer *display_server;
921+
922 if (seat->priv->session_to_activate)
923 g_object_unref (seat->priv->session_to_activate);
924 seat->priv->session_to_activate = g_object_ref (session);
925- session_set_pam_service (session, AUTOLOGIN_SERVICE);
926- }
927
928- /* Load in background if required */
929- if (autologin_in_background && session)
930- {
931- background_session = session;
932- session = NULL;
933+ display_server = create_display_server (seat, session_get_session_type (session));
934+ session_set_display_server (session, display_server);
935+ if (!display_server || !display_server_start (display_server))
936+ {
937+ g_debug ("Can't create display server for automatic login");
938+ session_stop (session);
939+ if (display_server)
940+ display_server_stop (display_server);
941+ session = NULL;
942+ }
943 }
944 }
945
946@@ -1348,8 +1380,15 @@
947 if (!session)
948 {
949 Greeter *greeter_session;
950+ DisplayServer *display_server;
951
952 greeter_session = create_greeter_session (seat);
953+ if (!greeter_session)
954+ {
955+ g_debug ("Failed to create greeter session");
956+ return FALSE;
957+ }
958+
959 if (seat->priv->session_to_activate)
960 g_object_unref (seat->priv->session_to_activate);
961 seat->priv->session_to_activate = g_object_ref (greeter_session);
962@@ -1367,6 +1406,17 @@
963 if (autologin_guest)
964 greeter_set_hint (greeter_session, "autologin-guest", "true");
965 }
966+
967+ display_server = create_display_server (seat, session_get_session_type (session));
968+ session_set_display_server (session, display_server);
969+ if (!display_server || !display_server_start (display_server))
970+ {
971+ g_debug ("Can't create display server for greeter");
972+ session_stop (session);
973+ if (display_server)
974+ display_server_stop (display_server);
975+ session = NULL;
976+ }
977 }
978
979 /* Fail if can't start a session */
980@@ -1376,26 +1426,18 @@
981 return FALSE;
982 }
983
984- display_server = create_display_server (seat);
985- if (!display_server)
986- return FALSE;
987-
988- /* Start display server to show session on */
989- session_set_display_server (session, display_server);
990- if (!display_server_start (display_server))
991- return FALSE;
992-
993 /* Start background session */
994 if (background_session)
995 {
996 DisplayServer *background_display_server;
997
998- background_display_server = create_display_server (seat);
999+ background_display_server = create_display_server (seat, session_get_session_type (background_session));
1000 session_set_display_server (background_session, background_display_server);
1001 if (!display_server_start (background_display_server))
1002 g_warning ("Failed to start display server for background session");
1003 }
1004
1005+ seat->priv->started = TRUE;
1006 return TRUE;
1007 }
1008
1009
1010=== modified file 'src/seat.h'
1011--- src/seat.h 2013-07-24 03:54:05 +0000
1012+++ src/seat.h 2013-07-26 05:19:27 +0000
1013@@ -40,7 +40,8 @@
1014 gboolean (*get_start_local_sessions) (Seat *seat);
1015 void (*setup)(Seat *seat);
1016 gboolean (*start)(Seat *seat);
1017- DisplayServer *(*create_display_server) (Seat *seat);
1018+ DisplayServer *(*create_display_server) (Seat *seat, const gchar *session_type);
1019+ gboolean (*display_server_supports_session_type) (Seat *seat, DisplayServer *display_server, const gchar *session_type);
1020 Greeter *(*create_greeter_session) (Seat *seat);
1021 Session *(*create_session) (Seat *seat);
1022 void (*set_active_session)(Seat *seat, Session *session);
1023
1024=== modified file 'src/session-config.c'
1025--- src/session-config.c 2013-07-24 03:57:06 +0000
1026+++ src/session-config.c 2013-07-26 05:19:27 +0000
1027@@ -13,6 +13,9 @@
1028
1029 struct SessionConfigPrivate
1030 {
1031+ /* Session type */
1032+ gchar *session_type;
1033+
1034 /* Command to run */
1035 gchar *command;
1036 };
1037@@ -41,6 +44,9 @@
1038
1039 config = g_object_new (SESSION_CONFIG_TYPE, NULL);
1040 config->priv->command = command;
1041+ config->priv->session_type = g_key_file_get_string (desktop_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
1042+ if (!config->priv->session_type)
1043+ config->priv->session_type = g_strdup ("x");
1044
1045 g_key_file_free (desktop_file);
1046
1047@@ -54,6 +60,12 @@
1048 return config->priv->command;
1049 }
1050
1051+const gchar *
1052+session_config_get_session_type (SessionConfig *config)
1053+{
1054+ g_return_val_if_fail (config != NULL, NULL);
1055+ return config->priv->session_type;
1056+}
1057
1058 static void
1059 session_config_init (SessionConfig *config)
1060@@ -66,6 +78,7 @@
1061 {
1062 SessionConfig *self = SESSION_CONFIG (object);
1063
1064+ g_free (self->priv->session_type);
1065 g_free (self->priv->command);
1066
1067 G_OBJECT_CLASS (session_config_parent_class)->finalize (object);
1068
1069=== modified file 'src/session-config.h'
1070--- src/session-config.h 2013-07-24 03:57:06 +0000
1071+++ src/session-config.h 2013-07-26 05:19:27 +0000
1072@@ -40,6 +40,7 @@
1073
1074 const gchar *session_config_get_command (SessionConfig *config);
1075
1076+const gchar *session_config_get_session_type (SessionConfig *config);
1077
1078 G_END_DECLS
1079
1080
1081=== modified file 'src/session.c'
1082--- src/session.c 2013-07-26 01:31:52 +0000
1083+++ src/session.c 2013-07-26 05:19:27 +0000
1084@@ -37,6 +37,9 @@
1085
1086 struct SessionPrivate
1087 {
1088+ /* Session type */
1089+ gchar *session_type;
1090+
1091 /* Display server running on */
1092 DisplayServer *display_server;
1093
1094@@ -126,6 +129,21 @@
1095 }
1096
1097 void
1098+session_set_session_type (Session *session, const gchar *session_type)
1099+{
1100+ g_return_if_fail (session != NULL);
1101+ g_free (session->priv->session_type);
1102+ session->priv->session_type = g_strdup (session_type);
1103+}
1104+
1105+const gchar *
1106+session_get_session_type (Session *session)
1107+{
1108+ g_return_val_if_fail (session != NULL, NULL);
1109+ return session->priv->session_type;
1110+}
1111+
1112+void
1113 session_set_pam_service (Session *session, const gchar *pam_service)
1114 {
1115 g_return_if_fail (session != NULL);
1116@@ -829,6 +847,7 @@
1117 Session *self = SESSION (object);
1118 int i;
1119
1120+ g_free (self->priv->session_type);
1121 if (self->priv->display_server)
1122 g_object_unref (self->priv->display_server);
1123 if (self->priv->pid)
1124
1125=== modified file 'src/session.h'
1126--- src/session.h 2013-07-26 01:31:52 +0000
1127+++ src/session.h 2013-07-26 05:19:27 +0000
1128@@ -64,6 +64,10 @@
1129
1130 Session *session_new (void);
1131
1132+void session_set_session_type (Session *session, const gchar *session_type);
1133+
1134+const gchar *session_get_session_type (Session *session);
1135+
1136 void session_set_pam_service (Session *session, const gchar *pam_service);
1137
1138 void session_set_username (Session *session, const gchar *username);
1139
1140=== modified file 'src/x-server.c'
1141--- src/x-server.c 2013-07-26 02:14:10 +0000
1142+++ src/x-server.c 2013-07-26 05:19:27 +0000
1143@@ -105,6 +105,12 @@
1144 return server->priv->authority;
1145 }
1146
1147+static const gchar *
1148+x_server_get_session_type (DisplayServer *server)
1149+{
1150+ return "x";
1151+}
1152+
1153 static gboolean
1154 x_server_get_can_share (DisplayServer *server)
1155 {
1156@@ -208,6 +214,7 @@
1157 GObjectClass *object_class = G_OBJECT_CLASS (klass);
1158 DisplayServerClass *display_server_class = DISPLAY_SERVER_CLASS (klass);
1159
1160+ display_server_class->get_session_type = x_server_get_session_type;
1161 display_server_class->get_can_share = x_server_get_can_share;
1162 display_server_class->start = x_server_start;
1163 display_server_class->connect_session = x_server_connect_session;
1164
1165=== modified file 'tests/Makefile.am'
1166--- tests/Makefile.am 2013-07-22 03:13:13 +0000
1167+++ tests/Makefile.am 2013-07-26 05:19:27 +0000
1168@@ -27,12 +27,9 @@
1169 test-autologin-new-authtok \
1170 test-autologin-gobject-timeout \
1171 test-autologin-gobject-guest-timeout \
1172- test-autologin-python-timeout \
1173- test-autologin-python-guest-timeout \
1174 test-change-authentication \
1175 test-restart-authentication \
1176 test-gobject-cancel-authentication \
1177- test-python-cancel-authentication \
1178 test-pam \
1179 test-login-pam \
1180 test-denied \
1181@@ -59,7 +56,6 @@
1182 test-user-renamed \
1183 test-user-renamed-invalid \
1184 test-users-gobject \
1185- test-users-python \
1186 test-keyboard-layout \
1187 test-no-keyboard-layout \
1188 test-language \
1189@@ -90,29 +86,6 @@
1190 test-login-gobject-guest-fail-setup-script \
1191 test-login-gobject-guest-logout \
1192 test-login-gobject-remote-session \
1193- test-login-python \
1194- test-login-python-manual \
1195- test-login-python-manual-previous-session \
1196- test-login-python-no-password \
1197- test-login-python-long-username \
1198- test-login-python-long-password \
1199- test-login-python-two-factor \
1200- test-login-python-new-authtok \
1201- test-login-python-info-prompt \
1202- test-login-python-multi-info-prompt \
1203- test-login-python-previous-session \
1204- test-login-python-wrong-password \
1205- test-login-python-invalid-user \
1206- test-login-python-invalid-session \
1207- test-login-python-logout \
1208- test-login-python-pick-session \
1209- test-login-python-remember-session \
1210- test-login-python-guest \
1211- test-login-python-guest-disabled \
1212- test-login-python-guest-no-setup-script \
1213- test-login-python-guest-fail-setup-script \
1214- test-login-python-guest-logout \
1215- test-login-python-remote-session \
1216 test-login-session-crash \
1217 test-login-xserver-crash \
1218 test-xserver-no-share \
1219@@ -159,19 +132,22 @@
1220 test-gobject-power-no-console-kit \
1221 test-gobject-power-no-login1 \
1222 test-gobject-power-no-services \
1223- test-python-power \
1224- test-python-power-no-console-kit \
1225- test-python-power-no-login1 \
1226- test-python-power-no-services \
1227 test-open-file-descriptors \
1228 test-xdmcp-server-open-file-descriptors \
1229+ test-mir-autologin \
1230+ test-mir-greeter \
1231+ test-mir-session \
1232 test-unity-compositor-command \
1233 test-unity-compositor-fail-start \
1234 test-unity-compositor-fail-ready \
1235 test-unity-autologin \
1236 test-unity-login \
1237 test-unity-switch \
1238- test-unity-plymouth
1239+ test-unity-plymouth \
1240+ test-unity-mir-autologin \
1241+ test-unity-mir-greeter-x-session \
1242+ test-unity-mir-greeter-mir-session \
1243+ test-unity-mir-session-x-greeter
1244
1245 # test-session-exit-error
1246 # test-greeter-no-exit
1247@@ -179,6 +155,39 @@
1248 # test-qt-change-password
1249 # test-autologin-create-directory
1250
1251+TESTS += \
1252+ test-python-cancel-authentication \
1253+ test-users-python \
1254+ test-login-python \
1255+ test-login-python-manual \
1256+ test-login-python-manual-previous-session \
1257+ test-login-python-no-password \
1258+ test-login-python-long-username \
1259+ test-login-python-long-password \
1260+ test-login-python-two-factor \
1261+ test-login-python-new-authtok \
1262+ test-login-python-info-prompt \
1263+ test-login-python-multi-info-prompt \
1264+ test-login-python-previous-session \
1265+ test-login-python-wrong-password \
1266+ test-login-python-invalid-user \
1267+ test-login-python-invalid-session \
1268+ test-login-python-logout \
1269+ test-login-python-pick-session \
1270+ test-login-python-remember-session \
1271+ test-login-python-guest \
1272+ test-login-python-guest-disabled \
1273+ test-login-python-guest-no-setup-script \
1274+ test-login-python-guest-fail-setup-script \
1275+ test-login-python-guest-logout \
1276+ test-login-python-remote-session \
1277+ test-autologin-python-timeout \
1278+ test-autologin-python-guest-timeout \
1279+ test-python-power \
1280+ test-python-power-no-console-kit \
1281+ test-python-power-no-login1 \
1282+ test-python-power-no-services
1283+
1284 if COMPILE_LIBLIGHTDM_QT4
1285 TESTS += \
1286 test-autologin-qt4-timeout \
1287@@ -255,11 +264,13 @@
1288 data/system.conf \
1289 data/session.conf \
1290 data/greeters/test-gobject-greeter.desktop \
1291+ data/greeters/test-mir-greeter.desktop \
1292 data/greeters/test-python-greeter.desktop \
1293 data/greeters/test-qt4-greeter.desktop \
1294 data/greeters/test-qt5-greeter.desktop \
1295 data/sessions/alternative.desktop \
1296 data/sessions/default.desktop \
1297+ data/sessions/mir.desktop \
1298 scripts/0-additional.conf \
1299 scripts/1-additional.conf \
1300 scripts/additional-config.conf \
1301@@ -342,6 +353,9 @@
1302 scripts/login-two-factor.conf \
1303 scripts/login-wrong-password.conf \
1304 scripts/login-xserver-crash.conf \
1305+ scripts/mir-autologin.conf \
1306+ scripts/mir-greeter.conf \
1307+ scripts/mir-session.conf \
1308 scripts/no-accounts-service.conf \
1309 scripts/no-config.conf \
1310 scripts/no-console-kit.conf \
1311@@ -386,6 +400,10 @@
1312 scripts/unity-compositor-fail-ready.conf \
1313 scripts/unity-compositor-fail-start.conf \
1314 scripts/unity-login.conf \
1315+ scripts/unity-mir-autologin.conf \
1316+ scripts/unity-mir-greeter-mir-session.conf \
1317+ scripts/unity-mir-greeter-x-session.conf \
1318+ scripts/unity-mir-session-x-greeter.conf \
1319 scripts/unity-plymouth.conf \
1320 scripts/unity-switch.conf \
1321 scripts/users.conf \
1322
1323=== added file 'tests/data/greeters/test-mir-greeter.desktop'
1324--- tests/data/greeters/test-mir-greeter.desktop 1970-01-01 00:00:00 +0000
1325+++ tests/data/greeters/test-mir-greeter.desktop 2013-07-26 05:19:27 +0000
1326@@ -0,0 +1,5 @@
1327+[Desktop Entry]
1328+Name=Test GObject Greeter
1329+Comment=LightDM test GObject greeter
1330+Exec=test-gobject-greeter
1331+X-LightDM-Session-Type=mir
1332
1333=== added file 'tests/data/sessions/mir.desktop'
1334--- tests/data/sessions/mir.desktop 1970-01-01 00:00:00 +0000
1335+++ tests/data/sessions/mir.desktop 2013-07-26 05:19:27 +0000
1336@@ -0,0 +1,5 @@
1337+[Desktop Entry]
1338+Name=Test Session
1339+Comment=LightDM test Mir session
1340+Exec=test-session
1341+X-LightDM-Session-Type=mir
1342
1343=== added file 'tests/scripts/mir-autologin.conf'
1344--- tests/scripts/mir-autologin.conf 1970-01-01 00:00:00 +0000
1345+++ tests/scripts/mir-autologin.conf 2013-07-26 05:19:27 +0000
1346@@ -0,0 +1,32 @@
1347+#
1348+# Check can't automatically log into a Mir session from a VT based seat
1349+#
1350+
1351+[SeatDefaults]
1352+autologin-user=have-password1
1353+user-session=mir
1354+
1355+#?RUNNER DAEMON-START
1356+
1357+# (session fails to start)
1358+
1359+# X server starts
1360+#?XSERVER-0 START VT=7
1361+
1362+# Daemon connects when X server is ready
1363+#?*XSERVER-0 INDICATE-READY
1364+#?XSERVER-0 INDICATE-READY
1365+#?XSERVER-0 ACCEPT-CONNECT
1366+
1367+# Greeter starts
1368+#?GREETER-X-0 START
1369+#?XSERVER-0 ACCEPT-CONNECT
1370+#?GREETER-X-0 CONNECT-XSERVER
1371+#?GREETER-X-0 CONNECT-TO-DAEMON
1372+#?GREETER-X-0 CONNECTED-TO-DAEMON
1373+
1374+# Cleanup
1375+#?*STOP-DAEMON
1376+#?GREETER-X-0 TERMINATE SIGNAL=15
1377+#?XSERVER-0 TERMINATE SIGNAL=15
1378+#?RUNNER DAEMON-EXIT STATUS=0
1379
1380=== added file 'tests/scripts/mir-greeter.conf'
1381--- tests/scripts/mir-greeter.conf 1970-01-01 00:00:00 +0000
1382+++ tests/scripts/mir-greeter.conf 2013-07-26 05:19:27 +0000
1383@@ -0,0 +1,10 @@
1384+#
1385+# Check can't run a Mir greeter from a VT based seat
1386+#
1387+
1388+#?RUNNER DAEMON-START
1389+
1390+# (greeter fails to start)
1391+
1392+# Daemon stops with error
1393+#?RUNNER DAEMON-EXIT STATUS=1
1394
1395=== added file 'tests/scripts/mir-session.conf'
1396--- tests/scripts/mir-session.conf 1970-01-01 00:00:00 +0000
1397+++ tests/scripts/mir-session.conf 2013-07-26 05:19:27 +0000
1398@@ -0,0 +1,34 @@
1399+#
1400+# Check can't login into a Mir session on a VT based seat
1401+#
1402+
1403+[SeatDefaults]
1404+user-session=mir
1405+
1406+#?RUNNER DAEMON-START
1407+
1408+# X server starts
1409+#?XSERVER-0 START VT=7
1410+
1411+# Daemon connects when X server is ready
1412+#?*XSERVER-0 INDICATE-READY
1413+#?XSERVER-0 INDICATE-READY
1414+#?XSERVER-0 ACCEPT-CONNECT
1415+
1416+# Greeter starts
1417+#?GREETER-X-0 START
1418+#?XSERVER-0 ACCEPT-CONNECT
1419+#?GREETER-X-0 CONNECT-XSERVER
1420+#?GREETER-X-0 CONNECT-TO-DAEMON
1421+#?GREETER-X-0 CONNECTED-TO-DAEMON
1422+
1423+# Attempt to log into account
1424+#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
1425+#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
1426+#?*GREETER-X-0 SESSION-FAILED
1427+
1428+# Cleanup
1429+#?*STOP-DAEMON
1430+#?GREETER-X-0 TERMINATE SIGNAL=15
1431+#?XSERVER-0 TERMINATE SIGNAL=15
1432+#?RUNNER DAEMON-EXIT STATUS=0
1433
1434=== added file 'tests/scripts/unity-mir-autologin.conf'
1435--- tests/scripts/unity-mir-autologin.conf 1970-01-01 00:00:00 +0000
1436+++ tests/scripts/unity-mir-autologin.conf 2013-07-26 05:19:27 +0000
1437@@ -0,0 +1,26 @@
1438+#
1439+# Check can run automatically log into a Mir session
1440+#
1441+
1442+[SeatDefaults]
1443+type=unity
1444+autologin-user=have-password1
1445+user-session=mir
1446+
1447+#?RUNNER DAEMON-START
1448+
1449+# System compositor starts
1450+#?UNITY-SYSTEM-COMPOSITOR START VT=7
1451+#?*UNITY-SYSTEM-COMPOSITOR READY
1452+
1453+# Session starts
1454+#?SESSION-MIR-0 START USER=have-password1
1455+
1456+# System compositor switches to session
1457+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=0
1458+
1459+# Cleanup
1460+#?*STOP-DAEMON
1461+#?SESSION-MIR-0 TERMINATE SIGNAL=15
1462+#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
1463+#?RUNNER DAEMON-EXIT STATUS=0
1464
1465=== added file 'tests/scripts/unity-mir-greeter-mir-session.conf'
1466--- tests/scripts/unity-mir-greeter-mir-session.conf 1970-01-01 00:00:00 +0000
1467+++ tests/scripts/unity-mir-greeter-mir-session.conf 2013-07-26 05:19:27 +0000
1468@@ -0,0 +1,41 @@
1469+#
1470+# Check can log into a Mir session from a Mir greeter
1471+#
1472+
1473+[SeatDefaults]
1474+type=unity
1475+user-session=mir
1476+
1477+#?RUNNER DAEMON-START
1478+
1479+# System compositor starts
1480+#?UNITY-SYSTEM-COMPOSITOR START VT=7
1481+#?*UNITY-SYSTEM-COMPOSITOR READY
1482+
1483+# Greeter starts
1484+#?GREETER-MIR-0 START
1485+#?GREETER-MIR-0 CONNECT-TO-DAEMON
1486+#?GREETER-MIR-0 CONNECTED-TO-DAEMON
1487+
1488+# System compositor switches to greeter
1489+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=0
1490+
1491+# Log into account with a password
1492+#?*GREETER-MIR-0 AUTHENTICATE USERNAME=no-password1
1493+#?GREETER-MIR-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
1494+#?*GREETER-MIR-0 START-SESSION
1495+
1496+# Session starts
1497+#?SESSION-MIR-1 START USER=no-password1
1498+
1499+# System compositor switches to session
1500+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=1
1501+
1502+# Greeter stops
1503+#?GREETER-MIR-0 TERMINATE SIGNAL=15
1504+
1505+# Cleanup
1506+#?*STOP-DAEMON
1507+#?SESSION-MIR-1 TERMINATE SIGNAL=15
1508+#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
1509+#?RUNNER DAEMON-EXIT STATUS=0
1510
1511=== added file 'tests/scripts/unity-mir-greeter-x-session.conf'
1512--- tests/scripts/unity-mir-greeter-x-session.conf 1970-01-01 00:00:00 +0000
1513+++ tests/scripts/unity-mir-greeter-x-session.conf 2013-07-26 05:19:27 +0000
1514@@ -0,0 +1,52 @@
1515+#
1516+# Check can log into an X session from a Mir greeter
1517+#
1518+
1519+[SeatDefaults]
1520+type=unity
1521+user-session=default
1522+
1523+#?RUNNER DAEMON-START
1524+
1525+# System compositor starts
1526+#?UNITY-SYSTEM-COMPOSITOR START VT=7
1527+#?*UNITY-SYSTEM-COMPOSITOR READY
1528+
1529+# Greeter starts
1530+#?GREETER-MIR-0 START
1531+#?GREETER-MIR-0 CONNECT-TO-DAEMON
1532+#?GREETER-MIR-0 CONNECTED-TO-DAEMON
1533+
1534+# System compositor switches to greeter
1535+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=0
1536+
1537+# Log into account with a password
1538+#?*GREETER-MIR-0 AUTHENTICATE USERNAME=no-password1
1539+#?GREETER-MIR-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
1540+#?*GREETER-MIR-0 START-SESSION
1541+
1542+# X server starts
1543+#?XSERVER-0 START MIR-ID=1
1544+
1545+# Daemon connects when X server is ready
1546+#?*XSERVER-0 INDICATE-READY
1547+#?XSERVER-0 INDICATE-READY
1548+#?XSERVER-0 ACCEPT-CONNECT
1549+
1550+# Session starts
1551+#?SESSION-X-0 START USER=no-password1
1552+#?XSERVER-0 ACCEPT-CONNECT
1553+#?SESSION-X-0 CONNECT-XSERVER
1554+
1555+# System compositor switches to session
1556+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=1
1557+
1558+# Greeter stops
1559+#?GREETER-MIR-0 TERMINATE SIGNAL=15
1560+
1561+# Cleanup
1562+#?*STOP-DAEMON
1563+#?SESSION-X-0 TERMINATE SIGNAL=15
1564+#?XSERVER-0 TERMINATE SIGNAL=15
1565+#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
1566+#?RUNNER DAEMON-EXIT STATUS=0
1567
1568=== added file 'tests/scripts/unity-mir-session-x-greeter.conf'
1569--- tests/scripts/unity-mir-session-x-greeter.conf 1970-01-01 00:00:00 +0000
1570+++ tests/scripts/unity-mir-session-x-greeter.conf 2013-07-26 05:19:27 +0000
1571@@ -0,0 +1,52 @@
1572+#
1573+# Check can log into a Mir session from an X greeter
1574+#
1575+
1576+[SeatDefaults]
1577+type=unity
1578+user-session=mir
1579+
1580+#?RUNNER DAEMON-START
1581+
1582+# System compositor starts
1583+#?UNITY-SYSTEM-COMPOSITOR START VT=7
1584+#?*UNITY-SYSTEM-COMPOSITOR READY
1585+
1586+# X server starts
1587+#?XSERVER-0 START MIR-ID=0
1588+
1589+# Daemon connects when X server is ready
1590+#?*XSERVER-0 INDICATE-READY
1591+#?XSERVER-0 INDICATE-READY
1592+#?XSERVER-0 ACCEPT-CONNECT
1593+
1594+# Greeter starts
1595+#?GREETER-X-0 START
1596+#?XSERVER-0 ACCEPT-CONNECT
1597+#?GREETER-X-0 CONNECT-XSERVER
1598+#?GREETER-X-0 CONNECT-TO-DAEMON
1599+#?GREETER-X-0 CONNECTED-TO-DAEMON
1600+
1601+# System compositor switches to greeter
1602+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=0
1603+
1604+# Log into account
1605+#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
1606+#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
1607+#?*GREETER-X-0 START-SESSION
1608+
1609+# Session starts
1610+#?SESSION-MIR-1 START USER=no-password1
1611+
1612+# System compositor switches to session
1613+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=1
1614+
1615+# Greeter quits once session ready
1616+#?GREETER-X-0 TERMINATE SIGNAL=15
1617+#?XSERVER-0 TERMINATE SIGNAL=15
1618+
1619+# Cleanup
1620+#?*STOP-DAEMON
1621+#?SESSION-MIR-1 TERMINATE SIGNAL=15
1622+#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
1623+#?RUNNER DAEMON-EXIT STATUS=0
1624
1625=== modified file 'tests/src/Makefile.am'
1626--- tests/src/Makefile.am 2013-07-24 00:45:26 +0000
1627+++ tests/src/Makefile.am 2013-07-26 05:19:27 +0000
1628@@ -3,6 +3,7 @@
1629 plymouth \
1630 test-gobject-greeter \
1631 test-greeter-wrapper \
1632+ test-mir-greeter \
1633 test-runner \
1634 test-script-hook \
1635 test-session \
1636@@ -107,7 +108,19 @@
1637 -llightdm-gobject-1 \
1638 $(GLIB_LIBS) \
1639 $(GIO_UNIX_LIBS) \
1640- $(XCB_LIBS)
1641+ $(XCB_LIBS)
1642+
1643+test_mir_greeter_SOURCES = test-mir-greeter.c status.c status.h
1644+test_mir_greeter_CFLAGS = \
1645+ -I$(top_srcdir)/liblightdm-gobject \
1646+ $(WARN_CFLAGS) \
1647+ $(GLIB_CFLAGS) \
1648+ $(GIO_UNIX_CFLAGS)
1649+test_mir_greeter_LDADD = \
1650+ -L$(top_builddir)/liblightdm-gobject \
1651+ -llightdm-gobject-1 \
1652+ $(GLIB_LIBS) \
1653+ $(GIO_UNIX_LIBS)
1654
1655 guest_account_SOURCES = guest-account.c status.c status.h
1656 guest_account_CFLAGS = \
1657
1658=== modified file 'tests/src/test-gobject-greeter.c'
1659--- tests/src/test-gobject-greeter.c 2013-07-26 02:14:10 +0000
1660+++ tests/src/test-gobject-greeter.c 2013-07-26 05:19:27 +0000
1661@@ -299,7 +299,7 @@
1662 int
1663 main (int argc, char **argv)
1664 {
1665- gchar *display;
1666+ gchar *display, *mir_socket, *mir_vt, *mir_id;
1667 GString *status_text;
1668
1669 #if !defined(GLIB_VERSION_2_36)
1670@@ -307,6 +307,9 @@
1671 #endif
1672
1673 display = getenv ("DISPLAY");
1674+ mir_socket = getenv ("MIR_SERVER_FILE");
1675+ mir_vt = getenv ("MIR_SERVER_VT");
1676+ mir_id = getenv ("MIR_ID");
1677 if (display)
1678 {
1679 if (display[0] == ':')
1680@@ -314,6 +317,10 @@
1681 else
1682 greeter_id = g_strdup_printf ("GREETER-X-%s", display);
1683 }
1684+ else if (mir_id)
1685+ greeter_id = g_strdup_printf ("GREETER-MIR-%s", mir_id);
1686+ else if (mir_socket || mir_vt)
1687+ greeter_id = g_strdup ("GREETER-MIR");
1688 else
1689 greeter_id = g_strdup ("GREETER-?");
1690
1691@@ -326,6 +333,8 @@
1692
1693 status_text = g_string_new ("");
1694 g_string_printf (status_text, "%s START", greeter_id);
1695+ if (mir_vt > 0)
1696+ g_string_append_printf (status_text, " VT=%s", mir_vt);
1697 status_notify (status_text->str);
1698 g_string_free (status_text, TRUE);
1699
1700
1701=== added file 'tests/src/test-mir-greeter.c'
1702--- tests/src/test-mir-greeter.c 1970-01-01 00:00:00 +0000
1703+++ tests/src/test-mir-greeter.c 2013-07-26 05:19:27 +0000
1704@@ -0,0 +1,146 @@
1705+/* -*- Mode: C; indent-tabs-mode: nil; tab-width: 4 -*- */
1706+
1707+#include <stdlib.h>
1708+#include <stdio.h>
1709+#include <string.h>
1710+#include <lightdm.h>
1711+
1712+#include "status.h"
1713+
1714+static gchar *greeter_id;
1715+static GMainLoop *loop;
1716+static LightDMGreeter *greeter;
1717+static GKeyFile *config;
1718+
1719+static void
1720+show_message_cb (LightDMGreeter *greeter, const gchar *text, LightDMMessageType type)
1721+{
1722+ status_notify ("%s SHOW-MESSAGE TEXT=\"%s\"", greeter_id, text);
1723+}
1724+
1725+static void
1726+show_prompt_cb (LightDMGreeter *greeter, const gchar *text, LightDMPromptType type)
1727+{
1728+ status_notify ("%s SHOW-PROMPT TEXT=\"%s\"", greeter_id, text);
1729+}
1730+
1731+static void
1732+authentication_complete_cb (LightDMGreeter *greeter)
1733+{
1734+ if (lightdm_greeter_get_authentication_user (greeter))
1735+ status_notify ("%s AUTHENTICATION-COMPLETE USERNAME=%s AUTHENTICATED=%s",
1736+ greeter_id,
1737+ lightdm_greeter_get_authentication_user (greeter),
1738+ lightdm_greeter_get_is_authenticated (greeter) ? "TRUE" : "FALSE");
1739+ else
1740+ status_notify ("%s AUTHENTICATION-COMPLETE AUTHENTICATED=%s",
1741+ greeter_id,
1742+ lightdm_greeter_get_is_authenticated (greeter) ? "TRUE" : "FALSE");
1743+}
1744+
1745+static void
1746+signal_cb (int signum)
1747+{
1748+ status_notify ("%s TERMINATE SIGNAL=%d", greeter_id, signum);
1749+ exit (EXIT_SUCCESS);
1750+}
1751+
1752+static void
1753+request_cb (const gchar *request)
1754+{
1755+ gchar *r;
1756+
1757+ if (!request)
1758+ {
1759+ g_main_loop_quit (loop);
1760+ return;
1761+ }
1762+
1763+ r = g_strdup_printf ("%s AUTHENTICATE", greeter_id);
1764+ if (strcmp (request, r) == 0)
1765+ lightdm_greeter_authenticate (greeter, NULL);
1766+ g_free (r);
1767+
1768+ r = g_strdup_printf ("%s AUTHENTICATE USERNAME=", greeter_id);
1769+ if (g_str_has_prefix (request, r))
1770+ lightdm_greeter_authenticate (greeter, request + strlen (r));
1771+ g_free (r);
1772+
1773+ r = g_strdup_printf ("%s RESPOND TEXT=\"", greeter_id);
1774+ if (g_str_has_prefix (request, r))
1775+ {
1776+ gchar *text = g_strdup (request + strlen (r));
1777+ text[strlen (text) - 1] = '\0';
1778+ lightdm_greeter_respond (greeter, text);
1779+ g_free (text);
1780+ }
1781+ g_free (r);
1782+
1783+ r = g_strdup_printf ("%s CANCEL-AUTHENTICATION", greeter_id);
1784+ if (strcmp (request, r) == 0)
1785+ lightdm_greeter_cancel_authentication (greeter);
1786+ g_free (r);
1787+
1788+ r = g_strdup_printf ("%s START-SESSION", greeter_id);
1789+ if (strcmp (request, r) == 0)
1790+ {
1791+ if (!lightdm_greeter_start_session_sync (greeter, NULL, NULL))
1792+ status_notify ("%s SESSION-FAILED", greeter_id);
1793+ }
1794+ g_free (r);
1795+
1796+ r = g_strdup_printf ("%s START-SESSION SESSION=", greeter_id);
1797+ if (g_str_has_prefix (request, r))
1798+ {
1799+ if (!lightdm_greeter_start_session_sync (greeter, request + strlen (r), NULL))
1800+ status_notify ("%s SESSION-FAILED", greeter_id);
1801+ }
1802+ g_free (r);
1803+}
1804+
1805+int
1806+main (int argc, char **argv)
1807+{
1808+ signal (SIGINT, signal_cb);
1809+ signal (SIGTERM, signal_cb);
1810+
1811+#if !defined(GLIB_VERSION_2_36)
1812+ g_type_init ();
1813+#endif
1814+
1815+ greeter_id = g_strdup ("GREETER-MIR");
1816+
1817+ loop = g_main_loop_new (NULL, FALSE);
1818+
1819+ status_connect (request_cb);
1820+
1821+ status_notify ("%s START", greeter_id);
1822+
1823+ config = g_key_file_new ();
1824+ g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);
1825+
1826+ if (g_key_file_has_key (config, "test-greeter-config", "return-value", NULL))
1827+ {
1828+ int return_value = g_key_file_get_integer (config, "test-greeter-config", "return-value", NULL);
1829+ status_notify ("%s EXIT CODE=%d", greeter_id, return_value);
1830+ return return_value;
1831+ }
1832+
1833+ greeter = lightdm_greeter_new ();
1834+ g_signal_connect (greeter, "show-message", G_CALLBACK (show_message_cb), NULL);
1835+ g_signal_connect (greeter, "show-prompt", G_CALLBACK (show_prompt_cb), NULL);
1836+ g_signal_connect (greeter, "authentication-complete", G_CALLBACK (authentication_complete_cb), NULL);
1837+
1838+ status_notify ("%s CONNECT-TO-DAEMON", greeter_id);
1839+ if (!lightdm_greeter_connect_sync (greeter, NULL))
1840+ {
1841+ status_notify ("%s FAIL-CONNECT-DAEMON", greeter_id);
1842+ return EXIT_FAILURE;
1843+ }
1844+
1845+ status_notify ("%s CONNECTED-TO-DAEMON", greeter_id);
1846+
1847+ g_main_loop_run (loop);
1848+
1849+ return EXIT_SUCCESS;
1850+}
1851
1852=== modified file 'tests/src/test-session.c'
1853--- tests/src/test-session.c 2013-07-26 02:14:10 +0000
1854+++ tests/src/test-session.c 2013-07-26 05:19:27 +0000
1855@@ -167,11 +167,14 @@
1856 int
1857 main (int argc, char **argv)
1858 {
1859- gchar *display;
1860+ gchar *display, *mir_socket, *mir_vt, *mir_id;
1861 GString *status_text;
1862 int fd, open_max;
1863
1864 display = getenv ("DISPLAY");
1865+ mir_socket = getenv ("MIR_SERVER_FILE");
1866+ mir_vt = getenv ("MIR_SERVER_VT");
1867+ mir_id = getenv ("MIR_ID");
1868 if (display)
1869 {
1870 if (display[0] == ':')
1871@@ -179,6 +182,10 @@
1872 else
1873 session_id = g_strdup_printf ("SESSION-X-%s", display);
1874 }
1875+ else if (mir_id)
1876+ session_id = g_strdup_printf ("SESSION-MIR-%s", mir_id);
1877+ else if (mir_socket || mir_vt)
1878+ session_id = g_strdup ("SESSION-MIR");
1879 else
1880 session_id = g_strdup ("SESSION-?");
1881
1882@@ -205,6 +212,8 @@
1883
1884 status_text = g_string_new ("");
1885 g_string_printf (status_text, "%s START", session_id);
1886+ if (mir_vt > 0)
1887+ g_string_append_printf (status_text, " VT=%s", mir_vt);
1888 if (argc > 1)
1889 g_string_append_printf (status_text, " NAME=%s", argv[1]);
1890 g_string_append_printf (status_text, " USER=%s", getenv ("USER"));
1891
1892=== added file 'tests/test-mir-autologin'
1893--- tests/test-mir-autologin 1970-01-01 00:00:00 +0000
1894+++ tests/test-mir-autologin 2013-07-26 05:19:27 +0000
1895@@ -0,0 +1,2 @@
1896+#!/bin/sh
1897+./src/dbus-env ./src/test-runner mir-autologin test-gobject-greeter
1898
1899=== added file 'tests/test-mir-greeter'
1900--- tests/test-mir-greeter 1970-01-01 00:00:00 +0000
1901+++ tests/test-mir-greeter 2013-07-26 05:19:27 +0000
1902@@ -0,0 +1,2 @@
1903+#!/bin/sh
1904+./src/dbus-env ./src/test-runner mir-greeter test-mir-greeter
1905
1906=== added file 'tests/test-mir-session'
1907--- tests/test-mir-session 1970-01-01 00:00:00 +0000
1908+++ tests/test-mir-session 2013-07-26 05:19:27 +0000
1909@@ -0,0 +1,2 @@
1910+#!/bin/sh
1911+./src/dbus-env ./src/test-runner mir-session test-gobject-greeter
1912
1913=== added file 'tests/test-unity-mir-autologin'
1914--- tests/test-unity-mir-autologin 1970-01-01 00:00:00 +0000
1915+++ tests/test-unity-mir-autologin 2013-07-26 05:19:27 +0000
1916@@ -0,0 +1,2 @@
1917+#!/bin/sh
1918+./src/dbus-env ./src/test-runner unity-mir-autologin test-mir-greeter
1919
1920=== added file 'tests/test-unity-mir-greeter-mir-session'
1921--- tests/test-unity-mir-greeter-mir-session 1970-01-01 00:00:00 +0000
1922+++ tests/test-unity-mir-greeter-mir-session 2013-07-26 05:19:27 +0000
1923@@ -0,0 +1,2 @@
1924+#!/bin/sh
1925+./src/dbus-env ./src/test-runner unity-mir-greeter-mir-session test-mir-greeter
1926
1927=== added file 'tests/test-unity-mir-greeter-x-session'
1928--- tests/test-unity-mir-greeter-x-session 1970-01-01 00:00:00 +0000
1929+++ tests/test-unity-mir-greeter-x-session 2013-07-26 05:19:27 +0000
1930@@ -0,0 +1,2 @@
1931+#!/bin/sh
1932+./src/dbus-env ./src/test-runner unity-mir-greeter-x-session test-mir-greeter
1933
1934=== added file 'tests/test-unity-mir-session-x-greeter'
1935--- tests/test-unity-mir-session-x-greeter 1970-01-01 00:00:00 +0000
1936+++ tests/test-unity-mir-session-x-greeter 2013-07-26 05:19:27 +0000
1937@@ -0,0 +1,2 @@
1938+#!/bin/sh
1939+./src/dbus-env ./src/test-runner unity-mir-session-x-greeter test-gobject-greeter

Subscribers

People subscribed via source and target branches