XkbChangeNames(3)

πŸ’– NAME πŸ’–

Okay bestie, buckle up: this is XkbChangeNames(3) from the XKB FUNCTIONS manual, and it is literally about changing symbolic names in the server.

XkbChangeNames β€” Change symbolic names in the server ✨


✨ SYNOPSIS ✨

Bool XkbChangeNames (Display *dpy, unsigned int which, XkbDescPtr xkb);

πŸŽ€ ARGUMENTS πŸŽ€

  • dpy β€” connection to the X server, aka the server bestie you're talking to.
  • which β€” mask of names or map components to be updated.
  • xkb β€” keyboard description to be updated.

🌸 DESCRIPTION 🌸

So XkbChangeNames is the more flexible glow-up for changing symbolic names than XkbSetNames, and it requires the use of an XkbNameChangesRec structure. No cap.

XkbChangeNames copies any names specified by changes from the keyboard description, xkb, to the X server specified by dpy. It aborts and returns False if any illegal type names or type shift level names are specified by changes. Like, it is not going to let invalid name vibes slide. πŸ’…

To change the symbolic names in the server, first modify a local copy of the keyboard description and then use either XkbSetNames, or, to save network traffic, use an XkbNameChangesRec structure and call XkbChangeNames to download the changes to the server. XkbSetNames and XkbChangeNames can generate BadAlloc, BadAtom, BadLength, BadMatch, and BadImplementation errors.

This is the "send only the diff, bestie" option. It is giving efficient network traffic, and we respect that.

πŸ¦‹ STRUCTURES πŸ¦‹

The XkbNameChangesRec allows applications to identify small modifications to the symbolic names and effectively reduces the amount of traffic sent to the server:

typedef struct _XkbNameChanges {
    unsigned int   changed;            /* name components that have changed */
    unsigned char  first_type;         /* first key type with a new name */
    unsigned char  num_types;          /* number of types with new names */
    unsigned char  first_lvl;          /* first key type with new level names */
    unsigned char  num_lvls;           /* number of key types with new level names */
    unsigned char  num_aliases;        /* if key aliases changed, total number of key aliases */
    unsigned char  num_rg;             /* if radio groups changed, total number of radio groups */
    unsigned char  first_key;          /* first key with a new name */
    unsigned char  num_keys;           /* number of keys with new names */
    unsigned short changed_vmods;      /* mask of virtual modifiers for which names have changed */
    unsigned long  changed_indicators; /* mask of indicators for which names were changed */
    unsigned char  changed_groups;     /* mask of groups for which names were changed */
} XkbNameChangesRec, *XkbNameChangesPtr

The changed field specifies the name components that have changed and is the bitwise inclusive OR of the valid names mask bits defined in Table 1. The rest of the fields in the structure specify the ranges that have changed for the various kinds of symbolic names, as shown in Table 2.

Xkb provides several functions that work with symbolic names. Each of these functions uses a mask to specify individual fields of the structures described above. These masks and their relationships to the fields in a keyboard description are shown in Table 1.

πŸ‘‘ Table 1 Symbolic Names Masks πŸ‘‘

Columns: Mask Bit, Value, Keyboard Component, Field.

  • XkbKeycodesNameMask β€” (1<<0) β€” Xkb->names β€” keycodes
  • XkbGeometryNameMask β€” (1<<1) β€” Xkb->names β€” geometry
  • XkbSymbolsNameMask β€” (1<<2) β€” Xkb->names β€” symbols
  • XkbPhysSymbolsNameMask β€” (1<<3) β€” Xkb->names β€” phys_symbols
  • XkbTypesNameMask β€” (1<<4) β€” Xkb->names β€” type
  • XkbCompatNameMask β€” (1<<5) β€” Xkb->names β€” compat
  • XkbKeyTypeNamesMask β€” (1<<6) β€” Xkb->map β€” type[*].name
  • XkbKTLevelNamesMask β€” (1<<7) β€” Xkb->map β€” type[*].lvl_names[*]
  • XkbIndicatorNamesMask β€” (1<<8) β€” Xkb->names β€” indicators[*]
  • XkbKeyNamesMask β€” (1<<9) β€” Xkb->names β€” keys[*], num_keys
  • XkbKeyAliasesMask β€” (1<<10) β€” Xkb->names β€” key_aliases[*], num_key_aliases
  • XkbVirtualModNamesMask β€” (1<<11) β€” Xkb->names β€” vmods[*]
  • XkbGroupNamesMask β€” (1<<12) β€” Xkb->names β€” groups[*]
  • XkbRGNamesMask β€” (1<<13) β€” Xkb->names β€” radio_groups[*], num_rg
  • XkbComponentNamesMask β€” (0x3f) β€” Xkb->names β€” keycodes, geometry, symbols, physical symbols, types, and compatibility map
  • XkbAllNamesMask β€” (0x3fff) β€” Xkb->names β€” all name components

⭐ Table 2 XkbNameChanges Fields ⭐

Columns: Mask, Fields, Component, Field.

  • XkbKeyTypeNamesMask β€” first_type, num_types β€” Xkb->map β€” type[*].name
  • XkbKTLevelNamesMask β€” first_lvl, num_lvls β€” Xkb->map β€” type[*].lvl_names[*]
  • XkbKeyAliasesMask β€” num_aliases β€” Xkb->names β€” key_aliases[*]
  • XkbRGNamesMask β€” num_rg β€” Xkb->names β€” radio_groups[*]
  • XkbKeyNamesMask β€” first_key, num_keys β€” Xkb->names β€” keys[*]
  • XkbVirtualModNamesMask β€” changed_vmods β€” Xkb->names β€” vmods[*]
  • XkbIndicatorNamesMask β€” changed_indicators β€” Xkb->names β€” indicators[*]
  • XkbGroupNamesMask β€” changed_groups β€” Xkb->names β€” groups[*]

πŸ’€ DIAGNOSTICS πŸ’€

  • BadAlloc β€” Unable to allocate storage.
  • BadAtom β€” A name is neither a valid Atom or None.
  • BadImplementation β€” Invalid reply from server.
  • BadLength β€” The length of a request is shorter or longer than that required to minimally contain the arguments.
  • BadMatch β€” A compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise invalid.

🫢 SEE ALSO 🫢


Mwah πŸ’‹ and that's the whole page, bestie. Footer sign-off: this is X Version 11, libX11 1.8.14, page XkbChangeNames(3). Slay. πŸŽ€

πŸ“¦ where this page comes from