XtGetResourceList(3)

πŸ’– XtGetResourceList β€” the XT FUNCTIONS girlies πŸ’–

okay so bestie, welcome to the XtGetResourceList(3) page, part of the XT FUNCTIONS era of the X Toolkit Intrinsics. two functions, one vibe: they hand you back a whole resource list. let's get into it 🫢


✨ NAME ✨

XtGetResourceList, XtGetConstraintResourceList β€” obtain resource list. that's it, that's the job, and they ate πŸ’…


✨ SYNTAX ✨

#include <X11/Intrinsic.h>

void XtGetResourceList(WidgetClass class, XtResourceList
       *resources_return, Cardinal *num_resources_return);

void XtGetConstraintResourceList(WidgetClass class, XtResourceList
       *resources_return, Cardinal *num_resources_return);

yep, twin functions, literally identical signatures, the only glow-up difference is in the name. iconic behavior ✨


✨ ARGUMENTS ✨

  • num_resources_return β€” a pointer to where you want the number of entries in the resource list to get stored. she's the counter girlie πŸ“Š
  • resources_return β€” a pointer to where the returned resource list gets stored. major caveat bestie: the caller must free this storage using XtFree when they're done with it. do not ghost it, do not forget it, free your memory 🧚
  • widget_class β€” the widget class you want the list for. specify your girl πŸ‘‘

✨ DESCRIPTION ✨

okay so here's the tea on XtGetResourceList β˜•

if you call XtGetResourceList before the widget class is initialized (and by "initialized" we mean before the first widget of that class has even been created β€” yeah, timing matters), then XtGetResourceList returns the resource list as specified in the widget class record. plain, unmerged, straight from the source 🌸

but if you call it after the widget class has been initialized? then XtGetResourceList returns a merged resource list that contains the resources for all superclasses. the whole family tree showed up to the function call πŸ«‚

the list returned by XtGetResourceList should be freed using XtFree when it is no longer needed. free. your. list. no cap. πŸ’€

now for the constraint twin, XtGetConstraintResourceList πŸ’œ

if XtGetConstraintResourceList is called before the widget class is initialized (again: before the first widget of that class has been created), it returns the resource list as specified in the widget class Constraint part record. constraint-coded πŸ“

if it's called after the widget class has been initialized, XtGetConstraintResourceList returns a merged resource list that contains the Constraint resources for all superclasses. the constraint ancestors all pulled up 🧬

and here's the plot twist: if the specified class is not a subclass of constraintWidgetClass, then *resources_return is set to NULL and *num_resources_return is set to zero. not a constraint class? no list for you, bestie, the function said "not my problem" πŸ™ˆ

and yeah, the list returned by XtGetConstraintResourceList should also be freed using XtFree when it is no longer needed. both of them. every time. that's the rule πŸŽ€

✨ SEE ALSO ✨


and that's the whole page, bestie!! you now know how to obtain a resource list, both the regular kind and the constraint kind, and you know to XtFree that storage when you're done, which is honestly the most main character thing you can do for your memory management ✨

this page lives in X Version 11, libXt 1.3.1, and the manual it came from is the XT FUNCTIONS manual β€” so go forth, call your functions, free your lists, and slay πŸ’…πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from