XtConvert(3)
π XtConvert(3) β XT COMPATIBILITY FUNCTIONS π
okay bestie, we're doing XtConvert and XtDirectConvert today, and honestly? these two are the invoke-a-resource-converter girlies of the X Toolkit Intrinsics world. they're legacy, they're iconic, and they still work, so let's get into it. no cap. π
β¨ NAME β¨
XtConvert, XtDirectConvert β invoke resource converters π¦
β¨ SYNTAX β¨
#include <X11/Intrinsic.h>
void XtConvert(Widget w, const char *from_type, XrmValuePtr from, const
char *to_type, XrmValuePtr to_return);
void XtDirectConvert(XtConverter converter, XrmValuePtr args, Cardinal
num_args, XrmValuePtr from, XrmValuePtr to_return);
like, literally copy that include line exactly, bestie, don't freestyle it π
β¨ ARGUMENTS β¨
here's the whole roster, alphabetically, no one left behind:
argsβ the argument list holding the extra arguments you need to actually pull off the conversion (oftenNULL, because sometimes you just don't need the extra β¨).converterβ the conversion procedure that's getting called. the main character, fr.fromβ the value that's about to get converted. glow-up incoming.from_typeβ the source type. where we're coming from, iykyk.num_argsβ how many extra arguments there are (often zero, so don't stress).to_typeβ the destination type. where we're going.to_returnβ returns the converted value. the whole point. πwβ the widget to use for additional arguments, if any are needed.
β¨ DESCRIPTION β¨
so XtConvert is the one that does the legwork: it looks up the type converter that's registered to convert from_type to to_type, computes any additional arguments that are needed, and then calls XtDirectConvert. easy. BUT β and this is the part you have to remember β XtConvert has been replaced by XtConvertAndStore. it's giving legacy, bestie. π
meanwhile XtDirectConvert is a little more efficient about it: it looks in the converter cache to see if this conversion procedure has already been called with the specified arguments. if it has, it just returns a descriptor for the information already sitting in the cache β slay, no wasted work. otherwise it calls the converter and enters the result into the cache. π«Ά
and here's the little detail that matters: before it calls the specified converter, XtDirectConvert sets the return value size to zero and the return value address to NULL. so to figure out whether the conversion actually succeeded, the client should check to_return.address for non-NULL. if it's not NULL, you ate. if it is, the conversion didn't happen. π
β οΈ also heads up:XtDirectConverthas been replaced byXtCallConverter. so if you're writing something new, maybe don't pick these. still valid, still documented, just... vintage. like a thrifted jacket that actually fits. π
β¨ SEE ALSO β¨
go read these next, they're the friend group:
XtAppAddConverter(3)XtStringConversionWarning(3)XtConvertAndStore(3)XtCallConverter(3)X Toolkit Intrinsics - C Language InterfaceXlib - C Language X Interface
and that's the whole page, bestie!! π this one comes from X Version 11, libXt 1.3.1, so when you see XtConvert(3) out in the wild, you know exactly where it came from. stay converting, stay iconic, mwah ππ§
π¦ where this page comes from
- alpine 3.22: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.23: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.24: libxt-doc 1.3.1-r0 Β· MIT
- arch rolling: libxt 1.3.1-1 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- Copyright 1993 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms