libxkbcommon: X11 support

libxkbcommon 0.4.3

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Macros | Enumerations | Functions
X11 support

Additional X11 support for xkbcommon. More...

## Macros
#define | XKB_X11_MIN_MAJOR_XKB_VERSION 1
| The minimal compatible major version of the XKB X11 extension which this library can use.
#define | XKB_X11_MIN_MINOR_XKB_VERSION 0
| The minimal compatible minor version of the XKB X11 extension which this library can use (for the minimal major version).

## Enumerations
enum | xkb_x11_setup_xkb_extension_flags { XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS = 0 }
| Flags for the xkb_x11_setup_xkb_extension() function. More...

## Functions
int | xkb_x11_setup_xkb_extension (xcb_connection_t *connection, uint16_t major_xkb_version, uint16_t minor_xkb_version, enum xkb_x11_setup_xkb_extension_flags flags, uint16_t *major_xkb_version_out, uint16_t *minor_xkb_version_out, uint8_t *base_event_out, uint8_t *base_error_out)
| Setup the XKB X11 extension for this X client. More...
int32_t | xkb_x11_get_core_keyboard_device_id (xcb_connection_t *connection)
| Get the keyboard device ID of the core X11 keyboard. More...
struct xkb_keymap * | xkb_keymap::xkb_x11_keymap_new_from_device (struct xkb_context *context, xcb_connection_t *connection, int32_t device_id, enum xkb_keymap_compile_flags flags)
| Create a keymap from an X11 keyboard device. More...
struct xkb_state * | xkb_state::xkb_x11_state_new_from_device (struct xkb_keymap *keymap, xcb_connection_t *connection, int32_t device_id)
| Create a new keyboard state object from an X11 keyboard device. More...

## Detailed Description

Additional X11 support for xkbcommon.

Since
  0.4.0

## Enumeration Type Documentation

enum xkb_x11_setup_xkb_extension_flags

Flags for the xkb_x11_setup_xkb_extension() function.

Enumerator
XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS | Do not apply any flags.

## Function Documentation

int xkb_x11_setup_xkb_extension | ( | xcb_connection_t * | connection,
|  | uint16_t | major_xkb_version,
|  | uint16_t | minor_xkb_version,
|  | enum xkb_x11_setup_xkb_extension_flags | flags,
|  | uint16_t * | major_xkb_version_out,
|  | uint16_t * | minor_xkb_version_out,
|  | uint8_t * | base_event_out,
|  | uint8_t * | base_error_out
| ) |  |

Setup the XKB X11 extension for this X client.

The xkbcommon-x11 library uses various XKB requests. Before doing so, an X client must notify the server that it will be using the extension. This function (or an XCB equivalent) must be called before any other function in this library is used.

Some X servers may not support or disable the XKB extension. If you want to support such servers, you need to use a different fallback.

You may call this function several times; it is idempotent.

Parameters

  | connection | An XCB connection to the X server.
  | major_xkb_version,minor_xkb_version | The XKB extension version to request. To operate correctly, you must have (major_xkb_version, minor_xkb_version) >= (XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION), though this is not enforced.
  | flags | Optional flags, or 0.
  [out] | major_xkb_version_out,minor_xkb_version_out | Backfilled with the compatible XKB extension version numbers picked by the server. Can be NULL.
  [out] | base_event_out | Backfilled with the XKB base (also known as first) event code, needed to distinguish XKB events. Can be NULL.
  [out] | base_error_out | Backfilled with the XKB base (also known as first) error code, needed to distinguish XKB errors. Can be NULL.

Returns
  1 on success, or 0 on failure.

int32_t xkb_x11_get_core_keyboard_device_id | ( | xcb_connection_t * | connection | ) |

Get the keyboard device ID of the core X11 keyboard.

Parameters

  connection | An XCB connection to the X server.

Returns
  A device ID which may be used with other xkb_x11_* functions, or -1 on failure.

struct xkb_keymap * xkb_x11_keymap_new_from_device | ( | struct xkb_context * | context,
|  | xcb_connection_t * | connection,
|  | int32_t | device_id,
|  | enum xkb_keymap_compile_flags | flags
| ) |  |

Create a keymap from an X11 keyboard device.

This function queries the X server with various requests, fetches the details of the active keymap on a keyboard device, and creates an xkb_keymap from these details.

Parameters

  context | The context in which to create the keymap.
  connection | An XCB connection to the X server.
  device_id | An XInput 1 device ID (in the range 0-255) with input class KEY. Passing values outside of this range is an error.
  flags | Optional flags for the keymap, or 0.

Returns
  A keymap retrieved from the X server, or NULL on failure.

struct xkb_state * xkb_x11_state_new_from_device | ( | struct xkb_keymap * | keymap,
|  | xcb_connection_t * | connection,
|  | int32_t | device_id
| ) |  |

Create a new keyboard state object from an X11 keyboard device.

This function is the same as xkb_state_new(), only pre-initialized with the state of the device at the time this function is called.

Parameters

  keymap | The keymap for which to create the state.
  connection | An XCB connection to the X server.
  device_id | An XInput 1 device ID (in the range 0-255) with input class KEY. Passing values outside of this range is an error.

Returns
  A new keyboard state object, or NULL on failure.