XkbAddGeomKey(3)

✨ XkbAddGeomKey β€” adding one lil key to the end of a row πŸ’…

Okay bestie, welcome to the XKB FUNCTIONS corner of the libX11 manual, page XkbAddGeomKey(3). This is the one where we slide a single new key onto the end of an existing row of keys. Tiny function, very specific job. Let's get into it πŸŽ€


🌸 NAME 🌸

XkbAddGeomKey β€” add one key at the end of an existing row of keys. That's it, that's the whole vibe ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

XkbKeyPtr XkbAddGeomKey (XkbRowPtr row);

πŸ’– ARGUMENTS πŸ’–

  • row β€” the row that's getting updated. This is the row we're appending to, so like... it needs to actually exist, y'know? πŸ‘‘

🌈 DESCRIPTION 🌈

So here's the lore, bestie πŸ“– Xkb provides functions to add a single new element to the top-level keyboard geometry. In each case the num_* fields of the corresponding structure get incremented by 1. These functions do not change sz_* unless there's literally no more room left in the array. Some of these functions fill in the values of the element's structure straight from the arguments β€” but for other functions, you have to explicitly write code yourself to fill in the structure's elements. No hand-holding, you're the main character here πŸ’…

The top-level geometry description includes a list of geometry properties. A geometry property associates an arbitrary string with an equally arbitrary name. Programs that display images of keyboards can use geometry properties as hints, but they are not interpreted by Xkb. And no other geometry structures refer to geometry properties. Periodt. πŸ”₯

Now for the part you actually came here for: keys are grouped into rows 🌸 XkbAddGeomKey adds one key to the end of the specified row. The key is allocated and zeroed. And XkbAddGeomKey returns NULL if row is empty or if it was not able to allocate space for the key 😭

Heads up bestie 🚨 if you need to allocate space for an arbitrary number of keys to a row, use XkbAllocGeomKeys β€” not this one. This one adds exactly one key, no more no less, iykyk.

🧚 STRUCTURES 🧚

typedef struct _XkbKey {              /* key in a row */
    XkbKeyNameRec   name;             /* key name */
    short           gap;              /* gap in mm/10 from previous key in row */
    unsigned char   shape_ndx;        /* index of shape for key */
    unsigned char   color_ndx;        /* index of color for key body */
} XkbKeyRec, *XkbKeyPtr;

Look at her. Iconic struct. The name is the key name, gap is the gap in mm/10 from the previous key in the row, shape_ndx is the index of the shape for the key, and color_ndx is the index of the color for the key body 🎨 Obsessed with how organized this is, ngl.


πŸ‘‘ SEE ALSO πŸ‘‘

  • XkbAllocGeomKeys(3) β€” the one you want when you need space for, like, a lot of keys 🫢

That's the whole page, bestie! πŸ’–βœ¨ This cutie came to you from X Version 11, libX11 1.8.14, dated right there in the footer β€” go forth and add exactly one key at a time, no cap πŸŒΈπŸ¦‹πŸ’œ

πŸ“¦ where this page comes from