Keyboards
A keyboard is a set of rules and transforms in a Processor specific format for transforming key events into action items. The keyboard is parsed and loaded by the processor and made available in an immutable fashion for use with any number of state objects.
km_kbp_keyboard_attrs
Description
A static structure describing the basic keyboard attributes.
Specification
typedef struct {
km_kbp_cp const * version_string;
km_kbp_cp const * id;
km_kbp_path_name folder_path;
km_kbp_option_item const * default_options;
} km_kbp_keyboard_attrs;
Members
version_string
- Processor specific version string.
id
- Keyman keyboard ID string.
folder_path
- Path to the unpacked folder containing the keyboard and associated resources.
default_options
-
Pointer to an array of
km_kbp_option_item
, terminated withKM_KBP_OPTIONS_END
.
km_kbp_keyboard_load
Description
Parse and load keyboard from the supplied path and a pointer to the loaded keyboard into the out paramter.
Specification
km_kbp_status
km_kbp_keyboard_load(km_kbp_path_name kb_path,
km_kbp_keyboard **keyboard);
Parameters
kb_path
- On Windows, a UTF-16 string; on other platforms, a C string: contains a valid path to the keyboard file.
keyboard
-
A pointer to result variable:
A pointer to the opaque keyboard object returned by the Processor. This
memory must be freed with a call to
km_kbp_keyboard_dispose()
Returns
KM_KBP_STATUS_OK
- On success.
KM_KBP_STATUS_NO_MEM
- In the event an internal memory allocation fails.
KM_KBP_STATUS_IO_ERROR
- In the event the keyboard file is unparseable for any reason.
KM_KBP_STATUS_INVALID_ARGUMENT
-
In the event the file doesn't exist or is inaccesible or
keyboard
is null. KM_KBP_STATUS_OS_ERROR
- Bit 31 (high bit) set, bits 0-30 are an OS-specific error code.
km_kbp_keyboard_dispose
Description
Free the allocated memory belonging to an opaque keyboard object
previously returned by
km_kbp_keyboard_load()
.
Specification
void
km_kbp_keyboard_dispose(km_kbp_keyboard *keyboard);
Parameters
keyboard
- A pointer to the opaque keyboard object to be disposed of.
km_kbp_keyboard_get_attrs
Description
Returns the const internal attributes of the keyboard. This structure is valid for the lifetime of the opaque keyboard object. Do not modify the returned data.
Specification
km_kbp_status
km_kbp_keyboard_get_attrs(km_kbp_keyboard const *keyboard,
km_kbp_keyboard_attrs const **out);
Parameters
keyboard
- A pointer to the opaque keyboard object to be queried.
out
-
A pointer to the result:
A pointer to a
km_kbp_keyboard_attrs
structure.
Returns
KM_KBP_STATUS_OK
- On success.
KM_KBP_STATUS_INVALID_ARGUMENT
- If non-optional parameters are null.