chiark / gitweb /
1254268f1087f64974eb7f32216d53c353833c7b
[elogind.git] / src / login / logind-seat.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2011 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 typedef struct Seat Seat;
25
26 #include "list.h"
27 #include "util.h"
28 #include "logind.h"
29 #include "logind-device.h"
30 #include "logind-session.h"
31
32 struct Seat {
33         Manager *manager;
34         char *id;
35
36         char *state_file;
37
38         LIST_HEAD(Device, devices);
39
40         Session *active;
41         Session *pending_switch;
42         LIST_HEAD(Session, sessions);
43
44         bool in_gc_queue:1;
45         bool started:1;
46
47         LIST_FIELDS(Seat, gc_queue);
48 };
49
50 Seat *seat_new(Manager *m, const char *id);
51 void seat_free(Seat *s);
52
53 int seat_save(Seat *s);
54 int seat_load(Seat *s);
55
56 int seat_apply_acls(Seat *s, Session *old_active);
57 int seat_set_active(Seat *s, Session *session);
58 int seat_active_vt_changed(Seat *s, unsigned int vtnr);
59 int seat_read_active_vt(Seat *s);
60 int seat_preallocate_vts(Seat *s);
61
62 int seat_attach_session(Seat *s, Session *session);
63 void seat_complete_switch(Seat *s);
64
65 bool seat_has_vts(Seat *s);
66 bool seat_is_seat0(Seat *s);
67 bool seat_can_multi_session(Seat *s);
68 bool seat_can_tty(Seat *s);
69 bool seat_has_master_device(Seat *s);
70 bool seat_can_graphical(Seat *s);
71
72 int seat_get_idle_hint(Seat *s, dual_timestamp *t);
73
74 int seat_start(Seat *s);
75 int seat_stop(Seat *s);
76 int seat_stop_sessions(Seat *s);
77
78 bool seat_check_gc(Seat *s, bool drop_not_started);
79 void seat_add_to_gc_queue(Seat *s);
80
81 bool seat_name_is_valid(const char *name);
82
83 extern const sd_bus_vtable seat_vtable[];
84
85 int seat_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
86 int seat_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
87 char *seat_bus_path(Seat *s);
88
89 int seat_send_signal(Seat *s, bool new_seat);
90 int seat_send_changed(Seat *s, const char *properties, ...) _sentinel_;