2 * Copyright (C) 2013 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
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
14 #include "seat-surfaceflinger.h"
15 #include "surfaceflinger-server.h"
18 G_DEFINE_TYPE (SeatSurfaceflinger, seat_surfaceflinger, SEAT_TYPE);
21 seat_surfaceflinger_setup (Seat *seat)
23 seat_set_can_switch (seat, FALSE);
24 SEAT_CLASS (seat_surfaceflinger_parent_class)->setup (seat);
27 static DisplayServer *
28 seat_surfaceflinger_create_display_server (Seat *seat, const gchar *session_type)
30 if (strcmp (session_type, "surfaceflinger") == 0)
31 return DISPLAY_SERVER (surfaceflinger_server_new ());
34 l_warning (seat, "Can't create unsupported display server '%s'", session_type);
40 seat_surfaceflinger_create_greeter_session (Seat *seat)
42 Greeter *greeter_session;
43 const gchar *xdg_seat;
45 greeter_session = SEAT_CLASS (seat_surfaceflinger_parent_class)->create_greeter_session (seat);
46 xdg_seat = seat_get_string_property (seat, "xdg-seat");
49 session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
52 session_set_env (SESSION (greeter_session), "XDG_VTNR", vt_can_multi_seat() ? "1" : "0");
54 return greeter_session;
58 seat_surfaceflinger_create_session (Seat *seat)
61 const gchar *xdg_seat;
63 session = SEAT_CLASS (seat_surfaceflinger_parent_class)->create_session (seat);
64 xdg_seat = seat_get_string_property (seat, "xdg-seat");
67 session_set_env (session, "XDG_SEAT", xdg_seat);
70 session_set_env (session, "XDG_VTNR", vt_can_multi_seat() ? "1" : "0");
76 seat_surfaceflinger_init (SeatSurfaceflinger *seat)
81 seat_surfaceflinger_class_init (SeatSurfaceflingerClass *klass)
83 SeatClass *seat_class = SEAT_CLASS (klass);
85 seat_class->setup = seat_surfaceflinger_setup;
86 seat_class->create_display_server = seat_surfaceflinger_create_display_server;
87 seat_class->create_greeter_session = seat_surfaceflinger_create_greeter_session;
88 seat_class->create_session = seat_surfaceflinger_create_session;