1 /**
2  * @file lv_libinput_private.h
3  *
4  */
5 
6 #ifndef LV_LIBINPUT_PRIVATE_H
7 #define LV_LIBINPUT_PRIVATE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 
17 #include "lv_libinput.h"
18 
19 #if LV_USE_LIBINPUT
20 
21 #if LV_LIBINPUT_XKB
22 #include "lv_xkb_private.h"
23 #endif
24 
25 /*********************
26  *      DEFINES
27  *********************/
28 
29 /**********************
30  *      TYPEDEFS
31  **********************/
32 
33 struct _lv_libinput_event_t {
34     lv_indev_state_t pressed;
35     int key_val;
36     lv_point_t point;
37 };
38 
39 struct _lv_libinput_t {
40     int fd;
41     struct pollfd fds[1];
42 
43     /* The points array is implemented as a circular LIFO queue */
44     lv_libinput_event_t points[LV_LIBINPUT_MAX_EVENTS]; /* Event buffer */
45     lv_libinput_event_t slots[2]; /* Realtime state of up to 2 fingers to handle multitouch */
46 
47     /* Pointer devices work a bit differently in libinput which requires us to store their last known state */
48     lv_point_t pointer_position;
49     bool pointer_button_down;
50 
51     int start; /* Index of start of event queue */
52     int end; /* Index of end of queue*/
53     lv_libinput_event_t last_event; /* Report when no new events
54                                    * to keep indev state consistent
55                                    */
56     bool deinit; /* Tell worker thread to quit */
57     pthread_mutex_t event_lock;
58     pthread_t worker_thread;
59 
60     struct libinput * libinput_context;
61     struct libinput_device * libinput_device;
62 
63 #if LV_LIBINPUT_XKB
64     lv_xkb_t xkb;
65 #endif /* LV_LIBINPUT_XKB */
66 };
67 
68 
69 /**********************
70  * GLOBAL PROTOTYPES
71  **********************/
72 
73 /**********************
74  *      MACROS
75  **********************/
76 
77 #endif /* LV_USE_LIBINPUT */
78 
79 #ifdef __cplusplus
80 } /*extern "C"*/
81 #endif
82 
83 #endif /*LV_LIBINPUT_PRIVATE_H*/
84