XkbKeySymsOffset(3)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian bookworm

πŸ’– XkbKeySymsOffset πŸ’–

okay so bestie, we're in the XKB FUNCTIONS section of the libX11 manual (yes the whole X Version 11 situation, we'll get to that) and today's main character is XkbKeySymsOffset β€” she's a little function with one job and she does it flawlessly, no cap. ✨


🌸 NAME 🌸

XkbKeySymsOffset β€” returns the offset of the two-dimensional array of keysyms for the key corresponding to keycode. that's it, that's her whole personality, and honestly? iconic. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

int XkbKeySymsOffset (XkbDescPtr xkb, KeyCode keycode);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • xkb β€” the Xkb description you're curious about. your girl, your subject of interest, the one you're staring at. πŸ’…
  • keycode β€” the keycode of interest. the specific key we're doing a vibe check on. πŸ”

✨ DESCRIPTION ✨

okay so listen. every key has a key width and a number of groups, right? and those two things team up to build a tiny little two-dimensional array of KeySyms just for that key. it's giving custom-made, bespoke, made-to-measure. 🧚

and here's the tea: this array can be a different size for different keys. no uniformity, no matching sets, every key gets to be its own unique little creature. 🌈

now β€” the array for a single key isn't stored as a cute 2D grid, bestie. it's stored as a linear list, in row-major order. so it's all flattened out, one long line, but the logic is still 2D in spirit. the arrays for all of the keys live together in the syms field of the client map. one big happy family. 🫢

the shape of it:

  • one row for each group associated with a key
  • one column for each level

and if you wanna know the index that corresponds to a given group and shift level, you compute it like this, exactly like this:

idx = group_index * key_width + shift_level

the offset field of the key_sym_map entry for a key is what you use to access the beginning of the array. it's the doorway, the entry point, the front gate. πŸšͺ✨

and finally, the moment you've all been waiting for: XkbKeySymsOffset returns the offset of the two-dimensional array of keysyms for the key corresponding to keycode. that's the whole serve. she ate. πŸ’…


⚠️ real talk: that idx formula is doing math with group_index, key_width and shift_level, so keep those values exactly as they are β€” no improvising, no freestyling, this is not a collab. πŸ™ˆ

πŸ’œ a lil sign-off πŸ’œ

so that's the page, bestie β€” this one comes to you from X Version 11, libX11 1.8.4, filed under XkbKeySymsOffset(3). go forth and find your offsets. slay, stay hydrated, and remember: row-major order never betrayed anyone. πŸ’–πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from