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.
30 typedef int32_t li_fixed_t;
32 enum libinput_device_capability {
33 LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
34 LIBINPUT_DEVICE_CAP_POINTER = 1,
35 LIBINPUT_DEVICE_CAP_TOUCH = 2,
38 enum libinput_keyboard_key_state {
39 LIBINPUT_KEYBOARD_KEY_STATE_RELEASED = 0,
40 LIBINPUT_KEYBOARD_KEY_STATE_PRESSED = 1,
44 LIBINPUT_LED_NUM_LOCK = (1 << 0),
45 LIBINPUT_LED_CAPS_LOCK = (1 << 1),
46 LIBINPUT_LED_SCROLL_LOCK = (1 << 2),
49 enum libinput_pointer_button_state {
50 LIBINPUT_POINTER_BUTTON_STATE_RELEASED = 0,
51 LIBINPUT_POINTER_BUTTON_STATE_PRESSED = 1,
54 enum libinput_pointer_axis {
55 LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL = 0,
56 LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
59 enum libinput_touch_type {
60 LIBINPUT_TOUCH_TYPE_DOWN = 0,
61 LIBINPUT_TOUCH_TYPE_UP = 1,
62 LIBINPUT_TOUCH_TYPE_MOTION = 2,
63 LIBINPUT_TOUCH_TYPE_FRAME = 3,
64 LIBINPUT_TOUCH_TYPE_CANCEL = 4,
67 enum libinput_event_type {
68 LIBINPUT_EVENT_ADDED_SEAT = 0,
69 LIBINPUT_EVENT_REMOVED_SEAT,
70 LIBINPUT_EVENT_ADDED_DEVICE,
71 LIBINPUT_EVENT_REMOVED_DEVICE,
73 LIBINPUT_EVENT_DEVICE_REGISTER_CAPABILITY = 200,
74 LIBINPUT_EVENT_DEVICE_UNREGISTER_CAPABILITY,
76 LIBINPUT_EVENT_KEYBOARD_KEY = 300,
78 LIBINPUT_EVENT_POINTER_MOTION = 400,
79 LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE,
80 LIBINPUT_EVENT_POINTER_BUTTON,
81 LIBINPUT_EVENT_POINTER_AXIS,
83 LIBINPUT_EVENT_TOUCH_TOUCH = 500,
86 union libinput_event_target {
87 struct libinput *libinput;
88 struct libinput_seat *seat;
89 struct libinput_device *device;
92 struct libinput_event {
93 enum libinput_event_type type;
94 union libinput_event_target target;
97 struct libinput_event_added_seat {
98 struct libinput_event base;
99 struct libinput_seat *seat;
102 struct libinput_event_removed_seat {
103 struct libinput_event base;
104 struct libinput_seat *seat;
107 struct libinput_event_added_device {
108 struct libinput_event base;
109 struct libinput_device *device;
112 struct libinput_event_removed_device {
113 struct libinput_event base;
114 struct libinput_device *device;
117 struct libinput_event_device_register_capability {
118 struct libinput_event base;
119 enum libinput_device_capability capability;
122 struct libinput_event_device_unregister_capability {
123 struct libinput_event base;
124 enum libinput_device_capability capability;
127 struct libinput_event_keyboard_key {
128 struct libinput_event base;
131 enum libinput_keyboard_key_state state;
134 struct libinput_event_pointer_motion {
135 struct libinput_event base;
141 struct libinput_event_pointer_motion_absolute {
142 struct libinput_event base;
148 struct libinput_event_pointer_button {
149 struct libinput_event base;
152 enum libinput_pointer_button_state state;
155 struct libinput_event_pointer_axis {
156 struct libinput_event base;
158 enum libinput_pointer_axis axis;
162 struct libinput_event_touch_touch {
163 struct libinput_event base;
168 enum libinput_touch_type touch_type;
171 struct libinput_fd_handle;
173 typedef void (*libinput_fd_callback)(int fd, void *data);
175 struct libinput_interface {
176 int (*open_restricted)(const char *path, int flags, void *user_data);
177 void (*close_restricted)(int fd, void *user_data);
179 void (*get_current_screen_dimensions)(struct libinput_device *device,
186 struct libinput_device;
193 libinput_create_udev(const struct libinput_interface *interface,
196 const char *seat_id);
199 libinput_get_fd(struct libinput *libinput);
202 libinput_dispatch(struct libinput *libinput);
204 struct libinput_event *
205 libinput_get_event(struct libinput *libinput);
208 libinput_get_user_data(struct libinput *libinput);
211 libinput_resume(struct libinput *libinput);
214 libinput_suspend(struct libinput *libinput);
217 libinput_destroy(struct libinput *libinput);
224 libinput_seat_ref(struct libinput_seat *seat);
227 libinput_seat_unref(struct libinput_seat *seat);
230 libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data);
233 libinput_seat_get_user_data(struct libinput_seat *seat);
236 libinput_seat_get_name(struct libinput_seat *seat);
243 libinput_device_ref(struct libinput_device *device);
246 libinput_device_unref(struct libinput_device *device);
249 libinput_device_set_user_data(struct libinput_device *device, void *user_data);
252 libinput_device_get_user_data(struct libinput_device *device);
255 libinput_device_get_output_name(struct libinput_device *device);
257 struct libinput_seat *
258 libinput_device_get_seat(struct libinput_device *device);
261 libinput_device_led_update(struct libinput_device *device,
262 enum libinput_led leds);
265 libinput_device_get_keys(struct libinput_device *device,
266 char *keys, size_t size);
269 libinput_device_calibrate(struct libinput_device *device,
270 float calibration[6]);
272 #endif /* LIBINPUT_H */