XkbOpenDisplay(3)

okay so bestie, welcome to XkbOpenDisplay(3) from the XKB FUNCTIONS manual β€” section 3, we been knew πŸ’…. this one is literally a convenience function doing three whole things at once, so grab a strawberry πŸ“ and let's get into it.

✨ NAME ✨

XkbOpenDisplay β€” checks for a compatible version of the Xkb extension in both the library and the server, and initializes the extension for use. yes, she does all that πŸ’–.

πŸ¦‹ SYNOPSIS πŸ¦‹

Display *XkbOpenDisplay (_Xconst char *display_name, int *event_rtrn,
       int *error_rtrn, int *major_in_out, int *minor_in_out, int
       *reason_rtrn);

πŸŽ€ ARGUMENTS πŸŽ€

  • display_name β€” the hardware display name, which determines the display and communications domain to be used. it's giving β€œwhere am I connecting and who am I talking to” energy 🌸.
  • event_rtrn β€” gets backfilled with the extension base event code. cute little output slot ✨.
  • error_rtrn β€” gets backfilled with the extension base error code. also an output slot, but make it error-core πŸ’€.
  • major_in_out β€” compile time lib major version in, server major version out. she's a two-way street 🫢.
  • minor_in_out β€” compile time lib min version in, server minor version out. same deal, smaller number, still iconic πŸŽ€.
  • reason_rtrn β€” gets backfilled with a status code. this is the β€œwhat happened, bestie?” report πŸ’….

πŸ’– DESCRIPTION πŸ’–

as a convenience, you can use the function XkbOpenDisplay to perform these three tasks at once: open a connection to an X server, check for a compatible version of the Xkb extension in both the library and the server, and initialize the extension for use. three tasks, one function, main character energy πŸ‘‘.

XkbOpenDisplay is a convenience function that opens an X display connection and initializes the X keyboard extension. in all cases, upon return reason_rtrn contains a status value indicating success or the type of failure. no cap, she always tells you what's up 🌈.

if major_in_out and minor_in_out are not NULL, XkbOpenDisplay first calls XkbLibraryVersion to determine whether the client library is compatible, passing it the values pointed to by major_in_out and minor_in_out. if the library is incompatible, XkbOpenDisplay backfills major_in_out and minor_in_out with the major and minor extension versions of the library being used and returns NULL. okay so that's the vibe check failing at the library stage πŸ’€.

if the library is compatible, XkbOpenDisplay next calls XOpenDisplay with the display_name. if this fails, the function returns NULL. connection refused? not today, bestie 😭.

if successful, XkbOpenDisplay calls XkbQueryExtension and backfills the major and minor Xkb server extension version numbers in major_in_out and minor_in_out. if the server extension version is not compatible with the library extension version or if the server extension is not present, XkbOpenDisplay closes the display and returns NULL. when successful, the function returns the display connection. slay πŸ’…βœ¨.

the possible values for reason_rtrn are:

  • XkbOD_BadLibraryVersion indicates XkbLibraryVersion returned False. library said no πŸ’€.
  • XkbOD_ConnectionRefused indicates the display could not be opened. the connection is not connecting πŸ™ˆ.
  • XkbOD_BadServerVersion indicates the library and the server have incompatible extension versions. they're not matching each other's freak 😭.
  • XkbOD_NonXkbServer indicates the extension is not present in the X server. no Xkb in this server, bestie 🫠.
  • XkbOD_Success indicates that the function succeeded. ate and left no crumbs πŸ‘‘πŸ”₯.

🌸 RETURN VALUES 🌸

  • NULL β€” the XkbOpenDisplay function returns NULL if the library is incompatible. it also returns NULL if the call to XOpenDisplay with the display_name fails. and it returns NULL and closes the display if the server extension version is not compatible with the library extension version or if the server extension is not present. three ways to catch a NULL, all valid πŸ’€πŸ’–.

⭐ DIAGNOSTICS ⭐

  • BadAccess β€” the Xkb extension has not been properly initialized. bestie, she is not ready yet 🚨.

πŸ¦‹ SEE ALSO πŸ¦‹

XkbLibraryVersion(3), XkbQueryExtension(3), XOpenDisplay(3)


that's the whole page, bestie 🫢 β€” brought to you by X Version 11, libX11 1.8.14, and the XkbOpenDisplay(3) footer. mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from