---
name: "Tk_GetRootCoords"
section: "3"
platform: "linux"
package: "tk"
version: "8.6.16-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Tk_GetRootCoords"
---

# Tk\_GetRootCoords(3)

Compute root-window coordinates of window

```

```

## NAME

Tk\_GetRootCoords - Compute root-window coordinates of window

## SYNOPSIS

```
#include <tk.h>

Tk_GetRootCoords(tkwin, xPtr, yPtr)
```

## ARGUMENTS

- Tk\_Window *tkwin* (in)

  Token for window.

- int *\*xPtr* (out)

  Pointer to location in which to store root-window x-coordinate corresponding to left edge of *tkwin*'s border.

- int *\*yPtr* (out)

  Pointer to location in which to store root-window y-coordinate corresponding to top edge of *tkwin*'s border.

  ```

  ```

## DESCRIPTION

This procedure scans through the structural information maintained by Tk to compute the root-window coordinates corresponding to the upper-left corner of *tkwin*'s border.  If *tkwin* has no border, then **Tk\_GetRootCoords** returns the root-window coordinates corresponding to location (0,0) in *tkwin*. **Tk\_GetRootCoords** is relatively efficient, since it does not have to communicate with the X server.

## KEYWORDS

coordinates, root window
