XtOffset(3)
β¨ XtOffset(3) β the XT FUNCTIONS girlies β¨
okay so bestie, we're deep in X Toolkit Intrinsics territory today π
this whole page lives in the XT FUNCTIONS section of the X manuals, and it's about three lil macros that do very specific math for you so you don't have to. let's get into it π«Ά
πΈ NAME πΈ
XtOffset, XtOffsetOf, XtNumber β these three cuties help you figure out the byte offset or the number of array elements. that's the whole job. they're little macro besties and they ate π
π SYNTAX π
first things first, you gotta pull in the header:
#include <X11/Intrinsic.h>
then here's the trio, exactly as they show up:
Cardinal XtOffset(Type pointer_type, Field field_name);
Cardinal XtOffsetOf(Type structure_type, Field field_name);
Cardinal XtNumber(ArrayVariable array);
not me obsessing over how clean that is π
π¦ ARGUMENTS π¦
arrayβ this one specifies a fixed-size array. that's it, that's the vibe β¨field_nameβ the name of the field you want the byte offset of. like, which lil member are we measuring from the start, bestie? πpointer_typeβ a type that's declared as a pointer to the structure. pointer energy only π₯structure_typeβ a type that's declared as a structure. regular struct vibes, no pointer here π
π DESCRIPTION π
okay so first up, XtOffset. the way that this macro is usually used is to determine the offset of various resource fields from the beginning of a widget π and the slay part? you can use it at compile time in static initializations. no runtime needed, she's built different.
then there's XtOffsetOf, and bestie, this one expands to a constant expression that gives you the offset in bytes to the specified structure member from the beginning of the structure. she's normally used to statically initialize resource lists, and she's more portable than XtOffset, which serves the same function. so like, same job, better travel bag π§³β¨
and finally XtNumber β this macro returns the number of elements in the specified argument lists, resources lists, and other counted arrays. she counts. that's her main character moment π
π SEE ALSO π
go read these next, fr fr:
XtGetResourceList(3)XtSetArg(3)X Toolkit Intrinsics - C Language InterfaceXlib - C Language X Interface
not me ending the page like a proper icon β this whole thing is from X Version 11, specifically libXt 1.3.1, and it's filed under XtOffset(3). mwah π periodt ππ
π¦ 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 (c) 1993, 1994 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms