XkbAllocKeyboard(3)

πŸŽ€ XkbAllocKeyboard(3) πŸŽ€

okay so this is from the XKB FUNCTIONS manual, and we’re about to talk about creating a keyboard description from scratch. slay. πŸ’…


✨ NAME ✨

XkbAllocKeyboard β€” creates a keyboard description from scratch 🫢


🌸 SYNOPSIS 🌸

XkbDescRec XkbAllocKeyboard (void);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay bestie, real talk: applications seldom need to directly allocate a keyboard description. calling XkbGetKeyboard usually suffices. like, that’s the main character move most of the time. πŸ‘‘

but in the event you actually need to create a keyboard description from scratch? use XkbAllocKeyboard rather than directly calling malloc. no cap, that’s the vibe. ✨

if XkbAllocKeyboard fails to allocate the keyboard description, it returns NULL. 😭 otherwise, it returns a pointer to an empty keyboard description structure. the device_spec field will have been initialized to XkbUseCoreKbd. πŸŽ€

then you may either fill in the structure components yourself, or use Xkb functions to obtain values for the structure components from a keyboard device. either way, you’re in control, periodt. πŸ’–


🌈 SEE ALSO 🌈

  • malloc(3F) β€” the direct allocation girly that you should probably avoid here πŸ‘€
  • XkbUseCoreKbd(3) β€” the initialized device_spec value, iconic πŸ’«
  • XkbGetKeyboard(3) β€” usually the one you actually want, fr fr πŸ”₯

signed, sealed, delivered by X Version 11 and libX11 1.8.14 β€” and yes bestie, the date is giving β€œnot on this page,” but the source/version energy is absolutely present πŸ’…βœ¨

πŸ“¦ where this page comes from