XIQUERYVERSION(3)

✨ XIQUERYVERSION(3) ✨

okay bestie, welcome to the XIQUERYVERSION(3) page πŸ’– this one's all about saying hi to the server and finding out what XI2 version y'all are gonna vibe with. no cap.


🌸 NAME 🌸

XIQueryVersion β€” announce and query the support XI2 version. that's it, that's the whole gig 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <X11/extensions/XInput2.h>

Status XIQueryVersion( Display *display,
                       int *major_version_inout,
                       int *minor_version_inout);
  • display β€” the connection to the X server. your lil phone line to the server, basically πŸ“ž
  • major_version_inout β€” you put in the client's supported XI2 version, and it comes back holding the server's supported version. it's giving double duty πŸ’…
  • minor_version_inout β€” same deal, bestie: you specify the client's supported XI2 version and it returns the server's supported version.

πŸ’œ DESCRIPTION πŸ’œ

okay so XIQueryVersion announces the client's supported XI2 version to the server and hands back the server's supported X Input version. If you're using XI2 calls, you are required to use XIQueryVersion instead of XGetExtensionVersion. like, it's not optional, it's the law 🚨

The server may treat a client differently depending on the supported version the client announced. so yes, your version flex is being watched πŸ‘€

The major_version_inout must be 2 or greater, otherwise a BadValue error occurs. so don't try to be cute with a 1, it will not slay.

If the server does not support XI2, XIQueryVersion returns BadRequest to the client. Otherwise, XIQueryVersion returns Success. Either way β€” both cases, no exceptions β€” major_version_inout and minor_version_inout get set to the server's supported version. ✨

Now, if the client has previously called XIQueryVersion, the result depends on the previously requested version and the currently requested version. it's giving history lesson πŸ“š

  • If either the previous or current requested versions is less than 2.2, or if the requested major version numbers do not match, then consecutive calls to XIQueryVersion by the same client always return the first returned major.minor version. and if the client requests a version lower than the first returned major.minor version in a subsequent call, a BadValue error occurs. sorry bestie, no downgrades 🚫
  • If all of the requested versions are 2.2 or greater, then consecutive calls to XIQueryVersion by the same client with the same major version will return the requested version β€” but the server will operate according to the highest requested version number or the highest supported version, whichever is lower. the server lowkey takes the smaller one. periodt. πŸ‘‘
heads up: XIQueryVersion can generate a BadValue error. stay safe out there πŸ’€

πŸ¦‹ EXAMPLES πŸ¦‹

here's the whole vibe in code form, copy-paste energy:

int rc;
int major = 2;
int minor = 0;

rc = XIQueryVersion(dpy, &major, &minor);
if (rc == Success)
    printf("XI2 supported. (%d.%d)\n", major, minor);
else if (rc == BadRequest)
    printf("No XI2 support. (%d.%d only)\n", major, minor);
else
    printf("Internal error\n");

🩷 DIAGNOSTICS 🩷

  • BadValue β€” a value is outside of the permitted range. bestie you went out of bounds 😭

and that's the whole page! this iconic lil number is dated 05/18/2026 and it's serving XIQUERYVERSION(3) realness from the X11 crew πŸ’– go forth and query those versions, you absolute legend 🫢✨

πŸ“¦ where this page comes from