XMCONVERTUNITS(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

✨ XmConvertUnits ✨

okay bestie, so this one is a library call from the Xm family β€” yes, the Motif girlies are still thriving β€” and it's called XmConvertUnits. And what does it do? It takes a value in one unit type and converts it to another unit type. That's it. That's the whole job. It's giving unit conversion icon. πŸ’…


πŸŽ€ NAME πŸŽ€

XmConvertUnits β€” a function that converts a value in one unit type to another unit type. lowkey iconic, highkey necessary.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Xm/Xm.h>
int XmConvertUnits(
Widget widget,
int orientation,
int from_unit_type,
int from_value,
int to_unit_type);

🌸 DESCRIPTION 🌸

So XmConvertUnits converts the value and hands it right back to you as the return value from the function. no side quests, just math. ✨

For resources of type dimension or position, you can specify units using the syntax described in the XmNunitType resource of the XmPrimitive reference page. iykyk.

Now let's meet the parameters, one by one, bestie:

  • widget β€” specifies the widget for which the data is to be converted. it's the main character of the conversion, fr fr.
  • orientation β€” specifies whether the converter uses the horizontal or vertical screen resolution when performing the conversions. this parameter can have values of XmHORIZONTAL or XmVERTICAL. pick your vibe.
  • from_unit_type β€” specifies the current unit type of the supplied value. where you're coming from, emotionally.
  • from_value β€” specifies the value to be converted. the actual number, the star of the show. πŸ‘‘
  • to_unit_type β€” converts the value to the unit type specified. where you're going, bestie. glow up complete.

The parameters from_unit_type and to_unit_type can have the following values:

  • XmPIXELS β€” all values provided to the widget are treated as pixel values. this is the default for the resource. the og. the blueprint.
  • XmMILLIMETERS β€” all values provided to the widget are treated as millimeter values.
  • Xm100TH_MILLIMETERS β€” all values provided to the widget are treated as 1/100 of a millimeter. tiny tiny energy. 🧚
  • XmCENTIMETERS β€” all values provided to the widget are treated as centimeter values.
  • XmINCHES β€” all values provided to the widget are treated as inch values.
  • Xm1000TH_INCHES β€” all values provided to the widget are treated as 1/1000 of an inch.
  • XmPOINTS β€” all values provided to the widget are treated as point values. a point is a unit used in text processing applications and is defined as 1/72 of an inch. πŸ“
  • Xm100TH_POINTS β€” all values provided to the widget are treated as 1/100 of a point. a point is a unit typically used in text processing applications and is defined as 1/72 of an inch.
  • XmFONT_UNITS β€” all values provided to the widget are treated as normal font units. a font unit has horizontal and vertical components. these are the values of the XmScreen resources XmNhorizontalFontUnit and XmNverticalFontUnit. two components, two vibes, both valid. 🫢
  • Xm100TH_FONT_UNITS β€” all values provided to the widget are treated as 1/100 of a font unit. a font unit has horizontal and vertical components. these are the values of the XmScreen resources XmNhorizontalFontUnit and XmNverticalFontUnit.

πŸ’– RETURN πŸ’–

Returns the converted value. slay. ✨

But β€” and hear me out β€” if a NULL widget, incorrect orientation, or incorrect unit_type is supplied as parameter data, 0 (zero) is returned. so if you're getting a zero back and you're confused... bestie, check your inputs. 😭

not me passing a NULL widget and wondering why everything is 0... anyway. πŸ’€

XmPrimitive, XmSetFontUnits(3), and XmScreen(3). go read those too, they're part of the lore.


okay that's the whole page, bestie!! it's a library call from the Xm crew, and that's genuinely all the version/date tea the footer gave us β€” so consider this your cute lil sign-off. stay converting, stay slaying, and remember: units don't lie, but NULL widgets absolutely will. πŸ’œβœ¨πŸŽ€πŸ¦‹