XtMakeGeometryRequest(3)

πŸ’– XtMakeGeometryRequest β€” the glow-up your widget's geometry has been waiting for πŸ’–

okay bestie, sit down, hydrate, because we're talking XT FUNCTIONS and specifically the two lil functions that let a widget politely ask its parent "hey… can i be bigger? can i move? pls?" β€” that's XtMakeGeometryRequest and XtMakeResizeRequest, and yes they are a matched set, they're giving duo energy, they're iconic.


✨ NAME ✨

XtMakeGeometryRequest, XtMakeResizeRequest β€” make geometry manager request πŸŽ€

like. that's the whole vibe. you're making a request. to the geometry manager. respect the hierarchy bestie.


🌸 SYNTAX 🌸

first things first, you gotta pull in the header, no cap:

#include <X11/Intrinsic.h>

then the two stars of the show:

XtGeometryResult XtMakeGeometryRequest(Widget w, XtWidgetGeometry
       *request, XtWidgetGeometry *reply_return);

XtGeometryResult XtMakeResizeRequest(Widget w, Dimension width,
       Dimension height, Dimension *width_return, Dimension
       *height_return);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • reply_return β€” this one hands you back the widget size you're actually allowed to have, okay? and plot twist: it can be NULL if the widget asking is just… not interested in dealing with XtGeometryAlmost. like, "don't tell me the compromise, i don't wanna hear it." valid honestly.
  • request β€” specifies the desired widget geometry. and when we say geometry we mean the whole package: size, position, border width, and stacking order. the full fit check. πŸ’…
  • w β€” specifies the widget that is making the request. the one with main character energy. the asker. ✨
  • width_return
  • height_return β€” these two return the allowed widget width and height. the compromise numbers. the "we can meet in the middle" numbers.

πŸ’… DESCRIPTION πŸ’…

okay so XtMakeGeometryRequest is out here doing different things depending on the condition, and we are going to go through every single one because we don't skip steps in this house:

  • If the widget is unmanaged, or the widget's parent is not realized, it just makes the changes and returns XtGeometryYes. no drama, no negotiation, slay. 🫢
  • If the parent is not a subclass of compositeWidgetClass, or the parent's geometry_manager is NULL, it issues an error. yeah. that's the bad timeline. not a vibe check you want to fail. 😭
  • If the widget's being_destroyed field is True, it returns XtGeometryNo. it's over, it's done, don't ask for a resize on your way out the door. πŸ’€
  • If the widget's x, y, width, height and border_width fields are all equal to the requested values, it returns XtGeometryYes β€” otherwise, it calls the parent's geometry_manager procedure with the given parameters. basically: if nothing would change, why bother the parent? icon behavior.
  • If the parent's geometry manager returns XtGeometryYes, and XtCWQueryOnly is not set in the request_mode, and the widget is realized, then XtMakeGeometryRequest calls the XConfigureWindow Xlib function to reconfigure the widget's window β€” setting its size, location, and stacking order as appropriate. three conditions bestie. all three. no shortcuts. ⭐
  • If the geometry manager returns XtGeometryDone, the change has been approved and actually has been done. in this case, XtMakeGeometryRequest does no configuring and returns XtGeometryYes. and heads up: XtMakeGeometryRequest never returns XtGeometryDone. never ever. it just doesn't. that's not its thing. 🚫

Otherwise, XtMakeGeometryRequest returns the resulting value from the parent's geometry manager. simple as that.

real talk though: children of primitive widgets are always unmanaged. so XtMakeGeometryRequest always returns XtGeometryYes when called by a child of a primitive widget. always. free yes. no negotiation arc. 🌈

🌟 the XtMakeResizeRequest part (the easy mode) 🌟

XtMakeResizeRequest is a simple interface to XtMakeGeometryRequest β€” it's the low-effort, high-reward version. what it does:

  • creates an XtWidgetGeometry structure
  • specifies that width and height should change

and listen β€” the geometry manager is free to modify any of the other window attributes (position or stacking order) to satisfy the resize request. it's got creative liberty. it's got range. 😌

so if the return value is XtGeometryAlmost, then width_return and height_return contain a compromise width and height. and if those are acceptable, the widget should immediately make an XtMakeResizeRequest and request that the compromise width and height be applied. immediately. don't be shy, don't wait around, go get your compromise. πŸ”₯

and if the widget is just not interested in XtGeometryAlmost replies? it can pass NULL for width_return and height_return. no thoughts, no return values, head empty. πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

go read these too bestie, they're in the group chat:

  • XtConfigureWidget(3)
  • XtQueryGeometery(3)
  • X Toolkit Intrinsics - C Language Interface
  • Xlib - C Language X Interface

that's the whole page!! and before you go β€” this was served up fresh from X Version 11, libXt 1.3.1, dated XtMakeGeometryRequest(3). πŸ’–βœ¨πŸŽ€ take care of your geometry, and remember: ask nicely, check your request_mode, and never expect XtGeometryDone back. mwah πŸ«ΆπŸŒΈπŸ§šπŸ’œ

πŸ“¦ where this page comes from