|
xkbcommon 1.14.0-beta2
Reference library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
|
Data Structures | |
| struct | xkb_event_components |
| struct | xkb_event_pointer_motion |
| struct | xkb_event_pointer_button |
| struct | xkb_events_config |
| struct | xkb_event |
| struct | xkb_events |
Enumerations | |
| enum | xkb_event_type { XKB_EVENT_TYPE_INVALID = 0 , XKB_EVENT_TYPE_FRAME , XKB_EVENT_TYPE_KEY , XKB_EVENT_TYPE_STATE_COMPONENTS , XKB_EVENT_TYPE_POINTER_MOTION , XKB_EVENT_TYPE_POINTER_BUTTON , XKB_EVENT_TYPE_TERMINATE_DISPLAY_SERVER , XKB_EVENT_TYPE_SWITCH_VIRTUAL_CONSOLE } |
| enum | xkb_pointer_motion_flags { XKB_POINTER_MOTION_NO_FLAGS = 0 , XKB_POINTER_MOTION_REPEATS = (1 << 0) , XKB_POINTER_MOTION_ABSOLUTE_X = (1 << 1) , XKB_POINTER_MOTION_ABSOLUTE_Y = (1 << 2) } |
| enum | xkb_pointer_button_state { XKB_POINTER_BUTTON_RELEASED , XKB_POINTER_BUTTON_PRESSED } |
| enum | xkb_events_flags { XKB_EVENTS_NO_FLAGS = 0 } |
Events and frames produced by the XKB state machine.
Keyboard events are the outputs of the state machine: they describe every observable change resulting from processing a raw key event or a synthetic update.
Events are produced by an xkb_machine via its process_* functions and collected into an xkb_events batch. The batch is a flat sequence of xkb_event entries, consumed sequentially with xkb_events::xkb_events_next().
Event pipeline
Two levels of atomicity apply:
XKB_EVENT_TYPE_FRAME boundaries is applied as a whole. Querying the keyboard state within a frame is not guaranteed to be consistent with the events delivered so far; only the state after the complete frame is. A frame is thus the commit point of the event pipeline. process_* call produces zero or more complete frames; a batch never ends mid-frame. A key event may produce no frame at all for some configurations.XKB_EVENT_TYPE_FRAME event; the first frame of a batch begins at its start.process_* call.wl_pointer::frame and the upcoming wl_keyboard::frame request, so that a Wayland compositor may forward event grouping without reinterpretation.struct xkb_machine: the event producer. xkb_events::xkb_events_new(), xkb_events::xkb_events_next(): the event collection. struct xkb_event: the atomic record. enum xkb_event_type | enum xkb_event_type |
Denotes the type of a state event.
xkb_event::xkb_event_get_type()| Enumerator | |
|---|---|
| XKB_EVENT_TYPE_INVALID | Invalid event. This is not a real event type but an error indicator.
|
| XKB_EVENT_TYPE_FRAME | Frame boundary. This is not a real event type but an indicator for the consumer (a server) to commit current transaction.
|
| XKB_EVENT_TYPE_KEY | Key event
|
| XKB_EVENT_TYPE_STATE_COMPONENTS | State components change event
|
| XKB_EVENT_TYPE_POINTER_MOTION | Pointer motion event
|
| XKB_EVENT_TYPE_POINTER_BUTTON | Pointer button event
|
| XKB_EVENT_TYPE_TERMINATE_DISPLAY_SERVER | **_Terminate_ display server** event This event is only generated by a state machine if it was created with
|
| XKB_EVENT_TYPE_SWITCH_VIRTUAL_CONSOLE | Switch virtual console event This event is only generated by a state machine if it was created with
|
Pointer motion flags for xkb_event_pointer_motion.
| Enumerator | |
|---|---|
| XKB_POINTER_MOTION_NO_FLAGS | Do not apply any flags; the corresponding pointer motion:
|
| XKB_POINTER_MOTION_REPEATS | The pointer motion repeats.
|
| XKB_POINTER_MOTION_ABSOLUTE_X | The x coordinate is absolute.
|
| XKB_POINTER_MOTION_ABSOLUTE_Y | The y coordinate is absolute.
|
Specifies the state of a button (pressed/released).
struct xkb_event_pointer_button| Enumerator | |
|---|---|
| XKB_POINTER_BUTTON_RELEASED | The pointer button was released.
|
| XKB_POINTER_BUTTON_PRESSED | The pointer button was pressed.
|
| enum xkb_events_flags |
Flags for xkb_events_config::flags.
xkb_events::xkb_events_new().| Enumerator | |
|---|---|
| XKB_EVENTS_NO_FLAGS | Do not apply any flags: the corresponding event collection will behave as a batch of events.
|
| XKB_EXPORT enum xkb_event_type xkb_event_get_type | ( | const struct xkb_event * | event | ) |
Get the type of an event.
| [in] | event | The event to process. |
XKB_EVENT_TYPE_INVALID.| XKB_EXPORT enum xkb_status xkb_event_get_keycode | ( | const struct xkb_event * | event, |
| xkb_keycode_t * | keycode, | ||
| enum xkb_key_direction * | direction | ||
| ) |
Get the keycode and direction associated to a state event of type XKB_EVENT_TYPE_KEY.
| [in] | event | The event object to process. |
| [out] | keycode | A pointer to store the keycode of the key event. |
| [out] | direction | A pointer to store the direction of the key event. |
XKB_EVENT_TYPE_KEY. Otherwise keycode and direction are not updated.XKB_SUCCESS on success, otherwise an error code:XKB_ERROR_EVENT_TYPE_MISMATCH if the event type is incorrect.| XKB_EXPORT enum xkb_status xkb_event_get_components | ( | const struct xkb_event * | event, |
| struct xkb_event_components * | components | ||
| ) |
Serialization of the state components corresponding to a state event of type XKB_EVENT_TYPE_STATE_COMPONENTS.
| [in] | event | The event object to process. |
| [in,out] | components | A pointer to an event components object to update with the event. |
XKB_EVENT_TYPE_STATE_COMPONENTS. Otherwise components is not updated.components must point to a zero-initialized struct with `components->size` set per Extensible structure ABI contract.components that fall within `components->size`.XKB_SUCCESS on success, otherwise an error code:XKB_ERROR_EVENT_TYPE_MISMATCH if the event type is incorrect.XKB_EVENT_TYPE_STATE_COMPONENTS struct xkb_event_components| XKB_EXPORT enum xkb_status xkb_event_get_pointer_motion | ( | const struct xkb_event * | event, |
| struct xkb_event_pointer_motion * | motion | ||
| ) |
Get the pointer motion corresponding to a state event of type XKB_EVENT_TYPE_POINTER_MOTION.
| [in] | event | The event object to process. |
| [in,out] | motion | A pointer to a pointer motion object to update with the event. |
XKB_EVENT_TYPE_POINTER_MOTION. Otherwise motion is not updated.motion must point to a zero-initialized struct with `motion->size` set per Extensible structure ABI contract.motion that fall within `motion->size`.XKB_SUCCESS on success, otherwise an error code:XKB_ERROR_EVENT_TYPE_MISMATCH if the event type is incorrect.XKB_EVENT_TYPE_POINTER_MOTION struct xkb_event_pointer_motion| XKB_EXPORT enum xkb_status xkb_event_get_pointer_button | ( | const struct xkb_event * | event, |
| struct xkb_event_pointer_button * | button | ||
| ) |
Get the pointer button corresponding to a state event of type XKB_EVENT_TYPE_POINTER_BUTTON.
| [in] | event | The event object to process. |
| [in,out] | button | A pointer to a pointer button object to update with the event. |
XKB_EVENT_TYPE_POINTER_BUTTON. Otherwise button is not updated.button must point to a zero-initialized struct with `button->size` set per Extensible structure ABI contract.button that fall within `button->size`.XKB_SUCCESS on success, otherwise an error code:XKB_ERROR_EVENT_TYPE_MISMATCH if the event type is incorrect.XKB_EVENT_TYPE_POINTER_BUTTON. struct xkb_event_pointer_button| XKB_EXPORT enum xkb_status xkb_event_get_virtual_console | ( | const struct xkb_event * | event, |
| int8_t * | index_or_offset, | ||
| bool * | is_offset | ||
| ) |
Get the virtual console index or offset associated to a state event of type XKB_EVENT_TYPE_SWITCH_VIRTUAL_CONSOLE.
| [in] | event | The event object to process. |
| [out] | index_or_offset | A pointer to store the absolute or relative virtual console target. |
| [out] | is_offset | A pointer to store whether index_or_offset is an index (false) or an offset (true). |
XKB_EVENT_TYPE_SWITCH_VIRTUAL_CONSOLE. Otherwise index_or_offset and is_offset are not updated.XKB_SUCCESS on success, otherwise an error code:XKB_ERROR_EVENT_TYPE_MISMATCH if the event type is incorrect.| XKB_EXPORT struct xkb_events * xkb_events_new | ( | struct xkb_context * | context, |
| const struct xkb_events_config * | config, | ||
| enum xkb_status * | status | ||
| ) |
Create a new event collection object.
| [in] | context | The context in which to create the object. Shared ownership: the returned xkb_events takes a new reference on this parameter. |
| [in] | config | Configuration to control the collection behavior, or NULL for the defaults: an xkb_events_config struct with size set per Extensible structure ABI contract and all other fields zeroed. |
| [out] | status | Pointer to store the resulting status code, or NULL if not needed. |
config must point to a zero-initialized struct with `config->size` set per Extensible structure ABI contract.NULL on failure. The caller owns the returned object and must release it with xkb_events_destroy().status is not NULL, *status is set to XKB_SUCCESS on success or to an error code corresponding to the failure. Possible errors are:
struct xkb_events_config xkb_events_destroy() xkb_events_next() xkb_machine::xkb_machine_process_key()| XKB_EXPORT void xkb_events_destroy | ( | struct xkb_events * | events | ) |
Free an event collection object.
| [in] | events | The event collection object. If it is NULL, this function does nothing. |
xkb_events_new()