Tk_CoordsToWindow(3)

πŸ’… Tk_CoordsToWindow(3) πŸ’…

okay bestie, welcome to the Tk_CoordsToWindow(3) page from the Tk Library Procedures manual. It's literally about finding the window that contains a point, and we're keeping every tiny detail intact. πŸ’–


✨ NAME ✨

Tk_CoordsToWindow β€” Find window containing a point. That's the whole name vibe, and honestly? Iconic. 🎯


🌸 SYNOPSIS 🌸

#include <tk.h>

Tk_Window
Tk_CoordsToWindow(rootX, rootY, tkwin)

πŸŽ€ ARGUMENTS πŸŽ€

  • int rootX (in) β€” the X-coordinate, measured in root window coordinates. πŸ“
  • int rootY (in) β€” the Y-coordinate, also in root window coordinates. πŸ“
  • Tk_Window tkwin (in) β€” a token for the window that identifies the application. πŸͺŸ

πŸ¦‹ DESCRIPTION πŸ¦‹

So Tk_CoordsToWindow locates the window that contains a given point. The point is specified in root coordinates with rootX and rootY β€” and important tea: if a virtual-root window manager is in use, then rootX and rootY are in the coordinate system of the virtual root window. πŸ’…

The return value from the procedure is a token for the window that contains the given point. If the point is not in any window, or if the containing window is not in the same application as tkwin, then NULL is returned. No cap. 🫢

The containing window is decided using the same rules that determine which window contains the mouse cursor: if a parent and a child both contain the point, then the child gets preference; and if two siblings both contain the point, then the highest one in the stacking order (i.e. the one that's visible on the screen) gets preference. It's giving sibling rivalry, but make it stacking order. πŸ‘‘

lowkey reminder: NULL is the answer when the point is in no window, or when the containing window belongs to a different application than tkwin. 🫑

πŸ”‘ KEYWORDS πŸ”‘

  • containing
  • coordinates
  • root window

signed off by Tk, bestie β€” this footer is giving source/version energy, and the date slot is a mystery because there isn't one, so I'm not inventing it. 🫢 This page is Tk_CoordsToWindow(3). ✨

πŸ“¦ where this page comes from