eloop: move prefix to "ev_" instead of "kmscon_"
[platform/upstream/kmscon.git] / src / vt.h
1 /*
2  * kmscon - VT compatibility layer
3  *
4  * Copyright (c) 2011 David Herrmann <dh.herrmann@googlemail.com>
5  * Copyright (c) 2011 University of Tuebingen
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files
9  * (the "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  */
26
27 /*
28  * VT compatibility
29  * If the kmscon application runs in a VT we need to react on VT switch events
30  * to allow other applications to access the DRM. This is only needed as long as
31  * we run in a VT. In the future we will be able to disable all VTs and run as
32  * service daemon. We then need another way to switch between graphical
33  * applications, though.
34  */
35
36 #ifndef KMSCON_VT_H
37 #define KMSCON_VT_H
38
39 #include <stdbool.h>
40 #include <stdlib.h>
41
42 #include "eloop.h"
43
44 struct kmscon_vt;
45 typedef bool (*kmscon_vt_cb) (struct kmscon_vt *vt, int action, void *data);
46
47 enum kmscon_vt_action {
48         KMSCON_VT_ENTER,
49         KMSCON_VT_LEAVE,
50 };
51
52 enum kmscon_vt_id {
53         KMSCON_VT_CUR = 0,
54         KMSCON_VT_NEW = -1,
55 };
56
57 int kmscon_vt_new(struct kmscon_vt **out, kmscon_vt_cb cb, void *data);
58 void kmscon_vt_ref(struct kmscon_vt *vt);
59 void kmscon_vt_unref(struct kmscon_vt *vt);
60
61 int kmscon_vt_open(struct kmscon_vt *vt, int id, struct ev_eloop *eloop);
62 void kmscon_vt_close(struct kmscon_vt *vt);
63
64 int kmscon_vt_enter(struct kmscon_vt *vt);
65 int kmscon_vt_leave(struct kmscon_vt *vt);
66
67 #endif /* KMSCON_VT_H */