XtGetClassExtension(3)

πŸ’… XtGetClassExtension β€” a whole function, bestie, and it's iconic

okay so picture this: you're deep in X Toolkit Intrinsics (that's Xt, the section 3 library function vibe) and you need to find one specific class extension record. That's literally what XtGetClassExtension does. It's from the XT FUNCTIONS corner of the manual, and yes, it's giving "locate a class extension record." periodt. 🌸


✨ SYNTAX ✨

#include <X11/Intrinsic.h>

XtPointer XtGetClassExtension(WidgetClass object_class, Cardinal
       byte_offset, XrmQuark type, long version, Cardinal record_size);

like, that's the whole signature. memorize it or don't, she's not judging 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • object_class β€” the widget class that's holding the extension list we're about to go rummaging through. bestie, this is the class being searched. πŸ”
  • byte_offset β€” the offset in bytes from the base of the widget class to the extension field we're searching. it's the lil address math moment. ✨
  • type β€” the name of the class extension we're trying to locate. the one. the main character. πŸ‘‘
  • version β€” the minimum acceptable version of the class extension required for a match. so if it's older than this? not it. πŸ’€
  • record_size β€” the minimum acceptable length of the class extension record required for a match, or 0. yes, zero is allowed, she's flexible like that. 🌈

πŸ’– DESCRIPTION πŸ’–

So the list of extension records sitting at that specified offset in the specified widget_class? It gets searched. And what counts as a match, you ask? three things, and she's picky in the best way:

  1. a match on the specified type,
  2. a version greater than or equal to the specified version,
  3. a record size greater than or equal to the specified record_size β€” but only if record_size is nonzero. (zero = no size requirement, she's chill)

And then? XtGetClassExtension returns a pointer to a matching extension record, or NULL if no match is found. simple. elegant. slay. ✨

🚨 okay this part is IMPORTANT, no cap: the returned extension record is owned by the widget class and must not be modified or freed by the caller. Not your record, bestie, hands off. πŸ™ˆ The only exception is that it may possibly be modified by the widget class owner. That's it. That's the rule. πŸ’…

πŸ¦‹ SEE ALSO πŸ¦‹

  • X Toolkit Intrinsics - C Language Interface
  • Xlib - C Language X Interface

and that's the whole page, bestie!! πŸŽ€ this one's from X Version 11, shipping with libXt 1.3.1 β€” go forth and locate those class extension records responsibly, mwah πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from