XkbAddGeomShape(3)
π XkbAddGeomShape(3) β from the XKB FUNCTIONS manual, bestie π
Okay so real talk, this one's called XkbAddGeomShape and it does exactly what it says on the tin: it adds a shape to a keyboard geometry. Iconic behavior, honestly. β¨
β¨ SYNOPSIS β¨
XkbShapePtr XkbAddGeomShape (XkbGeometryPtr geom, Atom name, int
sz_outlines);
Like, that's the whole call. Three args, one pointer back. Simple slay. π
πΈ ARGUMENTS πΈ
geomβ the geometry you're updating, i.e. the thing getting the glow-up πnameβ the name of the new shape. Yep, you gotta name it. It's giving naming your sim.sz_outlinesβ how many outlines you want reserved. Reserved, not created. Important distinction, no cap. π«Ά
π DESCRIPTION π
So the tea is: Xkb provides functions that 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 it, that's the vibe. β¨
β οΈ Heads up bestie: these functions do not change sz_* unless there's literally no more room in the array. So don't come for them when your size field looks stale. π
Some of these functions fill in the values of the element's structure from the arguments. For other functions, you have to explicitly write code yourself to fill the structure's elements. So like... read the room, check which one you're using. π
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 β it's giving "suggestion box, not a rulebook" π. No other geometry structures refer to geometry properties. Periodt.
A geometry contains an arbitrary number of shapes, each of which is made up of an arbitrary number of outlines. Very "arbitrary" of them, we love that for them. π¦
XkbAddGeomShape adds a shape to a geometry geom by allocating space for sz_outlines outlines for it and giving it the name specified by name. π
- If a shape with the name
namealready exists in the geometry β a pointer to the existing shape is returned. No duplicates, we're not doing that today. π XkbAddGeomShapereturnsNULLif any of the parameters is empty or if it was not able to allocate space. Sad but true. π
To allocate space for an arbitrary number of geometry shapes, use XkbAllocGeomShapes. That's the "buy in bulk" option. π
π§ STRUCTURES π§
typedef struct _XkbShape {
Atom name; /* shape's name */
unsigned short num_outlines; /* number of outlines for the shape */
unsigned short sz_outlines; /* size of the outlines array */
XkbOutlinePtr outlines; /* array of outlines for the shape */
XkbOutlinePtr approx; /* pointer into the array to the approximating outline */
XkbOutlinePtr primary; /* pointer into the array to the primary outline */
XkbBoundsRec bounds; /* bounding box for the shape; encompasses all outlines */
} XkbShapeRec, *XkbShapePtr;
Read the comments, they're literally right there and they ate. π₯ That bounds field? Bounding box for the shape, encompasses all outlines β main character energy fr fr. π
β SEE ALSO β
XkbAllocGeomShapes(3)β go look at this one too, bestie, it's the bulk allocator π«Ά
And that's the whole page, diva π β brought to you by X Version 11, libX11 1.8.14, dated right there in the footer alongside XkbAddGeomShape(3). Go forth and add shapes, you gorgeous Unix gremlin π§β¨
π¦ 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