1 /**
2  * @file lv_xkb.h
3  *
4  */
5 
6 #ifndef LV_XKB_H
7 #define LV_XKB_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 
17 #include "../../lv_conf_internal.h"
18 
19 #if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB
20 
21 #include "../../misc/lv_types.h"
22 #include <stdbool.h>
23 #include <xkbcommon/xkbcommon.h>
24 
25 /*********************
26  *      DEFINES
27  *********************/
28 
29 /**********************
30  * GLOBAL PROTOTYPES
31  **********************/
32 
33 /**
34  * Initialise an XKB descriptor.
35  * @return true if the initialisation was successful
36  */
37 bool lv_xkb_init(lv_xkb_t * dsc, struct xkb_rule_names names);
38 
39 /**
40  * De-initialise an XKB descriptor.
41  * @param dsc Pointer to descriptor
42  */
43 void lv_xkb_deinit(lv_xkb_t * dsc);
44 
45 /**
46  * Process an evdev scancode using a specific XKB descriptor.
47  * @param state XKB descriptor to use
48  * @param scancode evdev scancode to process
49  * @param down true if the key was pressed, false if it was releases
50  * @return the (first) UTF-8 character produced by the event or 0 if no output was produced
51  */
52 uint32_t lv_xkb_process_key(lv_xkb_t * dsc, uint32_t scancode, bool down);
53 
54 /**********************
55  *      MACROS
56  **********************/
57 
58 #endif /* LV_LIBINPUT_XKB */
59 
60 #ifdef __cplusplus
61 } /* extern "C" */
62 #endif
63 
64 #endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */
65