chiark / gitweb /
439abc0d883f5578f67b77b4ec61d73241f88d92
[elogind.git] / src / login / logind-seat.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   This file is part of systemd.
6
7   Copyright 2011 Lennart Poettering
8 ***/
9
10 typedef struct Seat Seat;
11
12 #include "list.h"
13 #include "logind-session.h"
14
15 struct Seat {
16         Manager *manager;
17         char *id;
18
19         char *state_file;
20
21         LIST_HEAD(Device, devices);
22
23         Session *active;
24         Session *pending_switch;
25         LIST_HEAD(Session, sessions);
26
27         Session **positions;
28         size_t position_count;
29
30         bool in_gc_queue:1;
31         bool started:1;
32
33         LIST_FIELDS(Seat, gc_queue);
34 };
35
36 Seat *seat_new(Manager *m, const char *id);
37 void seat_free(Seat *s);
38
39 int seat_save(Seat *s);
40 int seat_load(Seat *s);
41
42 int seat_apply_acls(Seat *s, Session *old_active);
43 int seat_set_active(Seat *s, Session *session);
44 int seat_switch_to(Seat *s, unsigned int num);
45 int seat_switch_to_next(Seat *s);
46 int seat_switch_to_previous(Seat *s);
47 int seat_active_vt_changed(Seat *s, unsigned int vtnr);
48 int seat_read_active_vt(Seat *s);
49 #if 0 /// UNNEEDED by elogind
50 int seat_preallocate_vts(Seat *s);
51 #endif // 0
52
53 int seat_attach_session(Seat *s, Session *session);
54 void seat_complete_switch(Seat *s);
55 void seat_evict_position(Seat *s, Session *session);
56 void seat_claim_position(Seat *s, Session *session, unsigned int pos);
57
58 bool seat_has_vts(Seat *s);
59 bool seat_is_seat0(Seat *s);
60 bool seat_can_multi_session(Seat *s);
61 bool seat_can_tty(Seat *s);
62 bool seat_has_master_device(Seat *s);
63 bool seat_can_graphical(Seat *s);
64
65 int seat_get_idle_hint(Seat *s, dual_timestamp *t);
66
67 int seat_start(Seat *s);
68 int seat_stop(Seat *s, bool force);
69 int seat_stop_sessions(Seat *s, bool force);
70
71 bool seat_may_gc(Seat *s, bool drop_not_started);
72 void seat_add_to_gc_queue(Seat *s);
73
74 bool seat_name_is_valid(const char *name);
75
76 extern const sd_bus_vtable seat_vtable[];
77
78 int seat_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
79 int seat_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
80 char *seat_bus_path(Seat *s);
81
82 int seat_send_signal(Seat *s, bool new_seat);
83 int seat_send_changed(Seat *s, const char *properties, ...) _sentinel_;
84
85 int bus_seat_method_terminate(sd_bus_message *message, void *userdata, sd_bus_error *error);