wlt: fix shl_hook API changes
[platform/upstream/kmscon.git] / src / uterm_monitor.h
1 /*
2  * uterm - Linux User-Space Terminal System Monitor
3  *
4  * Copyright (c) 2011-2013 David Herrmann <dh.herrmann@googlemail.com>
5  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
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.
24  */
25
26 /*
27  * System Monitor
28  * This watches the system for new seats, graphics devices or other devices that
29  * are used by terminals.
30  */
31
32 #ifndef UTERM_UTERM_MONITOR_H
33 #define UTERM_UTERM_MONITOR_H
34
35 #include <eloop.h>
36 #include <inttypes.h>
37 #include <stdbool.h>
38 #include <stdlib.h>
39
40 struct uterm_monitor;
41 struct uterm_monitor_seat;
42 struct uterm_monitor_dev;
43
44 enum uterm_monitor_event_type {
45         UTERM_MONITOR_NEW_SEAT,
46         UTERM_MONITOR_FREE_SEAT,
47         UTERM_MONITOR_NEW_DEV,
48         UTERM_MONITOR_FREE_DEV,
49         UTERM_MONITOR_HOTPLUG_DEV,
50 };
51
52 enum uterm_monitor_dev_type {
53         UTERM_MONITOR_DRM,
54         UTERM_MONITOR_FBDEV,
55         UTERM_MONITOR_INPUT,
56 };
57
58 enum uterm_monitor_dev_flag {
59         UTERM_MONITOR_DRM_BACKED        = 0x01,
60         UTERM_MONITOR_PRIMARY           = 0x02,
61         UTERM_MONITOR_AUX               = 0x04,
62 };
63
64 struct uterm_monitor_event {
65         unsigned int type;
66
67         struct uterm_monitor_seat *seat;
68         const char *seat_name;
69         void *seat_data;
70
71         struct uterm_monitor_dev *dev;
72         unsigned int dev_type;
73         unsigned int dev_flags;
74         const char *dev_node;
75         void *dev_data;
76 };
77
78 typedef void (*uterm_monitor_cb) (struct uterm_monitor *mon,
79                                   struct uterm_monitor_event *event,
80                                   void *data);
81
82 int uterm_monitor_new(struct uterm_monitor **out, struct ev_eloop *eloop,
83                       uterm_monitor_cb cb, void *data);
84 void uterm_monitor_ref(struct uterm_monitor *mon);
85 void uterm_monitor_unref(struct uterm_monitor *mon);
86 void uterm_monitor_scan(struct uterm_monitor *mon);
87
88 void uterm_monitor_set_seat_data(struct uterm_monitor_seat *seat, void *data);
89 void uterm_monitor_set_dev_data(struct uterm_monitor_dev *dev, void *data);
90
91 #endif /* UTERM_UTERM_MONITOR_H */