XtSetValues(3)

πŸ’– XtSetValues β€” the XT FUNCTIONS page, bestie edition πŸ’–

okay so. this is XtSetValues(3) from the X Toolkit Intrinsics, and it's literally the whole "get and set widget resources" saga. eight functions, one glow-up. let's go 🫢


✨ NAME ✨

XtSetValues, XtVaSetValues, XtSetSubvalues, XtVaSetSubvalues, XtGetValues, XtVaGetValues, XtGetSubvalues, XtVaGetSubvalues β€” obtain and set widget resources. that's the whole vibe. getters, setters, and their Va twins. πŸ’…


🌸 SYNTAX 🌸

#include <X11/Intrinsic.h>

void XtSetValues(Widget w, ArgList args, Cardinal num_args);

void XtVaSetValues(Widget w, ...);

void XtSetSubvalues(XtPointer base, XtResourceList resources, Cardinal
       num_resources, ArgList args, Cardinal num_args);

void XtVaSetSubvalues(XtPointer base, XtResourceList resources, Cardinal
       num_resources, ...);

void XtGetValues(Widget w, ArgList args, Cardinal num_args);

void XtVaGetValues(Widget w, ...);

void XtGetSubvalues(XtPointer base, XtResourceList resources, Cardinal
       num_resources, ArgList args, Cardinal num_args);

void XtVaGetSubvalues(XtPointer base, XtResourceList resources, Cardinal
       num_resources, ...);
not me including the header every single time. you need #include <X11/Intrinsic.h> before any of this, no cap. πŸ”₯

πŸŽ€ ARGUMENTS πŸŽ€

  • args β€” the argument list of name/address pairs. each one holds the resource name and either the address where the resource value gets stored, or the new value. yes it does both jobs depending on whether you're getting or setting. main character energy fr fr. πŸ‘‘
  • base β€” the base address of the subpart data structure where the resources should be retrieved or written. it's giving "here's where the sub-stuff lives". πŸ¦‹
  • num_args β€” how many arguments are in the argument list. the count. the receipts. πŸ’€
  • resources β€” the nonwidget resource list or values.
  • num_resources β€” how many resources are in that resource list. counting again, but for the other list. πŸ“
  • w β€” the widget. the moment. the icon. πŸ’…
  • ... β€” the variable argument list of name/address pairs that contain the resource name and either the address into which the resource value is to be stored or their new values. yeah it's the same deal as args, just unspooled into varargs. ✨

🌈 DESCRIPTION 🌈

πŸ’œ XtSetValues

XtSetValues starts with the resources specified for the Core widget fields and proceeds down the subclass chain to the widget. at each stage, it writes the new value (if one of the arguments specified it) or the existing value (if no new value was specified) to a new widget data record. then XtSetValues calls the set_values procedures for the widget in superclass-to-subclass order. and if the widget has any non-NULL set_values_hook fields, those get called immediately after the corresponding set_values procedure. that hook is how subclasses get to set nonwidget data for XtSetValues. 🫢

if the widget's parent is a subclass of constraintWidgetClass, XtSetValues also updates the widget's constraints. it starts with the constraint resources specified for constraintWidgetClass and proceeds down the subclass chain to the parent's class. at each stage it writes the new value or the existing value to a new constraint record. then it calls the constraint set_values procedures from constraintWidgetClass down to the parent's class. and here's the tea: the constraint set_values procedures are called with widget arguments β€” same as all set_values procedures, not just the constraint record arguments β€” so they can adjust the desired values using full information about the widget. iconic. 🌟

then XtSetValues figures out whether a geometry request is even needed by comparing the current widget to the new widget. if any geometry changes are required, it makes the request, and the geometry manager hands back one of XtGeometryYes, XtGeometryAlmost, or XtGeometryNo. so:

  • if XtGeometryYes β†’ XtSetValues calls the widget's resize procedure. slay. βœ…
  • if XtGeometryNo β†’ XtSetValues resets the geometry fields back to their original values. 🚫
  • if XtGeometryAlmost β†’ XtSetValues calls the set_values_almost procedure, which decides what should be done and writes new values for the geometry fields into the new widget. then XtSetValues repeats this whole process, deciding once more whether the geometry manager should be called. it loops, bestie. πŸ”

finally, if any of the set_values procedures returned True, XtSetValues causes the widget's expose procedure to be invoked by calling the Xlib XClearArea function on the widget's window. πŸ’₯

πŸ’œ XtSetSubvalues

XtSetSubvalues stores resources into the structure identified by base. that's it. short, sweet, to the point. πŸŽ€

πŸ’œ XtGetValues

XtGetValues starts with the resources specified for the core widget fields and proceeds down the subclass chain to the widget. the value field of a passed argument list should contain the address into which to store the corresponding resource value.

heads up bestie: it is the caller's responsibility to allocate and deallocate that storage according to the size of the resource representation type used within the widget. you own that memory. nobody's doing it for you. 😭

if the widget's parent is a subclass of constraintWidgetClass, XtGetValues then fetches the values for any constraint resources requested. it starts with the constraint resources specified for constraintWidgetClass and proceeds down to the subclass chain to the parent's constraint resources. and if the argument list contains a resource name that isn't found in any of the resource lists searched, the value at the corresponding address is not modified. quiet, untouched, unbothered. πŸ™ˆ

finally, if the get_values_hook procedures are non-NULL, they're called in superclass-to-subclass order after all the resource values have been fetched by XtGetValues. that's how a subclass provides nonwidget resource data to XtGetValues. ✨

πŸ’œ XtGetSubvalues

XtGetSubvalues obtains resource values from the structure identified by base. yes. mirror image of the subvalues setter. we love symmetry. πŸ¦‹


πŸ‘‘ SEE ALSO πŸ‘‘

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

and that's the page, bestie!! πŸ’– this one comes from X Version 11, the libXt 1.3.1 era, dated with XtSetValues(3) energy β€” so if you cite it, that's the source and the version, mwah. now go set some values. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from