]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/seat-unity.c
add seat name to Seat log messages
[sojka/lightdm.git] / src / seat-unity.c
1 /*
2  * Copyright (C) 2012-2013 Robert Ancell.
3  * Author: Robert Ancell <robert.ancell@canonical.com>
4  *
5  * This program is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9  * license.
10  */
11
12 #include <string.h>
13 #include <fcntl.h>
14 #include <errno.h>
15 #include <glib/gstdio.h>
16
17 #include "seat-unity.h"
18 #include "configuration.h"
19 #include "x-server-local.h"
20 #include "mir-server.h"
21 #include "vt.h"
22 #include "plymouth.h"
23
24 typedef enum
25 {
26    USC_MESSAGE_PING = 0,
27    USC_MESSAGE_PONG = 1,
28    USC_MESSAGE_READY = 2,
29    USC_MESSAGE_SESSION_CONNECTED = 3,
30    USC_MESSAGE_SET_ACTIVE_SESSION = 4
31 } USCMessageID;
32
33 struct SeatUnityPrivate
34 {
35     /* VT we are running on */
36     gint vt;
37
38     /* File to log to */
39     gchar *log_file;
40
41     /* Filename of Mir socket */
42     gchar *mir_socket_filename;
43
44     /* Pipes to communicate with compositor */
45     int to_compositor_pipe[2];
46     int from_compositor_pipe[2];
47
48     /* IO channel listening on for messages from the compositor */
49     GIOChannel *from_compositor_channel;
50
51     /* TRUE when the compositor indicates it is ready */
52     gboolean compositor_ready;
53
54     /* Buffer reading from channel */
55     guint8 *read_buffer;
56     gsize read_buffer_length;
57     gsize read_buffer_n_used;
58
59     /* Compositor process */
60     Process *compositor_process;
61
62     /* Timeout when waiting for compositor to start */
63     guint compositor_timeout;
64
65     /* Next Mir ID to use for a compositor client */
66     gint next_id;
67
68     /* TRUE if using VT switching fallback */
69     gboolean use_vt_switching;
70
71     /* The currently visible session */
72     Session *active_session;
73     DisplayServer *active_display_server;
74 };
75
76 G_DEFINE_TYPE (SeatUnity, seat_unity, SEAT_TYPE);
77
78 static gboolean
79 seat_unity_get_start_local_sessions (Seat *seat)
80 {
81     return !seat_get_string_property (seat, "xdmcp-manager");
82 }
83
84 static void
85 seat_unity_setup (Seat *seat)
86 {
87     seat_set_can_switch (seat, TRUE);
88     SEAT_CLASS (seat_unity_parent_class)->setup (seat);
89 }
90
91 static void
92 compositor_stopped_cb (Process *process, SeatUnity *seat)
93 {
94     if (seat->priv->compositor_timeout != 0)
95         g_source_remove (seat->priv->compositor_timeout);
96     seat->priv->compositor_timeout = 0;
97
98     /* Finished with the VT */
99     vt_unref (seat->priv->vt);
100     seat->priv->vt = -1;
101
102     if (seat_get_is_stopping (SEAT (seat)))
103     {
104         SEAT_CLASS (seat_unity_parent_class)->stop (SEAT (seat));
105         return;
106     }
107
108     /* If stopped before it was ready, then revert to VT mode */
109     if (!seat->priv->compositor_ready)
110     {
111         l_debug (seat, "Compositor failed to start, switching to VT mode");
112         seat->priv->use_vt_switching = TRUE;
113         SEAT_CLASS (seat_unity_parent_class)->start (SEAT (seat));
114         return;
115     }
116
117     l_debug (seat, "Stopping Unity seat, compositor terminated");
118
119     seat_stop (SEAT (seat));
120 }
121
122 static void
123 compositor_run_cb (Process *process, SeatUnity *seat)
124 {
125     int fd;
126
127     /* Make input non-blocking */
128     fd = open ("/dev/null", O_RDONLY);
129     dup2 (fd, STDIN_FILENO);
130     close (fd);
131
132     /* Redirect output to logfile */
133     if (seat->priv->log_file)
134     {
135          int fd;
136
137          fd = g_open (seat->priv->log_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
138          if (fd < 0)
139              l_warning (seat, "Failed to open log file %s: %s", seat->priv->log_file, g_strerror (errno));
140          else
141          {
142              dup2 (fd, STDOUT_FILENO);
143              dup2 (fd, STDERR_FILENO);
144              close (fd);
145          }
146     }
147 }
148
149 static void
150 write_message (SeatUnity *seat, guint16 id, const guint8 *payload, guint16 payload_length)
151 {
152     guint8 *data;
153     gsize data_length = 4 + payload_length;
154
155     data = g_malloc (data_length);
156     data[0] = id >> 8;
157     data[1] = id & 0xFF;
158     data[2] = payload_length >> 8;
159     data[3] = payload_length & 0xFF;
160     memcpy (data + 4, payload, payload_length);
161
162     errno = 0;
163     if (write (seat->priv->to_compositor_pipe[1], data, data_length) != data_length)
164         l_warning (seat, "Failed to write to compositor: %s", strerror (errno));
165 }
166
167 static gboolean
168 read_cb (GIOChannel *source, GIOCondition condition, gpointer data)
169 {
170     SeatUnity *seat = data;
171     gsize n_to_read = 0;
172     guint16 id, payload_length;
173     /*guint8 *payload;*/
174   
175     if (condition == G_IO_HUP)
176     {
177         l_debug (seat, "Compositor closed communication channel");
178         return FALSE;
179     }
180
181     /* Work out how much required for a message */
182     if (seat->priv->read_buffer_n_used < 4)
183         n_to_read = 4 - seat->priv->read_buffer_n_used;
184     else
185     {
186         payload_length = seat->priv->read_buffer[2] << 8 | seat->priv->read_buffer[3];
187         n_to_read = 4 + payload_length - seat->priv->read_buffer_n_used;
188     }
189
190     /* Read from compositor */
191     if (n_to_read > 0)
192     {
193         gsize n_total, n_read = 0;
194         GIOStatus status;
195         GError *error = NULL;
196
197         n_total = seat->priv->read_buffer_n_used + n_to_read;
198         if (seat->priv->read_buffer_length < n_total)
199             seat->priv->read_buffer = g_realloc (seat->priv->read_buffer, n_total);
200
201         status = g_io_channel_read_chars (source,
202                                           (gchar *)seat->priv->read_buffer + seat->priv->read_buffer_n_used,
203                                           n_to_read,
204                                           &n_read,
205                                           &error);
206         if (error)
207             l_warning (seat, "Failed to read from compositor: %s", error->message);
208         if (status != G_IO_STATUS_NORMAL)
209             return TRUE;
210         g_clear_error (&error);
211         seat->priv->read_buffer_n_used += n_read;
212     }
213
214     /* Read header */
215     if (seat->priv->read_buffer_n_used < 4)
216          return TRUE;
217     id = seat->priv->read_buffer[0] << 8 | seat->priv->read_buffer[1];
218     payload_length = seat->priv->read_buffer[2] << 8 | seat->priv->read_buffer[3];
219
220     /* Read payload */
221     if (seat->priv->read_buffer_n_used < 4 + payload_length)
222         return TRUE;
223     /*payload = seat->priv->read_buffer + 4;*/
224
225     switch (id)
226     {
227     case USC_MESSAGE_PING:
228         l_debug (seat, "PING!");
229         write_message (seat, USC_MESSAGE_PONG, NULL, 0);
230         break;
231     case USC_MESSAGE_PONG:
232         l_debug (seat, "PONG!");
233         break;
234     case USC_MESSAGE_READY:
235         l_debug (seat, "READY");
236         if (!seat->priv->compositor_ready)
237         {
238             seat->priv->compositor_ready = TRUE;
239             l_debug (seat, "Compositor ready");
240             g_source_remove (seat->priv->compositor_timeout);
241             seat->priv->compositor_timeout = 0;
242             SEAT_CLASS (seat_unity_parent_class)->start (SEAT (seat));
243         }
244         break;
245     case USC_MESSAGE_SESSION_CONNECTED:
246         l_debug (seat, "SESSION CONNECTED");
247         break;
248     default:
249         l_warning (seat, "Ignoring unknown message %d with %d octets from system compositor", id, payload_length);
250         break;
251     }
252
253     /* Clear buffer */
254     seat->priv->read_buffer_n_used = 0;
255
256     return TRUE;
257 }
258
259 static gchar *
260 get_absolute_command (const gchar *command)
261 {
262     gchar **tokens;
263     gchar *absolute_binary, *absolute_command = NULL;
264
265     tokens = g_strsplit (command, " ", 2);
266
267     absolute_binary = g_find_program_in_path (tokens[0]);
268     if (absolute_binary)
269     {
270         if (tokens[1])
271             absolute_command = g_strjoin (" ", absolute_binary, tokens[1], NULL);
272         else
273             absolute_command = g_strdup (absolute_binary);
274         g_free (absolute_binary);
275     }
276     else
277         absolute_command = g_strdup (command);
278
279     g_strfreev (tokens);
280
281     return absolute_command;
282 }
283
284 static gboolean
285 compositor_timeout_cb (gpointer data)
286 {
287     SeatUnity *seat = data;
288
289     /* Stop the compositor - it is not working */
290     process_stop (seat->priv->compositor_process);
291
292     return TRUE;
293 }
294
295 static gboolean
296 seat_unity_start (Seat *seat)
297 {
298     const gchar *compositor_command;
299     gchar *command, *absolute_command, *dir;
300     gboolean result;
301     int timeout;
302
303     /* Replace Plymouth if it is running */
304     if (plymouth_get_is_active () && plymouth_has_active_vt ())
305     {
306         gint active_vt = vt_get_active ();
307         if (active_vt >= vt_get_min ())
308         {
309             SEAT_UNITY (seat)->priv->vt = active_vt;
310             plymouth_quit (TRUE);
311         }
312         else
313             l_debug (seat, "Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
314     }
315     if (plymouth_get_is_active ())
316         plymouth_quit (FALSE);
317     if (SEAT_UNITY (seat)->priv->vt < 0)
318         SEAT_UNITY (seat)->priv->vt = vt_get_unused ();
319     if (SEAT_UNITY (seat)->priv->vt < 0)
320     {
321         l_debug (seat, "Failed to get a VT to run on");
322         return FALSE;
323     }
324     vt_ref (SEAT_UNITY (seat)->priv->vt);
325
326     /* Create pipes to talk to compositor */
327     if (pipe (SEAT_UNITY (seat)->priv->to_compositor_pipe) < 0 || pipe (SEAT_UNITY (seat)->priv->from_compositor_pipe) < 0)
328     {
329         l_debug (seat, "Failed to create compositor pipes: %s", g_strerror (errno));
330         return FALSE;
331     }
332
333     /* Don't allow the daemon end of the pipes to be accessed in the compositor */
334     fcntl (SEAT_UNITY (seat)->priv->to_compositor_pipe[1], F_SETFD, FD_CLOEXEC);
335     fcntl (SEAT_UNITY (seat)->priv->from_compositor_pipe[0], F_SETFD, FD_CLOEXEC);
336
337     /* Listen for messages from the compositor */
338     SEAT_UNITY (seat)->priv->from_compositor_channel = g_io_channel_unix_new (SEAT_UNITY (seat)->priv->from_compositor_pipe[0]);
339     g_io_add_watch (SEAT_UNITY (seat)->priv->from_compositor_channel, G_IO_IN | G_IO_HUP, read_cb, seat);
340
341     /* Setup logging */
342     dir = config_get_string (config_get_instance (), "LightDM", "log-directory");
343     SEAT_UNITY (seat)->priv->log_file = g_build_filename (dir, "unity-system-compositor.log", NULL);
344     l_debug (seat, "Logging to %s", SEAT_UNITY (seat)->priv->log_file);
345     g_free (dir);
346
347     SEAT_UNITY (seat)->priv->mir_socket_filename = g_strdup ("/tmp/mir_socket"); // FIXME: Use this socket by default as XMir is hardcoded to this
348     timeout = seat_get_integer_property (seat, "unity-compositor-timeout");
349     compositor_command = seat_get_string_property (seat, "unity-compositor-command");
350     command = g_strdup_printf ("%s --from-dm-fd %d --to-dm-fd %d --vt %d", compositor_command, SEAT_UNITY (seat)->priv->to_compositor_pipe[0], SEAT_UNITY (seat)->priv->from_compositor_pipe[1], SEAT_UNITY (seat)->priv->vt);
351
352     absolute_command = get_absolute_command (command);
353     g_free (command);
354
355     /* Start the compositor */
356     process_set_command (SEAT_UNITY (seat)->priv->compositor_process, absolute_command);
357     g_free (absolute_command);
358     g_signal_connect (SEAT_UNITY (seat)->priv->compositor_process, "stopped", G_CALLBACK (compositor_stopped_cb), seat);
359     g_signal_connect (SEAT_UNITY (seat)->priv->compositor_process, "run", G_CALLBACK (compositor_run_cb), seat);
360     result = process_start (SEAT_UNITY (seat)->priv->compositor_process, FALSE);
361
362     /* Close compostor ends of the pipes */
363     close (SEAT_UNITY (seat)->priv->to_compositor_pipe[0]);
364     SEAT_UNITY (seat)->priv->to_compositor_pipe[0] = 0;
365     close (SEAT_UNITY (seat)->priv->from_compositor_pipe[1]);
366     SEAT_UNITY (seat)->priv->from_compositor_pipe[1] = 0;
367
368     if (!result)
369         return FALSE;
370
371     /* Connect to the compositor */
372     timeout = seat_get_integer_property (seat, "unity-compositor-timeout");
373     if (timeout <= 0)
374         timeout = 60;
375     l_debug (seat, "Waiting for system compositor for %ds", timeout);
376     SEAT_UNITY (seat)->priv->compositor_timeout = g_timeout_add (timeout * 1000, compositor_timeout_cb, seat);
377
378     return TRUE;
379 }
380
381 static DisplayServer *
382 create_x_server (Seat *seat)
383 {
384     XServerLocal *x_server;
385     const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
386     gboolean allow_tcp;
387     gint port = 0;
388
389     l_debug (seat, "Starting X server on Unity compositor");
390
391     x_server = x_server_local_new ();
392
393     command = seat_get_string_property (seat, "xserver-command");
394     if (command)
395         x_server_local_set_command (x_server, command);
396
397     if (SEAT_UNITY (seat)->priv->use_vt_switching)
398         x_server_local_set_vt (x_server, vt_get_unused ());
399     else
400     {
401         gchar *id;
402
403         id = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->next_id);
404         SEAT_UNITY (seat)->priv->next_id++;
405         x_server_local_set_mir_id (x_server, id);
406         x_server_local_set_mir_socket (x_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
407         g_free (id);
408     }
409
410     layout = seat_get_string_property (seat, "xserver-layout");
411     if (layout)
412         x_server_local_set_layout (x_server, layout);
413
414     config_file = seat_get_string_property (seat, "xserver-config");
415     if (config_file)
416         x_server_local_set_config (x_server, config_file);
417
418     allow_tcp = seat_get_boolean_property (seat, "xserver-allow-tcp");
419     x_server_local_set_allow_tcp (x_server, allow_tcp);
420
421     xdmcp_manager = seat_get_string_property (seat, "xdmcp-manager");
422     if (xdmcp_manager)
423         x_server_local_set_xdmcp_server (x_server, xdmcp_manager);
424
425     port = seat_get_integer_property (seat, "xdmcp-port");
426     if (port > 0)
427         x_server_local_set_xdmcp_port (x_server, port);
428
429     key_name = seat_get_string_property (seat, "xdmcp-key");
430     if (key_name)
431     {
432         gchar *dir, *path;
433         GKeyFile *keys;
434         gboolean result;
435         GError *error = NULL;
436
437         dir = config_get_string (config_get_instance (), "LightDM", "config-directory");
438         path = g_build_filename (dir, "keys.conf", NULL);
439         g_free (dir);
440
441         keys = g_key_file_new ();
442         result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
443         if (error)
444             l_debug (seat, "Error getting key %s", error->message);
445         g_clear_error (&error);
446
447         if (result)
448         {
449             gchar *key = NULL;
450
451             if (g_key_file_has_key (keys, "keyring", key_name, NULL))
452                 key = g_key_file_get_string (keys, "keyring", key_name, NULL);
453             else
454                 l_debug (seat, "Key %s not defined", key_name);
455
456             if (key)
457                 x_server_local_set_xdmcp_key (x_server, key);
458             g_free (key);
459         }
460
461         g_free (path);
462         g_key_file_free (keys);
463     }
464
465     return DISPLAY_SERVER (x_server);
466 }
467
468 static DisplayServer *
469 create_mir_server (Seat *seat)
470 {
471     MirServer *mir_server;
472
473     mir_server = mir_server_new ();
474     mir_server_set_parent_socket (mir_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
475
476     if (SEAT_UNITY (seat)->priv->use_vt_switching)
477         mir_server_set_vt (mir_server, vt_get_unused ());
478     else
479     {
480         gchar *id;
481
482         id = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->next_id);
483         SEAT_UNITY (seat)->priv->next_id++;
484         mir_server_set_id (mir_server, id);
485         mir_server_set_parent_socket (mir_server, SEAT_UNITY (seat)->priv->mir_socket_filename);
486         g_free (id);
487     }   
488
489     return DISPLAY_SERVER (mir_server);
490 }
491
492 static DisplayServer *
493 seat_unity_create_display_server (Seat *seat, const gchar *session_type)
494 {  
495     if (strcmp (session_type, "x") == 0)
496         return create_x_server (seat);
497     else if (strcmp (session_type, "mir") == 0)
498         return create_mir_server (seat);
499     else
500     {
501         l_warning (seat, "Can't create unsupported display server '%s'", session_type);
502         return NULL;
503     }
504 }
505
506 static Greeter *
507 seat_unity_create_greeter_session (Seat *seat)
508 {
509     Greeter *greeter_session;
510
511     greeter_session = SEAT_CLASS (seat_unity_parent_class)->create_greeter_session (seat);
512     session_set_env (SESSION (greeter_session), "XDG_SEAT", "seat0");
513     if (!SEAT_UNITY (seat)->priv->use_vt_switching)
514     {
515         gchar *value = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->vt);
516         session_set_env (SESSION (greeter_session), "XDG_VTNR", value);
517         g_free (value);
518     }
519
520     return greeter_session;
521 }
522
523 static Session *
524 seat_unity_create_session (Seat *seat)
525 {
526     Session *session;
527
528     session = SEAT_CLASS (seat_unity_parent_class)->create_session (seat);
529     session_set_env (session, "XDG_SEAT", "seat0");
530     if (!SEAT_UNITY (seat)->priv->use_vt_switching)
531     {
532         gchar *value = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->vt);
533         session_set_env (SESSION (session), "XDG_VTNR", value);
534         g_free (value);
535     }
536
537     return session;
538 }
539
540 static void
541 seat_unity_set_active_session (Seat *seat, Session *session)
542 {
543     DisplayServer *display_server;
544
545     /* If no compositor, have to use VT switching */
546     if (SEAT_UNITY (seat)->priv->use_vt_switching)
547     {
548         gint vt = display_server_get_vt (session_get_display_server (session));
549         if (vt >= 0)
550             vt_set_active (vt);
551
552         SEAT_CLASS (seat_unity_parent_class)->set_active_session (seat, session);
553         return;
554     }
555
556     if (session == SEAT_UNITY (seat)->priv->active_session)
557         return;
558     SEAT_UNITY (seat)->priv->active_session = g_object_ref (session);
559
560     display_server = session_get_display_server (session);
561     if (SEAT_UNITY (seat)->priv->active_display_server != display_server)
562     {
563         const gchar *id = NULL;
564
565         SEAT_UNITY (seat)->priv->active_display_server = g_object_ref (display_server);
566
567         if (IS_X_SERVER_LOCAL (display_server))
568             id = x_server_local_get_mir_id (X_SERVER_LOCAL (display_server));
569         else if (IS_MIR_SERVER (display_server))
570             id = mir_server_get_id (MIR_SERVER (display_server));
571
572         if (id)
573         {
574             l_debug (seat, "Switching to Mir session %s", id);
575             write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_ACTIVE_SESSION, (const guint8 *) id, strlen (id));
576         }
577         else
578             l_warning (seat, "Failed to work out session ID");
579     }
580
581     SEAT_CLASS (seat_unity_parent_class)->set_active_session (seat, session);
582 }
583
584 static Session *
585 seat_unity_get_active_session (Seat *seat)
586 {
587     if (SEAT_UNITY (seat)->priv->use_vt_switching)
588     {
589         gint vt;
590         GList *link;
591         vt = vt_get_active ();
592         if (vt < 0)
593             return NULL;
594
595         for (link = seat_get_sessions (seat); link; link = link->next)
596         {
597             Session *session = link->data;
598             if (display_server_get_vt (session_get_display_server (session)) == vt)
599                 return session;
600         }
601
602         return NULL;
603     }
604
605     return SEAT_UNITY (seat)->priv->active_session;
606 }
607
608 static void
609 seat_unity_run_script (Seat *seat, DisplayServer *display_server, Process *script)
610 {
611     const gchar *path;
612     XServerLocal *x_server;
613
614     x_server = X_SERVER_LOCAL (display_server);
615     path = x_server_local_get_authority_file_path (x_server);
616     process_set_env (script, "DISPLAY", x_server_get_address (X_SERVER (x_server)));
617     process_set_env (script, "XAUTHORITY", path);
618
619     SEAT_CLASS (seat_unity_parent_class)->run_script (seat, display_server, script);
620 }
621
622 static void
623 seat_unity_stop (Seat *seat)
624 {
625     /* Stop the compositor first */
626     if (process_get_is_running (SEAT_UNITY (seat)->priv->compositor_process))
627     {
628         process_stop (SEAT_UNITY (seat)->priv->compositor_process);
629         return;
630     }
631
632     SEAT_CLASS (seat_unity_parent_class)->stop (seat);
633 }
634
635 static void
636 seat_unity_init (SeatUnity *seat)
637 {
638     seat->priv = G_TYPE_INSTANCE_GET_PRIVATE (seat, SEAT_UNITY_TYPE, SeatUnityPrivate);
639     seat->priv->vt = -1;
640     seat->priv->compositor_process = process_new ();
641 }
642
643 static void
644 seat_unity_finalize (GObject *object)
645 {
646     SeatUnity *seat = SEAT_UNITY (object);
647
648     if (seat->priv->vt >= 0)
649         vt_unref (seat->priv->vt);
650     g_free (seat->priv->log_file);
651     g_free (seat->priv->mir_socket_filename);
652     close (seat->priv->to_compositor_pipe[0]);
653     close (seat->priv->to_compositor_pipe[1]);
654     close (seat->priv->from_compositor_pipe[0]);
655     close (seat->priv->from_compositor_pipe[1]);
656     g_io_channel_unref (seat->priv->from_compositor_channel);
657     g_free (seat->priv->read_buffer);
658     g_object_unref (seat->priv->compositor_process);
659     if (seat->priv->active_session)
660         g_object_unref (seat->priv->active_session);
661     if (seat->priv->active_display_server)
662         g_object_unref (seat->priv->active_display_server);
663
664     G_OBJECT_CLASS (seat_unity_parent_class)->finalize (object);
665 }
666
667 static void
668 seat_unity_class_init (SeatUnityClass *klass)
669 {
670     GObjectClass *object_class = G_OBJECT_CLASS (klass);
671     SeatClass *seat_class = SEAT_CLASS (klass);
672
673     object_class->finalize = seat_unity_finalize;
674     seat_class->get_start_local_sessions = seat_unity_get_start_local_sessions;
675     seat_class->setup = seat_unity_setup;
676     seat_class->start = seat_unity_start;
677     seat_class->create_display_server = seat_unity_create_display_server;
678     seat_class->create_greeter_session = seat_unity_create_greeter_session;
679     seat_class->create_session = seat_unity_create_session;
680     seat_class->set_active_session = seat_unity_set_active_session;
681     seat_class->get_active_session = seat_unity_get_active_session;
682     seat_class->run_script = seat_unity_run_script;
683     seat_class->stop = seat_unity_stop;
684
685     g_type_class_add_private (klass, sizeof (SeatUnityPrivate));
686 }