XkbAddGeomOverlayRow(3)

✨ XkbAddGeomOverlayRow β€” bestie edition ✨

okay so this is a page from the XKB FUNCTIONS manual (yes, the X11 keyboard geometry girlies) and honestly? it's a little niche but we're gonna slay it together πŸ’…


🌸 NAME 🌸

XkbAddGeomOverlayRow β€” adds a row to an existing overlay, that's literally the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

XkbOverlayRowPtr XkbAddGeomOverlayRow (XkbOverlayPtr overlay, XkbRowPtr
       row_under, int sz_keys);

like look at that signature. the way that it returns an XkbOverlayRowPtr. iconic.


πŸ’œ ARGUMENTS πŸ’œ

  • overlay β€” the overlay you're updating. it's the main character here, we're adding to it 🫢
  • row_under β€” the row that's getting overlaid in the section overlay overlays. iykyk.
  • sz_keys β€” how many keys you want reserved in the row. make it a number bestie, not a vibe.

🌈 DESCRIPTION 🌈

so here's the lore: Xkb gives you 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 ✨ that's the rule.

⚠️ important: these functions do not change sz_* unless there is no more room in the array. no cap.

some of these functions fill in the values of the element's structure straight from the arguments. for other functions? you gotta explicitly write code to fill the structure's elements yourself. lowkey annoying but we move πŸ’€

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. πŸ‘‘

okay, now the actual function:

XkbAddGeomOverlayRow adds one row to the overlay. the new row contains space for sz_keys keys.

😭 if row_under specifies a row that doesn't exist on the underlying section, XkbAddGeomOverlayRow returns NULL and doesn't change the overlay. it also returns NULL if any of the parameters is empty or if it was not able to allocate space for the overlay. so like… check your returns, bestie. please. πŸ™ˆ

🧚 STRUCTURES 🧚

typedef struct _XkbOverlayRow {
    unsigned short      row_under;    /* index into the row under this overlay row */
    unsigned short      num_keys;     /* number of keys in the keys array */
    unsigned short      sz_keys;      /* size of the keys array */
    XkbOverlayKeyPtr    keys;         /* array of keys in the overlay row */
} XkbOverlayRowRec,*XkbOverlayRowPtr;

four fields, all accounted for, all comments copied exactly, we don't skip the boring parts in this house πŸ“ the keys pointer? XkbOverlayKeyPtr. ate. πŸ”₯


πŸ’€ reminder that these are raw unsigned shorts and pointers, so if you're hand-filling keys yourself, that's on you β€” the manpage literally said some functions don't do it for you. just saying.

and that's the whole page, diva πŸ’– this beauty came to you courtesy of X Version 11 / libX11 1.8.14 β€” go forth and overlay those rows, and remember: NULL means no change, so don't come for the overlay when it didn't update. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from