xkbcommon 1.14.0-beta2
Reference library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
Library Context

Data Structures

struct  xkb_context
 

Enumerations

enum  xkb_context_flags {
  XKB_CONTEXT_NO_FLAGS = 0 ,
  XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0) ,
  XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1) ,
  XKB_CONTEXT_NO_SECURE_GETENV = (1 << 2)
}
 

Functions

XKB_EXPORT struct xkb_context * xkb_context::xkb_context_new (enum xkb_context_flags flags)
 
XKB_EXPORT struct xkb_context * xkb_context::xkb_context_ref (struct xkb_context *context)
 
XKB_EXPORT void xkb_context::xkb_context_unref (struct xkb_context *context)
 
XKB_EXPORT void xkb_context::xkb_context_set_user_data (struct xkb_context *context, void *user_data)
 
XKB_EXPORT void * xkb_context::xkb_context_get_user_data (struct xkb_context *context)
 

Detailed Description

Creating, destroying and using library contexts.

Every keymap compilation request must have a context associated with it. The context keeps around state such as the include path.

Environment Variables

Enumeration Type Documentation

◆ xkb_context_flags

Flags for context creation.

Enumerator
XKB_CONTEXT_NO_FLAGS 

Do not apply any context flags.

XKB_CONTEXT_NO_DEFAULT_INCLUDES 

Create this context with an empty include path.

This may be useful e.g.:

  • to have full control over the included paths;
  • for clients that do not need to access the XKB directories, e.g. if only retrieving keymap from the Wayland or X server. It avoids potential issues with directory access permissions.
XKB_CONTEXT_NO_ENVIRONMENT_NAMES 

Don’t take RMLVO names from the environment.

Since
0.3.0
XKB_CONTEXT_NO_SECURE_GETENV 

Disable the use of secure_getenv for this context, so that privileged processes can use environment variables.

Client uses at their own risk.

Since
1.5.0

Function Documentation

◆ xkb_context_new()

XKB_EXPORT struct xkb_context * xkb_context_new ( enum xkb_context_flags  flags)

Create a new context.

Parameters
[in]flagsOptional flags for the context, or 0.
Returns
A new context, or NULL on failure.

◆ xkb_context_ref()

XKB_EXPORT struct xkb_context * xkb_context_ref ( struct xkb_context *  context)

Take a new reference on a context.

Parameters
[in]contextThe context object.
Returns
The passed in context.

◆ xkb_context_unref()

XKB_EXPORT void xkb_context_unref ( struct xkb_context *  context)

Release a reference on a context, and possibly free it.

Parameters
[in]contextThe context. If it is NULL, this function does nothing.

◆ xkb_context_set_user_data()

XKB_EXPORT void xkb_context_set_user_data ( struct xkb_context *  context,
void *  user_data 
)

Store custom user data in the context.

This may be useful in conjunction with xkb_context_set_log_fn() or other callbacks.

Parameters
[in,out]contextThe context object.
[in]user_dataUser data object. Borrowed: *context keeps a pointer to this parameter without taking ownership.

◆ xkb_context_get_user_data()

XKB_EXPORT void * xkb_context_get_user_data ( struct xkb_context *  context)

Retrieves stored user data from the context.

Parameters
[in]contextThe context object.
Returns
Borrowed stored user data. If the user data wasn’t set, or the passed-in context is NULL, returns NULL.

This may be useful to access private user data from callbacks like a custom logging function.