Logo Search packages:      
Sourcecode: xdotool version File versions  Download package

int xdo_get_window_location ( const xdo_t xdo,
Window  wid,
int *  x_ret,
int *  y_ret,
Screen **  screen_ret 
)

Get a window's location.

Parameters:
wid the window to query
x_ret pointer to int where the X location is stored. If NULL, X is ignored.
y_ret pointer to int where the Y location is stored. If NULL, X is ignored.
screen_ret Pointer to Screen* where the Screen* the window on is stored. If NULL, this parameter is ignored.

Definition at line 157 of file xdo.c.

References xdo::xdpy.

                                                                         {
  int ret;
  XWindowAttributes attr;
  ret = XGetWindowAttributes(xdo->xdpy, wid, &attr);
  if (ret != 0) {
    int x, y;
    Window unused_child;

    /* The coordinates in attr are relative to the parent window which isn't
     * likely to be the root window (screen), translate them. */
    XTranslateCoordinates(xdo->xdpy, wid, attr.root,
                          attr.x, attr.y, &x, &y, &unused_child);
    if (x_ret != NULL) {
      *x_ret = x;
    }

    if (y_ret != NULL) {
      *y_ret = y;
    }

    if (screen_ret != NULL) {
      *screen_ret = attr.screen;
    }
  }
  return _is_success("XGetWindowAttributes", ret == 0);
}


Generated by  Doxygen 1.6.0   Back to index