libinput  0.1.0
A wrapper library for input devices
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
libinput.h
Go to the documentation of this file.
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_H
24 #define LIBINPUT_H
25 
26 #include <stdlib.h>
27 #include <stdint.h>
28 #include <libudev.h>
29 
42 typedef int32_t li_fixed_t;
43 
51 };
52 
64 };
65 
75 };
76 
86 };
87 
97 };
98 
99 
108 };
109 
122 
132 
138 
140 
145 
155 };
156 
157 struct libinput;
158 struct libinput_device;
159 struct libinput_seat;
160 
161 struct libinput_event;
162 struct libinput_event_device_notify;
163 struct libinput_event_keyboard;
164 struct libinput_event_pointer;
165 
176 struct libinput_event_touch;
177 
190 static inline double
192 {
193  union {
194  double d;
195  int64_t i;
196  } u;
197 
198  u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
199 
200  return u.d - (3LL << 43);
201 }
202 
211 static inline int
213 {
214  return f / 256;
215 }
216 
228 void
229 libinput_event_destroy(struct libinput_event *event);
230 
239 libinput_event_get_type(struct libinput_event *event);
240 
249 struct libinput *
250 libinput_event_get_context(struct libinput_event *event);
251 
265 struct libinput_device *
266 libinput_event_get_device(struct libinput_event *event);
267 
276 struct libinput_event_pointer *
277 libinput_event_get_pointer_event(struct libinput_event *event);
278 
287 struct libinput_event_keyboard *
288 libinput_event_get_keyboard_event(struct libinput_event *event);
289 
298 struct libinput_event_touch *
299 libinput_event_get_touch_event(struct libinput_event *event);
300 
309 struct libinput_event_device_notify *
310 libinput_event_get_device_notify_event(struct libinput_event *event);
311 
324 uint32_t
325 libinput_event_keyboard_get_time(struct libinput_event_keyboard *event);
326 
332 uint32_t
333 libinput_event_keyboard_get_key(struct libinput_event_keyboard *event);
334 
341 libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event);
342 
355 uint32_t
356 libinput_event_pointer_get_time(struct libinput_event_pointer *event);
357 
371 libinput_event_pointer_get_dx(struct libinput_event_pointer *event);
372 
386 libinput_event_pointer_get_dy(struct libinput_event_pointer *event);
387 
406 libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event);
407 
426 libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event);
427 
447  struct libinput_event_pointer *event,
448  uint32_t width);
449 
469  struct libinput_event_pointer *event,
470  uint32_t height);
471 
484 uint32_t
485 libinput_event_pointer_get_button(struct libinput_event_pointer *event);
486 
500 libinput_event_pointer_get_button_state(struct libinput_event_pointer *event);
501 
515 libinput_event_pointer_get_axis(struct libinput_event_pointer *event);
516 
538 libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
539 
551 uint32_t
553 
568 int32_t
570 
585 int32_t
587 
605 
625 
641  uint32_t width);
642 
658  uint32_t height);
659 
676  int (*open_restricted)(const char *path, int flags, void *user_data);
684  void (*close_restricted)(int fd, void *user_data);
685 };
686 
703 struct libinput *
704 libinput_udev_create_for_seat(const struct libinput_interface *interface,
705  void *user_data,
706  struct udev *udev,
707  const char *seat_id);
708 
725 struct libinput *
726 libinput_path_create_context(const struct libinput_interface *interface,
727  void *user_data);
728 
749 struct libinput_device *
750 libinput_path_add_device(struct libinput *libinput,
751  const char *path);
752 
771 void
772 libinput_path_remove_device(struct libinput_device *device);
773 
782 int
783 libinput_get_fd(struct libinput *libinput);
784 
798 int
799 libinput_dispatch(struct libinput *libinput);
800 
812 struct libinput_event *
813 libinput_get_event(struct libinput *libinput);
814 
827 libinput_next_event_type(struct libinput *libinput);
828 
836 void *
837 libinput_get_user_data(struct libinput *libinput);
838 
850 int
851 libinput_resume(struct libinput *libinput);
852 
862 void
863 libinput_suspend(struct libinput *libinput);
864 
873 void
874 libinput_destroy(struct libinput *libinput);
875 
888 void
890 
905 
920 typedef void (*libinput_log_handler)(enum libinput_log_priority priority,
921  void *user_data,
922  const char *format, va_list args);
923 
939 void
941  void *user_data);
942 
979 void
980 libinput_seat_ref(struct libinput_seat *seat);
981 
992 void
993 libinput_seat_unref(struct libinput_seat *seat);
994 
1006 void
1007 libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data);
1008 
1018 void *
1019 libinput_seat_get_user_data(struct libinput_seat *seat);
1020 
1037 const char *
1038 libinput_seat_get_physical_name(struct libinput_seat *seat);
1039 
1049 const char *
1050 libinput_seat_get_logical_name(struct libinput_seat *seat);
1051 
1066 void
1067 libinput_device_ref(struct libinput_device *device);
1068 
1079 void
1080 libinput_device_unref(struct libinput_device *device);
1081 
1093 void
1094 libinput_device_set_user_data(struct libinput_device *device, void *user_data);
1095 
1105 void *
1106 libinput_device_get_user_data(struct libinput_device *device);
1107 
1116 const char *
1117 libinput_device_get_sysname(struct libinput_device *device);
1118 
1130 const char *
1131 libinput_device_get_output_name(struct libinput_device *device);
1132 
1146 struct libinput_seat *
1147 libinput_device_get_seat(struct libinput_device *device);
1148 
1159 void
1160 libinput_device_led_update(struct libinput_device *device,
1161  enum libinput_led leds);
1162 
1173 int
1174 libinput_device_get_keys(struct libinput_device *device,
1175  char *keys, size_t size);
1176 
1190 void
1191 libinput_device_calibrate(struct libinput_device *device,
1192  float calibration[6]);
1193 
1201 int
1202 libinput_device_has_capability(struct libinput_device *device,
1203  enum libinput_device_capability capability);
1204 
1205 #endif /* LIBINPUT_H */