Fix two doxygen errors
[platform/upstream/libinput.git] / src / libinput-private.h
1 /*
2  * Copyright © 2013 Jonas Ådahl
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee, provided
6  * that the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of the copyright holders not be used in
9  * advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission.  The copyright holders make
11  * no representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 #ifndef LIBINPUT_PRIVATE_H
24 #define LIBINPUT_PRIVATE_H
25
26 #include "linux/input.h"
27
28 #include "libinput.h"
29 #include "libinput-util.h"
30
31 struct libinput_source;
32
33 struct libinput_interface_backend {
34         int (*resume)(struct libinput *libinput);
35         void (*suspend)(struct libinput *libinput);
36         void (*destroy)(struct libinput *libinput);
37 };
38
39 struct libinput {
40         int epoll_fd;
41         struct list source_destroy_list;
42
43         struct list seat_list;
44
45         struct {
46                 struct list list;
47                 struct libinput_source *source;
48                 int fd;
49         } timer;
50
51         struct libinput_event **events;
52         size_t events_count;
53         size_t events_len;
54         size_t events_in;
55         size_t events_out;
56
57         const struct libinput_interface *interface;
58         const struct libinput_interface_backend *interface_backend;
59
60         libinput_log_handler log_handler;
61         enum libinput_log_priority log_priority;
62         void *user_data;
63         int refcount;
64 };
65
66 typedef void (*libinput_seat_destroy_func) (struct libinput_seat *seat);
67
68 struct libinput_seat {
69         struct libinput *libinput;
70         struct list link;
71         struct list devices_list;
72         void *user_data;
73         int refcount;
74         libinput_seat_destroy_func destroy;
75
76         char *physical_name;
77         char *logical_name;
78
79         uint32_t slot_map;
80
81         uint32_t button_count[KEY_CNT];
82 };
83
84 struct libinput_device_config_tap {
85         int (*count)(struct libinput_device *device);
86         enum libinput_config_status (*set_enabled)(struct libinput_device *device,
87                                                    int enable);
88         int (*get_enabled)(struct libinput_device *device);
89         int (*get_default)(struct libinput_device *device);
90 };
91
92 struct libinput_device_config {
93         struct libinput_device_config_tap *tap;
94 };
95
96 struct libinput_device {
97         struct libinput_seat *seat;
98         struct list link;
99         void *user_data;
100         int terminated;
101         int refcount;
102         struct libinput_device_config config;
103 };
104
105 typedef void (*libinput_source_dispatch_t)(void *data);
106
107
108 #define log_debug(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__)
109 #define log_info(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__)
110 #define log_error(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__)
111 #define log_bug_kernel(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__)
112 #define log_bug_libinput(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__);
113 #define log_bug_client(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__);
114
115 void
116 log_msg(struct libinput *libinput,
117         enum libinput_log_priority priority,
118         const char *format, ...);
119
120 void
121 log_msg_va(struct libinput *libinput,
122            enum libinput_log_priority priority,
123            const char *format,
124            va_list args);
125
126 int
127 libinput_init(struct libinput *libinput,
128               const struct libinput_interface *interface,
129               const struct libinput_interface_backend *interface_backend,
130               void *user_data);
131
132 struct libinput_source *
133 libinput_add_fd(struct libinput *libinput,
134                 int fd,
135                 libinput_source_dispatch_t dispatch,
136                 void *data);
137
138 void
139 libinput_remove_source(struct libinput *libinput,
140                        struct libinput_source *source);
141
142 int
143 open_restricted(struct libinput *libinput,
144                 const char *path, int flags);
145
146 void
147 close_restricted(struct libinput *libinput, int fd);
148
149 void
150 libinput_seat_init(struct libinput_seat *seat,
151                    struct libinput *libinput,
152                    const char *physical_name,
153                    const char *logical_name,
154                    libinput_seat_destroy_func destroy);
155
156 void
157 libinput_device_init(struct libinput_device *device,
158                      struct libinput_seat *seat);
159
160 void
161 notify_added_device(struct libinput_device *device);
162
163 void
164 notify_removed_device(struct libinput_device *device);
165
166 void
167 keyboard_notify_key(struct libinput_device *device,
168                     uint32_t time,
169                     uint32_t key,
170                     enum libinput_key_state state);
171
172 void
173 pointer_notify_motion(struct libinput_device *device,
174                       uint32_t time,
175                       double dx,
176                       double dy);
177
178 void
179 pointer_notify_motion_absolute(struct libinput_device *device,
180                                uint32_t time,
181                                double x,
182                                double y);
183
184 void
185 pointer_notify_button(struct libinput_device *device,
186                       uint32_t time,
187                       int32_t button,
188                       enum libinput_button_state state);
189
190 void
191 pointer_notify_axis(struct libinput_device *device,
192                     uint32_t time,
193                     enum libinput_pointer_axis axis,
194                     double value);
195
196 void
197 touch_notify_touch_down(struct libinput_device *device,
198                         uint32_t time,
199                         int32_t slot,
200                         int32_t seat_slot,
201                         double x,
202                         double y);
203
204 void
205 touch_notify_touch_motion(struct libinput_device *device,
206                           uint32_t time,
207                           int32_t slot,
208                           int32_t seat_slot,
209                           double x,
210                           double y);
211
212 void
213 touch_notify_touch_up(struct libinput_device *device,
214                       uint32_t time,
215                       int32_t slot,
216                       int32_t seat_slot);
217
218 void
219 touch_notify_frame(struct libinput_device *device,
220                    uint32_t time);
221 #endif /* LIBINPUT_PRIVATE_H */