]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/seat-surfaceflinger.c
c0dc0b56f871069916df6b050a5cf524e2583e48
[sojka/lightdm.git] / src / seat-surfaceflinger.c
1 /*
2  * Copyright (C) 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
14 #include "seat-surfaceflinger.h"
15 #include "surfaceflinger-server.h"
16
17 G_DEFINE_TYPE (SeatSurfaceflinger, seat_surfaceflinger, SEAT_TYPE);
18
19 static void
20 seat_surfaceflinger_setup (Seat *seat)
21 {
22     seat_set_can_switch (seat, FALSE);
23     SEAT_CLASS (seat_surfaceflinger_parent_class)->setup (seat);
24 }
25
26 static DisplayServer *
27 seat_surfaceflinger_create_display_server (Seat *seat, const gchar *session_type)
28 {  
29     if (strcmp (session_type, "surfaceflinger") == 0)
30         return DISPLAY_SERVER (surfaceflinger_server_new ());
31     else
32     {
33         l_warning (seat, "Can't create unsupported display server '%s'", session_type);
34         return NULL;
35     }
36 }
37
38 static Greeter *
39 seat_surfaceflinger_create_greeter_session (Seat *seat)
40 {
41     Greeter *greeter_session;
42     const gchar *xdg_seat;
43
44     greeter_session = SEAT_CLASS (seat_surfaceflinger_parent_class)->create_greeter_session (seat);
45     xdg_seat = seat_get_string_property (seat, "xdg-seat");
46     if (!xdg_seat)
47         xdg_seat = "seat0";
48     session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
49
50     /* Fake the VT */
51     session_set_env (SESSION (greeter_session), "XDG_VTNR", "1");
52
53     return greeter_session;
54 }
55
56 static Session *
57 seat_surfaceflinger_create_session (Seat *seat)
58 {
59     Session *session;
60     const gchar *xdg_seat;
61
62     session = SEAT_CLASS (seat_surfaceflinger_parent_class)->create_session (seat);
63     xdg_seat = seat_get_string_property (seat, "xdg-seat");
64     if (!xdg_seat)
65         xdg_seat = "seat0";
66     session_set_env (session, "XDG_SEAT", xdg_seat);
67
68     /* Fake the VT */
69     session_set_env (session, "XDG_VTNR", "1");
70
71     return session;
72 }
73
74 static void
75 seat_surfaceflinger_init (SeatSurfaceflinger *seat)
76 {
77 }
78
79 static void
80 seat_surfaceflinger_class_init (SeatSurfaceflingerClass *klass)
81 {
82     SeatClass *seat_class = SEAT_CLASS (klass);
83
84     seat_class->setup = seat_surfaceflinger_setup;
85     seat_class->create_display_server = seat_surfaceflinger_create_display_server;
86     seat_class->create_greeter_session = seat_surfaceflinger_create_greeter_session;
87     seat_class->create_session = seat_surfaceflinger_create_session;
88 }