]>
Commit | Line | Data |
---|---|---|
1 | // (C) 2016 Tobias Girstmair, released under the GNU GPL | |
2 | #ifndef __SCANCODES_H__ | |
3 | #define __SCANCODES_H__ | |
4 | ||
5 | #define UTF8_MAX_LENGTH 4 | |
6 | ||
7 | #define MOD_NONE 0 | |
8 | #define MOD_LCTRL 1<<0 | |
9 | #define MOD_LSHIFT 1<<1 | |
10 | #define MOD_LALT 1<<2 | |
11 | #define MOD_LSUPER 1<<3 | |
12 | #define MOD_RCTRL 1<<4 | |
13 | #define MOD_RSHIFT 1<<5 | |
14 | #define MOD_RALT 1<<6 | |
15 | #define MOD_RSUPER 1<<7 | |
16 | ||
17 | struct layout { | |
18 | unsigned short key; //scancode of normal key | |
19 | //if this is NULL, the key does not exist in this layout. | |
20 | unsigned short mod; //bitmask of modifier keys | |
21 | short is_dead; //is dead key (needs to be pressed twice) | |
22 | }; | |
23 | struct keysym { | |
24 | char sym [UTF8_MAX_LENGTH]; //utf-8 encoded key symbol | |
25 | struct layout en_us; //substructure for this layout | |
26 | struct layout de_at; | |
27 | struct layout de_nd; | |
28 | unsigned int unicode; //the unicode number to send via alt+numpad or ^U if char is not available in a keyboard layout | |
29 | }; | |
30 | ||
31 | enum kbdl { //keyboard layouts: | |
32 | na_NA, //reserved | |
33 | en_US, | |
34 | de_AT, | |
35 | de_ND //de_AT-nodeadkeys | |
36 | }; | |
37 | ||
38 | struct keysym* toscan (const char* utf8);//returns the layout struct of a keysym | |
39 | struct layout* tolay (struct keysym* s, enum kbdl layout); //returns layout struct from keysym struct | |
40 | #endif |