XQueryTree(3)
π NAME π
XQueryTree β query window tree information. She's the main character of XQueryTree(3), and she lives under the XLIB FUNCTIONS umbrella, iykyk π«Άβ¨
π SYNTAX π
Status XQueryTree(Display *display, Window w, Window *root_return,
Window *parent_return, Window **children_return, unsigned int
*nchildren_return);
π¦ ARGUMENTS π¦
children_returnβ this is where the list of children comes back to you, bestie. Literally the child list output. πdisplayβ specifies the connection to the X server. Your link to the X server, periodt.nchildren_returnβ returns the number of children. The count, the total, the βhow many are we talkingβ value.parent_returnβ returns the parent window. Your window's parent, delivered right here. πroot_returnβ returns the root window. The root window ID, slaying in its output slot.wβ specifies the window whose list of children, root, parent, and number of children you want to obtain. So yes, this is the window you're doing the whole tree-info vibe check on. πΈ
π DESCRIPTION π
Okay so the XQueryTree function returns the root ID, the parent window ID, a pointer to the list of children windows (NULL when there are no children), and the number of children in the list for the specified window. No cap, all of that comes back together. β¨
The children are listed in current stacking order, from bottom-most (first) to top-most (last). So first = bottom of the stack, last = top of the stack. That's the order, bestie, don't rearrange it. π¦
XQueryTree returns zero if it fails and nonzero if it succeeds. Simple vibe check: zero = nope, nonzero = yep. π
To free a non-NULL children list when it is no longer needed, use XFree. Clean up after yourself, iconic behavior only. π
XQueryTree can generate a BadWindow error.
π BUGS π
The bug note is literally: This really should return a screen *, not a root window ID. And honestly? Valid. π
π DIAGNOSTICS π
BadWindowβ A value for aWindowargument does not name a definedWindow.
β SEE ALSO β
XFree(3)XGetWindowAttributes(3)XQueryPointer(3)Xlib - C Language X Interface
mwah π sign-off time: this page is source X Version 11, version libX11 1.8.14, and the date? Not listed on this footer, bestie β no invented numbers, no fake date, just the facts with a bow on top πβ¨
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms