2 * uvtd - User-space VT daemon
4 * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Each set of input+output devices form a single seat. Each seat is independent
29 * of each other and there can be exactly one user per seat interacting with the
31 * Per seat, we have multiple sessions. But only one session can be active at a
32 * time per seat. We allow external sessions, so session activation/deactivation
33 * may be asynchronous.
46 enum uvtd_session_event_type {
47 UVTD_SESSION_ACTIVATE,
48 UVTD_SESSION_DEACTIVATE,
49 UVTD_SESSION_UNREGISTER,
52 typedef int (*uvtd_session_cb_t) (struct uvtd_session *session,
56 void uvtd_session_ref(struct uvtd_session *sess);
57 void uvtd_session_unref(struct uvtd_session *sess);
58 void uvtd_session_unregister(struct uvtd_session *sess);
59 bool uvtd_session_is_registered(struct uvtd_session *sess);
61 bool uvtd_session_is_active(struct uvtd_session *sess);
62 void uvtd_session_schedule(struct uvtd_session *sess);
64 void uvtd_session_enable(struct uvtd_session *sess);
65 void uvtd_session_disable(struct uvtd_session *sess);
66 bool uvtd_session_is_enabled(struct uvtd_session *sess);
68 void uvtd_session_notify_deactivated(struct uvtd_session *sess);
74 enum uvtd_seat_event {
78 typedef void (*uvtd_seat_cb_t) (struct uvtd_seat *seat, unsigned int event,
81 int uvtd_seat_new(struct uvtd_seat **out, const char *seatname,
82 struct ev_eloop *eloop, uvtd_seat_cb_t cb, void *data);
83 void uvtd_seat_free(struct uvtd_seat *seat);
85 const char *uvtd_seat_get_name(struct uvtd_seat *seat);
86 struct ev_eloop *uvtd_seat_get_eloop(struct uvtd_seat *seat);
87 int uvtd_seat_sleep(struct uvtd_seat *seat, bool force);
88 void uvtd_seat_wake_up(struct uvtd_seat *seat);
89 void uvtd_seat_schedule(struct uvtd_seat *seat, unsigned int id);
91 int uvtd_seat_register_session(struct uvtd_seat *seat,
92 struct uvtd_session **out,
93 unsigned int id, uvtd_session_cb_t cb,
96 #endif /* UVTD_SEAT_H */