2 * Copyright © 2013 Jonas Ådahl
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.
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.
23 #ifndef LIBINPUT_PRIVATE_H
24 #define LIBINPUT_PRIVATE_H
26 #include <linux/input.h>
29 #include "libinput-util.h"
31 struct libinput_interface_backend {
32 int (*resume)(struct libinput *libinput);
33 void (*suspend)(struct libinput *libinput);
34 void (*destroy)(struct libinput *libinput);
39 struct list source_destroy_list;
41 struct list seat_list;
43 struct libinput_event **events;
49 const struct libinput_interface *interface;
50 const struct libinput_interface_backend *interface_backend;
54 typedef void (*libinput_seat_destroy_func) (struct libinput_seat *seat);
56 struct libinput_seat {
57 struct libinput *libinput;
59 struct list devices_list;
62 libinput_seat_destroy_func destroy;
69 uint32_t button_count[KEY_CNT];
72 struct libinput_device {
73 struct libinput_seat *seat;
80 typedef void (*libinput_source_dispatch_t)(void *data);
82 struct libinput_source;
84 #define log_debug(...) log_msg(LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__)
85 #define log_info(...) log_msg(LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__)
86 #define log_error(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__)
87 #define log_bug(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "BUG: "__VA_ARGS__)
90 log_msg(enum libinput_log_priority priority, const char *format, ...);
93 libinput_init(struct libinput *libinput,
94 const struct libinput_interface *interface,
95 const struct libinput_interface_backend *interface_backend,
98 struct libinput_source *
99 libinput_add_fd(struct libinput *libinput,
101 libinput_source_dispatch_t dispatch,
105 libinput_remove_source(struct libinput *libinput,
106 struct libinput_source *source);
109 open_restricted(struct libinput *libinput,
110 const char *path, int flags);
113 close_restricted(struct libinput *libinput, int fd);
116 libinput_seat_init(struct libinput_seat *seat,
117 struct libinput *libinput,
118 const char *physical_name,
119 const char *logical_name,
120 libinput_seat_destroy_func destroy);
123 libinput_device_init(struct libinput_device *device,
124 struct libinput_seat *seat);
127 notify_added_device(struct libinput_device *device);
130 notify_removed_device(struct libinput_device *device);
133 keyboard_notify_key(struct libinput_device *device,
136 enum libinput_keyboard_key_state state);
139 pointer_notify_motion(struct libinput_device *device,
145 pointer_notify_motion_absolute(struct libinput_device *device,
151 pointer_notify_button(struct libinput_device *device,
154 enum libinput_pointer_button_state state);
157 pointer_notify_axis(struct libinput_device *device,
159 enum libinput_pointer_axis axis,
163 touch_notify_touch_down(struct libinput_device *device,
171 touch_notify_touch_motion(struct libinput_device *device,
179 touch_notify_touch_up(struct libinput_device *device,
185 touch_notify_frame(struct libinput_device *device,
187 #endif /* LIBINPUT_PRIVATE_H */