Tk_GetRootCoords(3tk)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ Tk_GetRootCoords ✨

okay bestie, so this one is from the Tk Library Procedures corner of the world β€” page name's Tk_GetRootCoords(3tk), and it's genuinely such a useful little function, iykyk πŸ’…


🌸 NAME 🌸

Tk_GetRootCoords β€” compute root-window coordinates of a window πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <tk.h>

Tk_GetRootCoords(tkwin, xPtr, yPtr)

πŸ’– ARGUMENTS πŸ’–

  • Tk_Window tkwin (in) β€” the token for the window, like its lil ID badge πŸͺͺ
  • int *xPtr (out) β€” pointer to the spot where you want the root-window x-coordinate stored, the one matching the left edge of tkwin's border πŸ‘ˆ
  • int *yPtr (out) β€” pointer to the spot where you want the root-window y-coordinate stored, the one matching the top edge of tkwin's border πŸ‘†

🌈 DESCRIPTION 🌈

So what this procedure does is scan through all the structural info that Tk is already keeping around and use it to compute the root-window coordinates that line up with the upper-left corner of tkwin's border. no cap, that's the whole vibe πŸ’«

And if tkwin has no border at all? Then Tk_GetRootCoords just hands you back the root-window coordinates corresponding to location (0,0) in tkwin. simple as that, periodt ✨

The other thing that's lowkey iconic about it: Tk_GetRootCoords is relatively efficient, because it does not have to communicate with the X server πŸƒβ€β™€οΈπŸ’¨ like, it just already knows. main character energy fr fr πŸ‘‘


πŸ’œ KEYWORDS πŸ’œ

coordinates, root window


and that's the whole page, bestie β€” straight from the Tk source, page Tk_GetRootCoords(3tk). go get those coordinates, you absolute icon πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from