XMGETSECONDARYRESOURCEDATA(3)
π NAME π
XmGetSecondaryResourceData β bestie, this is the function that hands you the secondary widget resource data. like, the resource lore that the other functions don't tell you about. β¨
π¦ SYNOPSIS π¦
#include <Xm/Xm.h>
Cardinal XmGetSecondaryResourceData(
WidgetClass widget_class,
XmSecondaryResourceData **secondary_data_return);
πΈ DESCRIPTION πΈ
okay so listen. some Motif widget classes β and yes, Gadget, Text, and VendorShell are the named girlies here β have resources that are just... not reachable through XtGetResourceList and XtGetConstraintResourceList. like they're behind a velvet rope. π and the way to get the descriptions of those resources? you have to use XmGetSecondaryResourceData. no other way, periodt.
so when a widget class has these kinds of resources, this function gives you descriptions of them in one or more data structures. it takes a widget class argument and returns the number of those data structures that are associated with the widget class. and if that return value is greater than 0 (zero), it goes ahead and allocates + fills an array of pointers to the corresponding data structures. that array? it comes back to you at the address that is the value of the secondary_data_return argument. slay. π
now the type XmSecondaryResourceData is a pointer to a structure with two members that are actually useful to an application:
resourcesβ of typeXtResourceList. this is the list of the widget resources that you can't access usingXtfunctions.num_resourcesβ of typeCardinal. this is the length of thatresourceslist. π«
and here's the important part, bestie, do not skip this: if the return value is greater than 0 (zero), XmGetSecondaryResourceData allocates memory that the application must free. that's on you, not on it. use XtFree to free:
- the resource list in each structure (aka the value of the
resourcesmember) - the structures themselves
- and the array of pointers to the structures (the array whose address is
secondary_data_return)
π«Ά memory leak girlies, i'm looking at you. free all three. every time. no cap.
widget_class
specifies the widget class for which the secondary resource data is to be retrieved. tell it who you want the tea about. π
secondary_data_return
specifies a pointer to an array of XmSecondaryResourceData pointers to be returned by this function. and if the widget class has no secondary resource data β for example, if the value returned by the function is 0 (zero) β then this function returns no meaningful value for this argument. so like, don't go reading it. there's nothing there. π
π RETURN π
returns the number of secondary resource data structures associated with this widget class. that's it, that's the number. β¨
π§ EXAMPLE π§
here's the moment you've been waiting for β this example uses XmGetSecondaryResourceData to print the names of the secondary resources of the Motif Text widget, and then frees the data that the function allocated. she cleans up after herself. iconic.
XmSecondaryResourceData * block_array;
Cardinal num_blocks, i, j;
if (num_blocks = XmGetSecondaryResourceData (xmTextWidgetClass,
&block_array)) {
for (i = 0; i < num_blocks; i++) {
for (j = 0; j < block_array[i]->num_resources; j++) {
printf("%s\n", block_array[i]->resources[j].resource_name);
}
XtFree((char*)block_array[i]->resources);
XtFree((char*)block_array[i]);
}
XtFree((char*)block_array);
}
β and that's the whole page, bestie. every flag, every member, every XtFree, every vibe. mwah. π
kisses from the XmGetSecond...esourceData(library call) page π β that's the library call manual, and ngl there's no version or date printed down here to report, just the title and the manual name. so that's the sign-off: library call energy, no date given, still serving. ππ¦π
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms