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.
29 #include <sys/epoll.h>
34 #include "libinput-private.h"
37 struct libinput_source {
38 libinput_source_dispatch_t dispatch;
44 struct libinput_event {
45 enum libinput_event_type type;
46 struct libinput_device *device;
49 struct libinput_event_device_notify {
50 struct libinput_event base;
53 struct libinput_event_keyboard {
54 struct libinput_event base;
57 enum libinput_keyboard_key_state state;
60 struct libinput_event_pointer {
61 struct libinput_event base;
66 enum libinput_pointer_button_state state;
67 enum libinput_pointer_axis axis;
71 struct libinput_event_touch {
72 struct libinput_event base;
81 libinput_default_log_func(enum libinput_log_priority priority,
83 const char *format, va_list args)
88 case LIBINPUT_LOG_PRIORITY_DEBUG: prefix = "debug"; break;
89 case LIBINPUT_LOG_PRIORITY_INFO: prefix = "info"; break;
90 case LIBINPUT_LOG_PRIORITY_ERROR: prefix = "error"; break;
91 default: prefix="<invalid priority>"; break;
94 fprintf(stderr, "libinput %s: ", prefix);
95 vfprintf(stderr, format, args);
99 enum libinput_log_priority priority;
100 libinput_log_handler handler;
104 static struct log_data log_data = {
105 .priority = LIBINPUT_LOG_PRIORITY_ERROR,
106 .handler = libinput_default_log_func,
111 log_msg(enum libinput_log_priority priority, const char *format, ...)
115 if (log_data.handler && log_data.priority <= priority) {
116 va_start(args, format);
117 log_data.handler(priority, log_data.user_data, format, args);
123 libinput_log_set_priority(enum libinput_log_priority priority)
125 log_data.priority = priority;
128 LIBINPUT_EXPORT enum libinput_log_priority
129 libinput_log_get_priority(void)
131 return log_data.priority;
135 libinput_log_set_handler(libinput_log_handler log_handler,
138 log_data.handler = log_handler;
139 log_data.user_data = user_data;
143 libinput_post_event(struct libinput *libinput,
144 struct libinput_event *event);
146 LIBINPUT_EXPORT enum libinput_event_type
147 libinput_event_get_type(struct libinput_event *event)
152 LIBINPUT_EXPORT struct libinput *
153 libinput_event_get_context(struct libinput_event *event)
155 return event->device->seat->libinput;
158 LIBINPUT_EXPORT struct libinput_device *
159 libinput_event_get_device(struct libinput_event *event)
161 return event->device;
164 LIBINPUT_EXPORT struct libinput_event_pointer *
165 libinput_event_get_pointer_event(struct libinput_event *event)
167 switch (event->type) {
168 case LIBINPUT_EVENT_NONE:
169 abort(); /* not used as actual event type */
170 case LIBINPUT_EVENT_DEVICE_ADDED:
171 case LIBINPUT_EVENT_DEVICE_REMOVED:
172 case LIBINPUT_EVENT_KEYBOARD_KEY:
174 case LIBINPUT_EVENT_POINTER_MOTION:
175 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
176 case LIBINPUT_EVENT_POINTER_BUTTON:
177 case LIBINPUT_EVENT_POINTER_AXIS:
178 return (struct libinput_event_pointer *) event;
179 case LIBINPUT_EVENT_TOUCH_DOWN:
180 case LIBINPUT_EVENT_TOUCH_UP:
181 case LIBINPUT_EVENT_TOUCH_MOTION:
182 case LIBINPUT_EVENT_TOUCH_CANCEL:
183 case LIBINPUT_EVENT_TOUCH_FRAME:
190 LIBINPUT_EXPORT struct libinput_event_keyboard *
191 libinput_event_get_keyboard_event(struct libinput_event *event)
193 switch (event->type) {
194 case LIBINPUT_EVENT_NONE:
195 abort(); /* not used as actual event type */
196 case LIBINPUT_EVENT_DEVICE_ADDED:
197 case LIBINPUT_EVENT_DEVICE_REMOVED:
199 case LIBINPUT_EVENT_KEYBOARD_KEY:
200 return (struct libinput_event_keyboard *) event;
201 case LIBINPUT_EVENT_POINTER_MOTION:
202 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
203 case LIBINPUT_EVENT_POINTER_BUTTON:
204 case LIBINPUT_EVENT_POINTER_AXIS:
205 case LIBINPUT_EVENT_TOUCH_DOWN:
206 case LIBINPUT_EVENT_TOUCH_UP:
207 case LIBINPUT_EVENT_TOUCH_MOTION:
208 case LIBINPUT_EVENT_TOUCH_CANCEL:
209 case LIBINPUT_EVENT_TOUCH_FRAME:
216 LIBINPUT_EXPORT struct libinput_event_touch *
217 libinput_event_get_touch_event(struct libinput_event *event)
219 switch (event->type) {
220 case LIBINPUT_EVENT_NONE:
221 abort(); /* not used as actual event type */
222 case LIBINPUT_EVENT_DEVICE_ADDED:
223 case LIBINPUT_EVENT_DEVICE_REMOVED:
224 case LIBINPUT_EVENT_KEYBOARD_KEY:
225 case LIBINPUT_EVENT_POINTER_MOTION:
226 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
227 case LIBINPUT_EVENT_POINTER_BUTTON:
228 case LIBINPUT_EVENT_POINTER_AXIS:
230 case LIBINPUT_EVENT_TOUCH_DOWN:
231 case LIBINPUT_EVENT_TOUCH_UP:
232 case LIBINPUT_EVENT_TOUCH_MOTION:
233 case LIBINPUT_EVENT_TOUCH_CANCEL:
234 case LIBINPUT_EVENT_TOUCH_FRAME:
235 return (struct libinput_event_touch *) event;
241 LIBINPUT_EXPORT struct libinput_event_device_notify *
242 libinput_event_get_device_notify_event(struct libinput_event *event)
244 switch (event->type) {
245 case LIBINPUT_EVENT_NONE:
246 abort(); /* not used as actual event type */
247 case LIBINPUT_EVENT_DEVICE_ADDED:
248 case LIBINPUT_EVENT_DEVICE_REMOVED:
249 return (struct libinput_event_device_notify *) event;
250 case LIBINPUT_EVENT_KEYBOARD_KEY:
251 case LIBINPUT_EVENT_POINTER_MOTION:
252 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
253 case LIBINPUT_EVENT_POINTER_BUTTON:
254 case LIBINPUT_EVENT_POINTER_AXIS:
255 case LIBINPUT_EVENT_TOUCH_DOWN:
256 case LIBINPUT_EVENT_TOUCH_UP:
257 case LIBINPUT_EVENT_TOUCH_MOTION:
258 case LIBINPUT_EVENT_TOUCH_CANCEL:
259 case LIBINPUT_EVENT_TOUCH_FRAME:
266 LIBINPUT_EXPORT uint32_t
267 libinput_event_keyboard_get_time(struct libinput_event_keyboard *event)
272 LIBINPUT_EXPORT uint32_t
273 libinput_event_keyboard_get_key(struct libinput_event_keyboard *event)
278 LIBINPUT_EXPORT enum libinput_keyboard_key_state
279 libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event)
284 LIBINPUT_EXPORT uint32_t
285 libinput_event_pointer_get_time(struct libinput_event_pointer *event)
290 LIBINPUT_EXPORT li_fixed_t
291 libinput_event_pointer_get_dx(struct libinput_event_pointer *event)
296 LIBINPUT_EXPORT li_fixed_t
297 libinput_event_pointer_get_dy(struct libinput_event_pointer *event)
302 LIBINPUT_EXPORT li_fixed_t
303 libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event)
308 LIBINPUT_EXPORT li_fixed_t
309 libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event)
314 LIBINPUT_EXPORT li_fixed_t
315 libinput_event_pointer_get_absolute_x_transformed(
316 struct libinput_event_pointer *event,
319 struct evdev_device *device =
320 (struct evdev_device *) event->base.device;
322 return evdev_device_transform_x(device, event->x, width);
325 LIBINPUT_EXPORT li_fixed_t
326 libinput_event_pointer_get_absolute_y_transformed(
327 struct libinput_event_pointer *event,
330 struct evdev_device *device =
331 (struct evdev_device *) event->base.device;
333 return evdev_device_transform_y(device, event->y, height);
336 LIBINPUT_EXPORT uint32_t
337 libinput_event_pointer_get_button(struct libinput_event_pointer *event)
339 return event->button;
342 LIBINPUT_EXPORT enum libinput_pointer_button_state
343 libinput_event_pointer_get_button_state(struct libinput_event_pointer *event)
348 LIBINPUT_EXPORT enum libinput_pointer_axis
349 libinput_event_pointer_get_axis(struct libinput_event_pointer *event)
354 LIBINPUT_EXPORT li_fixed_t
355 libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event)
360 LIBINPUT_EXPORT uint32_t
361 libinput_event_touch_get_time(struct libinput_event_touch *event)
366 LIBINPUT_EXPORT int32_t
367 libinput_event_touch_get_slot(struct libinput_event_touch *event)
372 LIBINPUT_EXPORT int32_t
373 libinput_event_touch_get_seat_slot(struct libinput_event_touch *event)
375 return event->seat_slot;
378 LIBINPUT_EXPORT li_fixed_t
379 libinput_event_touch_get_x(struct libinput_event_touch *event)
384 LIBINPUT_EXPORT li_fixed_t
385 libinput_event_touch_get_x_transformed(struct libinput_event_touch *event,
388 struct evdev_device *device =
389 (struct evdev_device *) event->base.device;
391 return evdev_device_transform_x(device, event->x, width);
394 LIBINPUT_EXPORT li_fixed_t
395 libinput_event_touch_get_y_transformed(struct libinput_event_touch *event,
398 struct evdev_device *device =
399 (struct evdev_device *) event->base.device;
401 return evdev_device_transform_y(device, event->y, height);
404 LIBINPUT_EXPORT li_fixed_t
405 libinput_event_touch_get_y(struct libinput_event_touch *event)
410 struct libinput_source *
411 libinput_add_fd(struct libinput *libinput,
413 libinput_source_dispatch_t dispatch,
416 struct libinput_source *source;
417 struct epoll_event ep;
419 source = malloc(sizeof *source);
423 source->dispatch = dispatch;
424 source->user_data = user_data;
427 memset(&ep, 0, sizeof ep);
429 ep.data.ptr = source;
431 if (epoll_ctl(libinput->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
441 libinput_remove_source(struct libinput *libinput,
442 struct libinput_source *source)
444 epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
446 list_insert(&libinput->source_destroy_list, &source->link);
450 libinput_init(struct libinput *libinput,
451 const struct libinput_interface *interface,
452 const struct libinput_interface_backend *interface_backend,
455 libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);;
456 if (libinput->epoll_fd < 0)
459 libinput->events_len = 4;
460 libinput->events = zalloc(libinput->events_len * sizeof(*libinput->events));
461 if (!libinput->events) {
462 close(libinput->epoll_fd);
466 libinput->interface = interface;
467 libinput->interface_backend = interface_backend;
468 libinput->user_data = user_data;
469 list_init(&libinput->source_destroy_list);
470 list_init(&libinput->seat_list);
476 libinput_device_destroy(struct libinput_device *device);
479 libinput_seat_destroy(struct libinput_seat *seat);
482 libinput_drop_destroyed_sources(struct libinput *libinput)
484 struct libinput_source *source, *next;
486 list_for_each_safe(source, next, &libinput->source_destroy_list, link)
488 list_init(&libinput->source_destroy_list);
492 libinput_destroy(struct libinput *libinput)
494 struct libinput_event *event;
495 struct libinput_device *device, *next_device;
496 struct libinput_seat *seat, *next_seat;
498 if (libinput == NULL)
501 libinput_suspend(libinput);
503 libinput->interface_backend->destroy(libinput);
505 while ((event = libinput_get_event(libinput)))
506 libinput_event_destroy(event);
508 libinput_drop_destroyed_sources(libinput);
510 free(libinput->events);
512 list_for_each_safe(seat, next_seat, &libinput->seat_list, link) {
513 list_for_each_safe(device, next_device,
516 libinput_device_destroy(device);
518 libinput_seat_destroy(seat);
521 close(libinput->epoll_fd);
526 libinput_event_destroy(struct libinput_event *event)
532 libinput_device_unref(event->device);
538 open_restricted(struct libinput *libinput,
539 const char *path, int flags)
541 return libinput->interface->open_restricted(path,
543 libinput->user_data);
547 close_restricted(struct libinput *libinput, int fd)
549 return libinput->interface->close_restricted(fd, libinput->user_data);
553 libinput_seat_init(struct libinput_seat *seat,
554 struct libinput *libinput,
555 const char *physical_name,
556 const char *logical_name,
557 libinput_seat_destroy_func destroy)
560 seat->libinput = libinput;
561 seat->physical_name = strdup(physical_name);
562 seat->logical_name = strdup(logical_name);
563 seat->destroy = destroy;
564 list_init(&seat->devices_list);
565 list_insert(&libinput->seat_list, &seat->link);
569 libinput_seat_ref(struct libinput_seat *seat)
575 libinput_seat_destroy(struct libinput_seat *seat)
577 list_remove(&seat->link);
578 free(seat->logical_name);
579 free(seat->physical_name);
584 libinput_seat_unref(struct libinput_seat *seat)
586 assert(seat->refcount > 0);
588 if (seat->refcount == 0)
589 libinput_seat_destroy(seat);
593 libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data)
595 seat->user_data = user_data;
598 LIBINPUT_EXPORT void *
599 libinput_seat_get_user_data(struct libinput_seat *seat)
601 return seat->user_data;
604 LIBINPUT_EXPORT const char *
605 libinput_seat_get_physical_name(struct libinput_seat *seat)
607 return seat->physical_name;
610 LIBINPUT_EXPORT const char *
611 libinput_seat_get_logical_name(struct libinput_seat *seat)
613 return seat->logical_name;
617 libinput_device_init(struct libinput_device *device,
618 struct libinput_seat *seat)
621 device->refcount = 1;
625 libinput_device_ref(struct libinput_device *device)
631 libinput_device_destroy(struct libinput_device *device)
633 evdev_device_destroy((struct evdev_device *) device);
637 libinput_device_unref(struct libinput_device *device)
639 assert(device->refcount > 0);
641 if (device->refcount == 0)
642 libinput_device_destroy(device);
646 libinput_get_fd(struct libinput *libinput)
648 return libinput->epoll_fd;
652 libinput_dispatch(struct libinput *libinput)
654 struct libinput_source *source;
655 struct epoll_event ep[32];
658 count = epoll_wait(libinput->epoll_fd, ep, ARRAY_LENGTH(ep), 0);
662 for (i = 0; i < count; ++i) {
663 source = ep[i].data.ptr;
664 if (source->fd == -1)
667 source->dispatch(source->user_data);
670 libinput_drop_destroyed_sources(libinput);
676 init_event_base(struct libinput_event *event,
677 struct libinput_device *device,
678 enum libinput_event_type type)
681 event->device = device;
685 post_base_event(struct libinput_device *device,
686 enum libinput_event_type type,
687 struct libinput_event *event)
689 struct libinput *libinput = device->seat->libinput;
690 init_event_base(event, device, type);
691 libinput_post_event(libinput, event);
695 post_device_event(struct libinput_device *device,
696 enum libinput_event_type type,
697 struct libinput_event *event)
699 init_event_base(event, device, type);
700 libinput_post_event(device->seat->libinput, event);
704 notify_added_device(struct libinput_device *device)
706 struct libinput_event_device_notify *added_device_event;
708 added_device_event = zalloc(sizeof *added_device_event);
709 if (!added_device_event)
712 post_base_event(device,
713 LIBINPUT_EVENT_DEVICE_ADDED,
714 &added_device_event->base);
718 notify_removed_device(struct libinput_device *device)
720 struct libinput_event_device_notify *removed_device_event;
722 removed_device_event = zalloc(sizeof *removed_device_event);
723 if (!removed_device_event)
726 post_base_event(device,
727 LIBINPUT_EVENT_DEVICE_REMOVED,
728 &removed_device_event->base);
732 keyboard_notify_key(struct libinput_device *device,
735 enum libinput_keyboard_key_state state)
737 struct libinput_event_keyboard *key_event;
739 key_event = zalloc(sizeof *key_event);
743 *key_event = (struct libinput_event_keyboard) {
749 post_device_event(device,
750 LIBINPUT_EVENT_KEYBOARD_KEY,
755 pointer_notify_motion(struct libinput_device *device,
760 struct libinput_event_pointer *motion_event;
762 motion_event = zalloc(sizeof *motion_event);
766 *motion_event = (struct libinput_event_pointer) {
772 post_device_event(device,
773 LIBINPUT_EVENT_POINTER_MOTION,
774 &motion_event->base);
778 pointer_notify_motion_absolute(struct libinput_device *device,
783 struct libinput_event_pointer *motion_absolute_event;
785 motion_absolute_event = zalloc(sizeof *motion_absolute_event);
786 if (!motion_absolute_event)
789 *motion_absolute_event = (struct libinput_event_pointer) {
795 post_device_event(device,
796 LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE,
797 &motion_absolute_event->base);
801 pointer_notify_button(struct libinput_device *device,
804 enum libinput_pointer_button_state state)
806 struct libinput_event_pointer *button_event;
808 button_event = zalloc(sizeof *button_event);
812 *button_event = (struct libinput_event_pointer) {
818 post_device_event(device,
819 LIBINPUT_EVENT_POINTER_BUTTON,
820 &button_event->base);
824 pointer_notify_axis(struct libinput_device *device,
826 enum libinput_pointer_axis axis,
829 struct libinput_event_pointer *axis_event;
831 axis_event = zalloc(sizeof *axis_event);
835 *axis_event = (struct libinput_event_pointer) {
841 post_device_event(device,
842 LIBINPUT_EVENT_POINTER_AXIS,
847 touch_notify_touch_down(struct libinput_device *device,
854 struct libinput_event_touch *touch_event;
856 touch_event = zalloc(sizeof *touch_event);
860 *touch_event = (struct libinput_event_touch) {
863 .seat_slot = seat_slot,
868 post_device_event(device,
869 LIBINPUT_EVENT_TOUCH_DOWN,
874 touch_notify_touch_motion(struct libinput_device *device,
881 struct libinput_event_touch *touch_event;
883 touch_event = zalloc(sizeof *touch_event);
887 *touch_event = (struct libinput_event_touch) {
890 .seat_slot = seat_slot,
895 post_device_event(device,
896 LIBINPUT_EVENT_TOUCH_MOTION,
901 touch_notify_touch_up(struct libinput_device *device,
906 struct libinput_event_touch *touch_event;
908 touch_event = zalloc(sizeof *touch_event);
912 *touch_event = (struct libinput_event_touch) {
915 .seat_slot = seat_slot,
918 post_device_event(device,
919 LIBINPUT_EVENT_TOUCH_UP,
924 touch_notify_frame(struct libinput_device *device,
927 struct libinput_event_touch *touch_event;
929 touch_event = zalloc(sizeof *touch_event);
933 *touch_event = (struct libinput_event_touch) {
937 post_device_event(device,
938 LIBINPUT_EVENT_TOUCH_FRAME,
944 libinput_post_event(struct libinput *libinput,
945 struct libinput_event *event)
947 struct libinput_event **events = libinput->events;
948 size_t events_len = libinput->events_len;
949 size_t events_count = libinput->events_count;
954 if (events_count > events_len) {
956 events = realloc(events, events_len * sizeof *events);
958 fprintf(stderr, "Failed to reallocate event ring "
963 if (libinput->events_count > 0 && libinput->events_in == 0) {
964 libinput->events_in = libinput->events_len;
965 } else if (libinput->events_count > 0 &&
966 libinput->events_out >= libinput->events_in) {
967 move_len = libinput->events_len - libinput->events_out;
968 new_out = events_len - move_len;
969 memmove(events + new_out,
970 events + libinput->events_out,
971 move_len * sizeof *events);
972 libinput->events_out = new_out;
975 libinput->events = events;
976 libinput->events_len = events_len;
980 libinput_device_ref(event->device);
982 libinput->events_count = events_count;
983 events[libinput->events_in] = event;
984 libinput->events_in = (libinput->events_in + 1) % libinput->events_len;
987 LIBINPUT_EXPORT struct libinput_event *
988 libinput_get_event(struct libinput *libinput)
990 struct libinput_event *event;
992 if (libinput->events_count == 0)
995 event = libinput->events[libinput->events_out];
996 libinput->events_out =
997 (libinput->events_out + 1) % libinput->events_len;
998 libinput->events_count--;
1003 LIBINPUT_EXPORT enum libinput_event_type
1004 libinput_next_event_type(struct libinput *libinput)
1006 struct libinput_event *event;
1008 if (libinput->events_count == 0)
1009 return LIBINPUT_EVENT_NONE;
1011 event = libinput->events[libinput->events_out];
1015 LIBINPUT_EXPORT void *
1016 libinput_get_user_data(struct libinput *libinput)
1018 return libinput->user_data;
1022 libinput_resume(struct libinput *libinput)
1024 return libinput->interface_backend->resume(libinput);
1027 LIBINPUT_EXPORT void
1028 libinput_suspend(struct libinput *libinput)
1030 libinput->interface_backend->suspend(libinput);
1033 LIBINPUT_EXPORT void
1034 libinput_device_set_user_data(struct libinput_device *device, void *user_data)
1036 device->user_data = user_data;
1039 LIBINPUT_EXPORT void *
1040 libinput_device_get_user_data(struct libinput_device *device)
1042 return device->user_data;
1045 LIBINPUT_EXPORT const char *
1046 libinput_device_get_sysname(struct libinput_device *device)
1048 return evdev_device_get_sysname((struct evdev_device *) device);
1051 LIBINPUT_EXPORT const char *
1052 libinput_device_get_output_name(struct libinput_device *device)
1054 return evdev_device_get_output((struct evdev_device *) device);
1057 LIBINPUT_EXPORT struct libinput_seat *
1058 libinput_device_get_seat(struct libinput_device *device)
1060 return device->seat;
1063 LIBINPUT_EXPORT void
1064 libinput_device_led_update(struct libinput_device *device,
1065 enum libinput_led leds)
1067 evdev_device_led_update((struct evdev_device *) device, leds);
1071 libinput_device_get_keys(struct libinput_device *device,
1072 char *keys, size_t size)
1074 return evdev_device_get_keys((struct evdev_device *) device,
1079 LIBINPUT_EXPORT void
1080 libinput_device_calibrate(struct libinput_device *device,
1081 float calibration[6])
1083 evdev_device_calibrate((struct evdev_device *) device, calibration);
1087 libinput_device_has_capability(struct libinput_device *device,
1088 enum libinput_device_capability capability)
1090 return evdev_device_has_capability((struct evdev_device *) device,
1094 LIBINPUT_EXPORT struct libinput_event *
1095 libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event)
1097 return &event->base;
1100 LIBINPUT_EXPORT struct libinput_event *
1101 libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event)
1103 return &event->base;
1106 LIBINPUT_EXPORT struct libinput_event *
1107 libinput_event_pointer_get_base_event(struct libinput_event_pointer *event)
1109 return &event->base;
1112 LIBINPUT_EXPORT struct libinput_event *
1113 libinput_event_touch_get_base_event(struct libinput_event_touch *event)
1115 return &event->base;