XkbQueryExtension(3)

✨ XkbQueryExtension(3) ✨

okay so bestie, this one is from the XKB FUNCTIONS section of the manual and it's literally your vibe check for the X Keyboard Extension πŸ”₯ like it's the thing you call to find out if the server even has a compatible Xkb and then it sets it up for you. icon behavior.


πŸ’– NAME πŸ’–

XkbQueryExtension β€” determines the compatibility of a library at runtime 🫢


🌸 SYNOPSIS 🌸

Bool XkbQueryExtension (Display *dpy, int *opcode_rtrn, int *event_rtrn,
       int *error_rtrn, int *major_in_out, int *minor_in_out);

πŸŽ€ ARGUMENTS πŸŽ€

  • dpy β€” your connection to the X server, the whole group chat basically
  • opcode_rtrn β€” gets backfilled with the major extension opcode
  • event_rtrn β€” gets backfilled with the extension base event code
  • error_rtrn β€” gets backfilled with the extension base error code
  • major_in_out β€” you put in the compile time lib major version, server major version comes out πŸ‘‘
  • minor_in_out β€” compile time lib min version in, server minor version out ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

Call XkbQueryExtension to check whether the extension is present and compatible in the server, and to initialize the extension. this is the main character call πŸ’…

and like, because version mismatches are a whole thing? you literally cannot use the generic extension mechanism functions (XQueryExtension and XInitExtension) for checking for the presence of, and initializing the Xkb extension. no cap, they're not it for this. πŸ™ˆ

the rule, bestie: you must call XkbQueryExtension or XkbOpenDisplay before using any other Xkb library interfaces β€” unless such usage is explicitly allowed in the interface description in this document. periodt.

the exceptions are: XkbIgnoreExtension, XkbLibraryVersion, and a handful of audible-bell functions πŸ””. and you should not use any other Xkb functions if the extension is not present or is uninitialized. in general, calls to Xkb library functions made prior to initializing the Xkb extension cause BadAccess protocol errors 😭 so like, don't do that.

so what does it actually do? XkbQueryExtension both determines whether a compatible Xkb extension is present in the X server and initializes the extension when it is present. two for one, slay. 🫢

specifically: the XkbQueryExtension function determines whether a compatible version of the X Keyboard Extension is present in the server. if a compatible extension is present, XkbQueryExtension returns True; otherwise, it returns False.

if a compatible version of Xkb is present, XkbQueryExtension initializes the extension. it backfills:

  • the major opcode for the keyboard extension in opcode_rtrn
  • the base event code in event_rtrn
  • the base error code in error_rtrn
  • the major and minor version numbers of the extension in major_in_out and minor_in_out

the major opcode is reported in the req_major fields of some Xkb events 🎯 for a discussion of the base event code.


🌈 RETURN VALUES 🌈

  • True β€” the XkbQueryExtension function returns True if it determines a compatible version of the X Keyboard Extension is present in the server πŸ’–
  • False β€” the XkbQueryExtension function returns False if it determines a compatible version of the X Keyboard Extension is not present in the server πŸ’€

πŸ“ SEE ALSO πŸ“


and that's the whole vibe check bestie, go forth and initialize πŸ’œ

this page is from X Version 11, libX11 1.8.14 β€” mwah, kisses from the XKB FUNCTIONS section πŸŽ€βœ¨

πŸ“¦ where this page comes from