26#ifndef _ULTIBO_KEYMAP_H
27#define _ULTIBO_KEYMAP_H
37#define KEYMAP_KEY_COUNT 256
38#define KEYMAP_ROW_COUNT 4
39#define KEYMAP_ROW_SIZE sizeof(uint16_t)
41#define KEYMAP_MAX_CAPSKEYS 50
42#define KEYMAP_MAX_DEADKEYS 5
43#define KEYMAP_MAX_RESOLVES 20
46#define KEYMAP_SIGNATURE 0x863FDBA1
49#define KEYMAP_NAME_LENGTH SIZE_64
50#define KEYMAP_DESC_LENGTH SIZE_128
53#define KEYMAP_MODE_NONE 0
56#define KEYMAP_FLAG_NONE 0x00000000
57#define KEYMAP_FLAG_ALTGR 0x00000001
58#define KEYMAP_FLAG_CAPS_ALL 0x00000002
59#define KEYMAP_FLAG_CAPS_ASCII 0x00000004
62#define KEYMAP_INDEX_NORMAL 0
63#define KEYMAP_INDEX_SHIFT 1
64#define KEYMAP_INDEX_ALTGR 2
65#define KEYMAP_INDEX_SHIFT_ALTGR 3
67#define KEYMAP_INDEX_COUNT 4
#define STDCALL
Definition globaltypes.h:45
HANDLE KEYMAP_HANDLE
Definition globaltypes.h:123
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
wchar_t WCHAR
Standard WideChar type (2 bytes) (Redeclared here for flexibility).
Definition globaltypes.h:58
uint16_t KEYMAP_CHARS[]
Definition keymap.h:89
KEYMAP_HANDLE STDCALL keymap_load(KEYMAP_HEADER *header, KEYMAP_DATA *data, uint32_t size)
Load a Keymap from a keymap data block and add to the Keymap table.
BOOL STDCALL keymap_check_capskey(KEYMAP_HANDLE handle, uint16_t scancode)
Check if a scan code is affected by the Caps Lock key in the specified keymap.
struct _KEYMAP_HEADER KEYMAP_HEADER
uint32_t STDCALL keymap_get_description(KEYMAP_HANDLE handle, char *description, uint32_t len)
Get the description of the specified keymap.
KEYMAP_ENTRY *STDCALL keymap_check(KEYMAP_ENTRY *keymap)
Check if the supplied Keymap is in the Keymap table.
KEYMAP_HANDLE STDCALL keymap_get_default(void)
Get the current default keymap.
#define KEYMAP_DESC_LENGTH
Length of keymap description.
Definition keymap.h:50
KEYMAP_HANDLE STDCALL keymap_find_by_description(const char *description)
Find a keymap by description.
uint32_t STDCALL keymap_get_properties(KEYMAP_HANDLE handle, KEYMAP_PROPERTIES *properties)
Get the properties of the specified keymap.
struct _KEYMAP_DEADKEYS KEYMAP_DEADKEYS
struct _KEYMAP_DATA KEYMAP_DATA
BOOL STDCALL keymap_resolve_deadkey(KEYMAP_HANDLE handle, uint16_t deadcode, uint16_t scancode, uint8_t deadindex, uint8_t scanindex, uint16_t *keycode)
Resolve a Dead Key and the next scan code to a key code value.
#define KEYMAP_MAX_DEADKEYS
Maximum number of keys that can be listed in the TKeymapDeadkeys structure.
Definition keymap.h:42
uint16_t STDCALL keymap_get_key_code(KEYMAP_HANDLE handle, uint16_t scancode, uint8_t index)
Resolve a scan code and index value to a key code using the specified keymap.
struct _KEYMAP_ENTRY KEYMAP_ENTRY
Definition keymap.h:140
uint32_t STDCALL keymap_get_name(KEYMAP_HANDLE handle, char *name, uint32_t len)
Get the name of the specified keymap.
uint32_t STDCALL keymap_get_count(void)
Get the current keymap count.
uint32_t STDCALL(* keymap_enumerate_cb)(KEYMAP_HANDLE handle, void *data)
Definition keymap.h:143
BOOL STDCALL keymap_check_flag(KEYMAP_HANDLE handle, uint32_t flag)
Check if a specified keymap has a particular flag set or not.
uint32_t STDCALL keymap_enumerate(keymap_enumerate_cb callback, void *data)
Enumerate all loaded keymaps.
struct _KEYMAP_DEADKEY KEYMAP_DEADKEY
struct _KEYMAP_CAPSKEY KEYMAP_CAPSKEY
KEYMAP_HANDLE STDCALL keymap_load_ex(KEYMAP_HEADER *header, KEYMAP_DATA *data, KEYMAP_CAPSKEYS *capskeys, KEYMAP_DEADKEYS *deadkeys, uint32_t size, KEYMAP_PROPERTIES *properties)
Load a Keymap from a keymap data block and add to the Keymap table.
#define KEYMAP_MAX_RESOLVES
Maximum number of resolves that can be listed in the TKeymapDeadkey structure.
Definition keymap.h:43
WCHAR STDCALL keymap_get_char_unicode(KEYMAP_HANDLE handle, uint16_t keycode)
Resolve a key code value to a Unicode character code using the specified keymap.
#define KEYMAP_NAME_LENGTH
Length of keymap name.
Definition keymap.h:49
char STDCALL keymap_get_char_code(KEYMAP_HANDLE handle, uint16_t keycode)
Resolve a key code value to an ANSI character code using the specified keymap.
struct _KEYMAP_CAPSKEYS KEYMAP_CAPSKEYS
BOOL STDCALL keymap_check_deadkey(KEYMAP_HANDLE handle, uint16_t scancode, uint8_t index)
Check if a scan code represents a Dead Key in the specified keymap.
uint32_t STDCALL keymap_set_default(KEYMAP_HANDLE handle)
Set the current default keymap.
uint32_t STDCALL keymap_unload(KEYMAP_HANDLE handle)
Unload an existing keymap and remove from the Keymap table.
#define KEYMAP_INDEX_COUNT
Definition keymap.h:67
struct _KEYMAP_PROPERTIES KEYMAP_PROPERTIES
Definition keymap.h:129
#define KEYMAP_MAX_CAPSKEYS
Maximum number of keys that can be listed in the TKeymapCapskeys structure.
Definition keymap.h:41
KEYMAP_HANDLE STDCALL keymap_find_by_name(const char *name)
Find a keymap by name.
struct _KEYMAP_RESOLVE KEYMAP_RESOLVE
KEYMAP_CAPSKEY keys[KEYMAP_MAX_CAPSKEYS]
Definition keymap.h:102
uint32_t count
Definition keymap.h:101
uint16_t last
Last key in caps key range (SCAN_CODE_* value)(Make first and last the same for a single key).
Definition keymap.h:95
uint16_t first
First key in caps key range (SCAN_CODE_* value).
Definition keymap.h:94
uint16_t data[256][KEYMAP_INDEX_COUNT]
Key mapping data, 4 words for Normal, Shift, AltGr, Shift+AltGr for each of the 256 keys (See KEY_COD...
Definition keymap.h:85
KEYMAP_DEADKEY keys[KEYMAP_MAX_DEADKEYS]
Definition keymap.h:125
uint32_t count
Definition keymap.h:124
KEYMAP_RESOLVE resolves[KEYMAP_MAX_RESOLVES]
Definition keymap.h:118
uint8_t index
The index state in which the key behaves as a deadkey (eg KEYMAP_INDEX_NORMAL).
Definition keymap.h:117
uint16_t key
The scan code of the key which behaves as a deadkey (SCAN_CODE_* value).
Definition keymap.h:116
KEYMAP_ENTRY * prev
Previous entry in Keymap table.
Definition keymap.h:161
KEYMAP_DEADKEYS * deadkeysdata
Keymap Deadkeys data (Keys which behave as Dead keys).
Definition keymap.h:159
KEYMAP_ENTRY * next
Next entry in Keymap table.
Definition keymap.h:162
char keymapname[KEYMAP_NAME_LENGTH]
Keymap name.
Definition keymap.h:152
KEYMAP_CAPSKEYS * capskeysdata
Keymap Capskeys data (Keys affected by Caps Lock).
Definition keymap.h:158
uint32_t keymapflags
Keymap flags (eg KEYMAP_FLAG_ALTGR).
Definition keymap.h:151
uint32_t rowcount
Number of index rows in key data (Default: KEYMAP_ROW_COUNT).
Definition keymap.h:157
uint32_t signature
Signature for entry validation.
Definition keymap.h:149
char keymapdescription[KEYMAP_DESC_LENGTH]
Keymap description.
Definition keymap.h:153
uint32_t keymapmode
Keymap mode (eg KEYMAP_MODE_NONE).
Definition keymap.h:150
void * keydata
Keymap key data.
Definition keymap.h:155
uint32_t keycount
Number of keys in key data (Default: KEYMAP_KEY_COUNT).
Definition keymap.h:156
char keymapname[KEYMAP_NAME_LENGTH]
Keymap name.
Definition keymap.h:136
uint32_t keymapflags
Keymap flags (eg KEYMAP_FLAG_ALTGR).
Definition keymap.h:133
uint32_t rowcount
Number of index rows in keymap (Default: KEYMAP_ROW_COUNT).
Definition keymap.h:135
char keymapdescription[KEYMAP_DESC_LENGTH]
Keymap description.
Definition keymap.h:137
uint32_t keymapmode
Keymap mode (eg KEYMAP_MODE_NONE).
Definition keymap.h:132
uint32_t keycount
Number of keys in keymap (Default: KEYMAP_KEY_COUNT).
Definition keymap.h:134
uint16_t code
The key code of the resulting character (KEY_CODE_* value).
Definition keymap.h:110
uint8_t index
The index state of the key pressed after the deadkey (eg KEYMAP_INDEX_NORMAL).
Definition keymap.h:109
uint16_t key
The scan code of the key pressed after the deadkey (SCAN_CODE_* value).
Definition keymap.h:108