XkbKeySymEntry(3)

πŸ’… XkbKeySymEntry β€” the manual page, but make it make sense

okay so real talk bestie, this is a page from the XKB FUNCTIONS corner of the X world, and it's genuinely not that deep. it's one function, four arguments, and one very important formula. stay with me 🫢


🌸 NAME 🌸

XkbKeySymEntry β€” literally just goes "hey, what keysym lives at this shift level and this group for this keycode" and returns it. that's the whole gig. it's pulling a value out of the two-dimensional array of keysyms for the key corresponding to keycode. iconic behavior, no notes ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

KeySym XkbKeySymEntry (XkbDescPtr xkb, KeyCode keycode, int shift, int grp);

πŸŽ€ ARGUMENTS πŸŽ€

  • xkb β€” the Xkb description you care about. this is your whole vibe check context, everything lives in here πŸ’–
  • keycode β€” the keycode of interest. yes. the key you're curious about. that one 🫢
  • shift β€” the shift level of interest, bestie. which level we're looking at πŸ”₯
  • grp β€” the group of interest. groups are a thing, we respect them πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜•. every key has a key width and a number of groups, and those two things get used to form a small two-dimensional array of KeySyms for that key. and the cute part? this array can be a different size for different keys. no cap. they're not all the same, and that's fine, that's the design.

the array for a single key is stored as a linear list, in row-major order β€” so it's a 2D vibe living in a 1D body, iykyk 😭.

the arrays for all of the keys are stored in the syms field of the client map. and the layout is:

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

so if you ever need the index for a given group and shift level, you compute it like this:

idx = group_index * key_width + shift_level

slay. that's it. that's the math 🧚

and to actually find where a key's array starts? you use the offset field of the key_sym_map entry for that key β€” that's what points you at the beginning of the array. think of it as the little map pin πŸ“

lastly, the function itself: XkbKeySymEntry returns the keysym corresponding to shift level shift and group grp from the two-dimensional array of keysyms for the key corresponding to keycode. literally exactly what the NAME section said. consistency queen πŸ’…

no error codes, no exit statuses, no environment variables on this page β€” it's a clean little getter and we love that for it 🌈

⭐ a very cute sign-off ⭐

this page came to you courtesy of X Version 11 and libX11 1.8.14, and yeah, it's XkbKeySymEntry(3) β€” the one, the only, the main character of this manpage πŸŽ€πŸ’– go forth and index responsibly, bestie πŸ¦‹

πŸ“¦ where this page comes from