blob: 7bbb202c7f50c1516d571e31cbe4137ce63eecfe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef IMV_KEYBOARD_H
#define IMV_KEYBOARD_H
#include <stdbool.h>
#include <unistd.h>
struct imv_keyboard;
/* Create a keyboard instance */
struct imv_keyboard *imv_keyboard_create(void);
/* Clean up a keyboard */
void imv_keyboard_free(struct imv_keyboard *keyboard);
/* Notify the keyboard of the state of a key */
void imv_keyboard_update_key(struct imv_keyboard *keyboard, int scancode, bool pressed);
/* Write the null-terminated name of the key corresponding to scancode into buf */
size_t imv_keyboard_keyname(struct imv_keyboard *keyboard, int scancode, char *buf, size_t buflen);
/* Describe the key corresponding to scancode, with modifier keys prefixed */
char *imv_keyboard_describe_key(struct imv_keyboard *keyboard, int scancode);
/* Write the null-terminated text generated by scancode being pressed into buf */
size_t imv_keyboard_get_text(struct imv_keyboard *keyboard, int scancode, char *buf, size_t buflen);
/* Initialise the keymap from a string containing the description */
void imv_keyboard_set_keymap(struct imv_keyboard *keyboard, const char *keymap);
#endif
|