XkbGetKeyboard(3) XKB FUNCTIONS XkbGetKeyboard(3)

# [NAME](#NAME)

XkbGetKeyboard - Retrieves one or more components of a keyboard device description

# [SYNOPSIS](#SYNOPSIS)

**XkbDescPtr XkbGetKeyboard** **(Display \*display,** **unsigned int which,** **unsigned int device\_spec);**

# [ARGUMENTS](#ARGUMENTS)

[*display*](#display)

connection to the X server

[*device\_spec*](#device_spec)

device ID, or XkbUseCoreKbd

[*bits\_to\_change*](#bits_to_change)

determines events to be selected / deselected

[*values\_for\_bits*](#values_for_bits)

1=&gt;select, 0-&gt;deselect; for events in bits\_to\_change

# [DESCRIPTION](#DESCRIPTION)

**XkbGetKeyboard** allocates and returns a pointer to a keyboard description. It queries the server for those components specified in the *which* parameter for device *device\_spec* and copies the results to the XkbDescRec it allocated. The remaining fields in the keyboard description are set to NULL. The valid masks for *which* are those listed in Table 1.

Table 1 Mask Bits for XkbDescRec Mask Bit XkbDescRec Field Value XkbControlsMask ctrls (1L&lt;&lt;0) XkbServerMapMask server (1L&lt;&lt;1) XkbIClientMapMask map (1L&lt;&lt;2) XkbIndicatorMapMask indicators (1L&lt;&lt;3) XkbNamesMask names (1L&lt;&lt;4) XkbCompatMapMask compat (1L&lt;&lt;5) XkbGeometryMask geom (1L&lt;&lt;6) XkbAllComponentsMask All Fields (1L&lt;&lt;7)

**XkbGetKeyboard** is used to read the current description for one or more components of a keyboard device. It calls [**XkbGetKeyboardByName**(3)](/man/os/libx11/XkbGetKeyboardByName.3) as follows:

*XkbGetKeyboardByName(dpy, device\_spec,* NULL, *which, which,* False).

If successful, **XkbGetKeyboard** returns a pointer to a newly allocated **XkbDescRec** structure, which is described in [**XkbGetKeyboardByName**(3)](/man/os/libx11/XkbGetKeyboardByName.3), and which should be freed with [**XkbFreeKeyboard**(3)](/man/os/libx11/XkbFreeKeyboard.3). If **XkbGetKeyboard** does not succeed, it returns **NULL**.

# [DIAGNOSTICS](#DIAGNOSTICS)

BadAlloc

Unable to allocate storage

# [SEE ALSO](#SEE_ALSO)

[**XkbGetKeyboardByName**(3)](/man/os/libx11/XkbGetKeyboardByName.3)

libX11 1.8.14 X Version 11

---

Document: XkbGetKeyboard(3) from libx11 1.8.14-r1 (Chainguard OS)
Source: https://gitlab.freedesktop.org/xorg/lib/libx11.git
