libxkbcommon 1.13.0
Library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
Loading...
Searching...
No Matches
Modules | Data Structures | Enumerations | Functions
Keymap Creation
Collaboration diagram for Keymap Creation:

Modules

 Keymap formats
 

Data Structures

struct  xkb_keymap
 

Enumerations

enum  xkb_keymap_compile_flags {
  XKB_KEYMAP_COMPILE_NO_FLAGS = 0 ,
  XKB_KEYMAP_COMPILE_STRICT_MODE = (1 << 0)
}
 

Functions

XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_rmlvo (const struct xkb_rmlvo_builder *rmlvo, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_names (struct xkb_context *context, const struct xkb_rule_names *names, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_names2 (struct xkb_context *context, const struct xkb_rule_names *names, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_file (struct xkb_context *context, FILE *file, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_string (struct xkb_context *context, const char *string, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_new_from_buffer (struct xkb_context *context, const char *buffer, size_t length, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
 
XKB_EXPORT struct xkb_keymapxkb_keymap::xkb_keymap_ref (struct xkb_keymap *keymap)
 
XKB_EXPORT void xkb_keymap::xkb_keymap_unref (struct xkb_keymap *keymap)
 

Detailed Description

Creating and destroying keymaps.

Enumeration Type Documentation

◆ xkb_keymap_compile_flags

Flags for keymap compilation.

Enumerator
XKB_KEYMAP_COMPILE_NO_FLAGS 

Do not apply any flags.

XKB_KEYMAP_COMPILE_STRICT_MODE 

Make the parser operate in strict mode.

This is useful mainly for debugging.

When this flag is set, the following will raise an error:

  • field type mismatch (e.g. a number instead of a string)
  • unknown global variable
  • unknown statement field
  • unknown declaration
  • unknown compound statement
  • unknown action/action parameter
  • invalid action parameter value
  • TODO
Since
1.14.0

Function Documentation

◆ xkb_keymap_new_from_rmlvo()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_rmlvo ( const struct xkb_rmlvo_builder rmlvo,
enum xkb_keymap_format  format,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from a RMLVO builder.

The primary keymap entry point: creates a new XKB keymap from a set of RMLVO (Rules + Model + Layouts + Variants + Options) names.

Parameters
[in]rmlvoThe RMLVO builder to use. See xkb_rmlvo_builder.
[in]formatThe text format of the keymap file to compile.
[in]flagsOptional flags for the keymap, or 0.
Returns
A keymap compiled according to the RMLVO names, or NULL if the compilation failed.
Since
1.11.0
1.14.0 Parser is lenient by default.
See also
xkb_keymap_new_from_names2()
xkb_rmlvo_builder

◆ xkb_keymap_new_from_names()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_names ( struct xkb_context context,
const struct xkb_rule_names names,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from RMLVO names.

Same as xkb_keymap_new_from_names2(), but with the keymap format fixed to: XKB_KEYMAP_FORMAT_TEXT_V2.

Deprecated:
Use xkb_keymap_new_from_names2() instead.
Since
1.11.0: Deprecated
1.11.0: Use internally XKB_KEYMAP_FORMAT_TEXT_V2 instead of XKB_KEYMAP_FORMAT_TEXT_V1
1.14.0 Parser is lenient by default.
See also
xkb_keymap_new_from_names2()
xkb_rule_names
xkb_keymap_new_from_rmlvo()

◆ xkb_keymap_new_from_names2()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_names2 ( struct xkb_context context,
const struct xkb_rule_names names,
enum xkb_keymap_format  format,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from RMLVO names.

The primary keymap entry point: creates a new XKB keymap from a set of RMLVO (Rules + Model + Layouts + Variants + Options) names.

Parameters
[in]contextThe context in which to create the keymap.
[in]namesThe RMLVO names to use. See xkb_rule_names.
[in]formatThe text format of the keymap file to compile.
[in]flagsOptional flags for the keymap, or 0.
Returns
A keymap compiled according to the RMLVO names, or NULL if the compilation failed.
Since
1.11.0
1.14.0 Parser is lenient by default.
See also
xkb_rule_names
xkb_keymap_new_from_rmlvo()

◆ xkb_keymap_new_from_file()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_file ( struct xkb_context context,
FILE *  file,
enum xkb_keymap_format  format,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from a keymap file.

Parameters
[in]contextThe context in which to create the keymap.
[in]fileThe keymap file to compile.
[in]formatThe text format of the keymap file to compile.
[in]flagsOptional flags for the keymap, or 0.
Returns
A keymap compiled from the given XKB keymap file, or NULL if the compilation failed.

The file must contain a complete keymap. For example, in the XKB_KEYMAP_FORMAT_TEXT_V1 format, this means the file must contain one top level xkb_keymap section, which in turn contains other required sections.

Since
1.14.0 Parser is lenient by default.

◆ xkb_keymap_new_from_string()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_string ( struct xkb_context context,
const char *  string,
enum xkb_keymap_format  format,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from a keymap string.

This is just like xkb_keymap_new_from_file(), but instead of a file, gets the keymap as one enormous string.

Returns
A keymap compiled from the given string, or NULL if the compilation failed.
Since
1.14.0 Parser is lenient by default.
See also
xkb_keymap_new_from_file()

◆ xkb_keymap_new_from_buffer()

XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_buffer ( struct xkb_context context,
const char *  buffer,
size_t  length,
enum xkb_keymap_format  format,
enum xkb_keymap_compile_flags  flags 
)

Create a keymap from a memory buffer.

This is just like xkb_keymap_new_from_string(), but takes a length argument so the input string does not have to be zero-terminated.

Returns
A keymap compiled from the given buffer, or NULL if the compilation failed.
Since
0.3.0
1.14.0 Parser is lenient by default.
See also
xkb_keymap_new_from_string()

◆ xkb_keymap_ref()

XKB_EXPORT struct xkb_keymap * xkb_keymap_ref ( struct xkb_keymap keymap)

Take a new reference on a keymap.

Returns
The passed in keymap.

◆ xkb_keymap_unref()

XKB_EXPORT void xkb_keymap_unref ( struct xkb_keymap keymap)

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

Parameters
[in]keymapThe keymap. If it is NULL, this function does nothing.