XRes(3)

🌸 XRes β€” the X-Resource extension client library 🌸

okay bestie, gather round, because today we're talking about XRes, aka the X-Resource extension client library, and it lives in the Library Functions Manual section of your life (that's section 3, for the girlies keeping track). this whole page is your little guide to the libXres 1.2.2 era, X Version 11 vibes, and it's giving "let me peek at what the X server is actually doing" energy. πŸ’…


✨ NAME ✨

XRes β€” the X-Resource extension client library, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

first things first, you gotta pull in the header:

#include <X11/extensions/XRes.h>

then we got two lil structs that are basically the main characters:

typedef struct {
     XID            resource_base;
     XID            resource_mask;
} XResClient;

typedef struct {
     Atom           resource_type;
     unsigned int   count;
} XResType;

and here's the whole function lineup, bestie, every single one:

Bool XResQueryExtension(Display *dpy, int *event_base_return, int
       *error_base_return);

Status XResQueryVersion(Display *dpy, int *major_version_return, int
       *minor_version_return);

Status XResQueryClients(Display *dpy, int *num_clients, XResClient
       **clients);

Status XResQueryClientResources(Display *dpy, XID xid, int *num_types,
       XResType **types);

Status XResQueryClientPixmapBytes(Display *dpy, XID xid, unsigned long
       *bytes);

πŸ¦‹ DESCRIPTION πŸ¦‹

so. X-Resource is an extension that lets a client ask the X server about how it's using its various resources. 🫢 and listen β€” do not confuse it with the X resource database access functions. different girl. totally different vibe. iykyk.

  • XResQueryExtension returns True if the XRes extension is available on the given display. and bestie, you must call XResQueryExtension before calling any other XRes function, because that's how you negotiate a compatible protocol version. if you don't? you get undefined behavior β€” XRes may or may not work, and honestly that's the scariest sentence on this whole page. 😭
  • XResQueryVersion returns True if the request succeeded, and the major and minor protocol versions the server supports come back in major_version_return and minor_version_return. slay.
  • XResQueryClients fills a list of clients of the given display. for each client it returns, inside the XResClient structure, a mask and a base value of the resources those clients are using. returns True on success or False on failure.
  • XResQueryClientResources fills a list of XResType structures, telling you for each resource type allocated by the client its name (as an Atom) and the number of resources of that type allocated. returns True on success or False on failure.
  • XResQueryClientPixmapBytes gives you, for resources of type PIXMAP, the total number of bytes allocated in the X server by the given client. returns True on success or False on failure. it's giving memory accountability, honestly. πŸ‘‘

πŸ’€ ERRORS πŸ’€

XResQueryClientResources and XResQueryClientPixmapBytes will both return BadValue if you pass them an illegal client identifier. so like... don't do that. πŸ™ˆ


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Mark Vojkovich, originally for The XFree86 Project Inc. we stan. ✨


🧚 STABILITY 🧚

okay so this is the part where i hold your hand, bestie: this API is considered experimental. the XRes library major revision may be incremented whenever incompatible changes are done to the API without notice. use with care. fr fr. πŸ’–

and that's the whole page, babe β€” written up as part of X Version 11, libXres 1.2.2, and printed right there in the XRes(3) corner of the manual. go forth and query those resources responsibly. periodt. πŸ’…πŸŽ€πŸ¦‹