Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 18.0Version 17.0 (current version)

On this page

You are viewing an incomplete pre-release version of this documentation. Click here to open the current version, 17.0.

Processor - Keyman Core API


km_core_event_flags enum {#km_core_event_flags}

Description

Bit flags to be used with the event_flags parameter of km_core_process_event

Specification

enum km_core_event_flags {
  KM_CORE_EVENT_FLAG_DEFAULT = 0,
  KM_CORE_EVENT_FLAG_TOUCH = 1,
};

Values

KM_CORE_EVENT_FLAG_DEFAULT : default value: hardware

KM_CORE_EVENT_FLAG_TOUCH : set if the event is touch, otherwise hardware


km_core_process_event() {#km_core_process_event}

Description

Run the keyboard on an opaque state object with the provided virtual key and modifer key state. Updates the state object as appropriate and fills out its internal set of actions, which can be retrieved with km_core_state_get_actions.

The state's actions will be cleared at the start of this call; options and context in the state may also be modified.

Specification

KMN_API
km_core_status
km_core_process_event(km_core_state *state,
                     km_core_virtual_key vk,
                     uint16_t modifier_state,
                     uint8_t is_key_down,
                     uint16_t event_flags);

Parameters

state : A pointer to the opaque state object.

vk : A virtual key to be processed.

modifier_state : The combinations of modifier keys set at the time key vk was pressed, bitmask from the km_core_modifier_state enum.

event_flags : Event level flags, see km_core_event_flags

Returns

KM_CORE_STATUS_OK : On success.

KM_CORE_STATUS_NO_MEM : In the event memory is unavailable to allocate internal buffers.

KM_CORE_STATUS_INVALID_ARGUMENT : In the event the state pointer is null or an invalid virtual key or modifier state is passed.


km_core_event() {#km_core_event}

Description

Tell the keyboard processor that an external event has occurred, such as a keyboard being activated through the language switching UI.

The keyboard processor may generate actions which should be processed by the consumer of the API.

The actions will be cleared at the start of this call; options and context in the state may also be modified.

Specification

KMN_API
km_core_status
km_core_event(
  km_core_state *state,
  uint32_t event,
  void* data
);

Parameters

state : A pointer to the opaque state object.

event : The event to be processed, from km_core_event_code enumeration

data : Additional event-specific data. Currently unused, must be nullptr.

Returns

KM_CORE_STATUS_OK : On success.

KM_CORE_STATUS_NO_MEM : In the event memory is unavailable to allocate internal buffers.

KM_CORE_STATUS_INVALID_ARGUMENT : In the event the state pointer is null or an invalid event or data is passed.


km_core_event_code enum {#km_core_event_code}

Description

Possible events to be passed into Keyman Core from the Platform layer.

Specification

enum km_core_event_code {
  KM_CORE_EVENT_KEYBOARD_ACTIVATED = 1,
  //future: KM_CORE_EVENT_KEYBOARD_DEACTIVATED = 2,
};

Values

KM_CORE_EVENT_KEYBOARD_ACTIVATED : A keyboard has been activated by the user. The processor may use this event, for example, to switch caps lock state or provide other UX.