XkbKeyGroupWidth(3)
π XkbKeyGroupWidth β the libX11 era, bestie
okay so real talk, this one lives in the XKB FUNCTIONS section of the libX11 manual (X Version 11, if we're being specific π), and it's genuinely one of those little helper functions that does exactly one thing and does it iconically.
β¨ NAME β¨
XkbKeyGroupWidth β literally computes the width of the type associated with the group grp for the key corresponding to keycode. that's it. that's the whole job. slay. π
π¦ SYNOPSIS π¦
int XkbKeyGroupWidth (XkbDescPtr xkb, KeyCode keycode, int grp);
πΈ ARGUMENTS πΈ
xkbβ the Xkb description you care about. the main character of this whole operation.keycodeβ the keycode you're curious about. which key, bestie?grpβ the group you want. pick your group, babes.
π DESCRIPTION π
okay so here's the lore π§ β the key width and the number of groups associated with a key get used to form a small two-dimensional array of KeySyms for a key. and like, this array can be a different size for different keys. no cap. not every key gets the same real estate.
the array for a single key is stored as a linear list, in row-major order. the arrays for all the keys live in the syms field of the client map. so it's giving one big shared storage situation. π«Ά
there's one row for each group associated with a key, and one column for each level. and the index corresponding to a given group and shift level is computed like this:
idx = group_index * key_width + shift_level
and the offset field of the key_sym_map entry for a key is what you use to access the beginning of the array. iykyk. π₯
so then XkbKeyGroupWidth goes ahead and computes the width of the type associated with the group grp for the key corresponding to keycode. that's the whole vibe check, and it passes. β
lowkey important: thatidxformula isgroup_index * key_width + shift_levelβ copy it exactly, don't get creative with it, bestie π
π sign-off π
that's the page, bestie β shipped as part of libX11 1.8.14 under X Version 11, and yes, this was XkbKeyGroupWidth(3) the entire time π¦π
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- Copyright (c) 1999, Oracle and/or its affiliates
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms