XTranslateCoordinates() XTranslateCoordinates()
Name
XTranslateCoordinates - change the coordinate system from one window to another.
Synopsis
Bool XTranslateCoordinates(display, src_w, dest_w, src_x, src_y, dest_x_return, dest_y_return, child_return)
Display *display;
Window src_w, dest_w;
int src_x, src_y;
int *dest_x_return, *dest_y_return;
Window *child_return;
Arguments
display Specifies a connection to an X server; returned from XOpenDisplay().
src_w Specifies the ID of the source window.
dest_w Specifies the ID of the frame of reference window.
src_x Specify the x and y coordinates within the source window.
src_y
dest_x_returReturn the translated x and y coordinates within the frame of reference window.
dest_y_return
child If the point is contained in a mapped child of the destination window, then that child ID is returned in child.
Returns
True if the two windows are on the same screen, else False.
Description
XTranslateCoordinates() translates coordinates from the frame of reference of one window to another.
XTranslateCoordinates() returns False and *dest_x_return and *dest_y_return are set to zero if src_w and dest_w are on different screens.
In addition, if the coordinates are contained in a mapped child of dest_w, then that child is returned in the child_return argument. When
src_w and frame_y are on the same screen, XTranslateCoordinates() returns True, sets *dest_x_return and *dest_y_return to the location of
the point relative to dest_w, and sets child_return to None.
This function should be avoided in most applications since it requires a roundtrip request to the server. Most applications benefit from
the window-based coordinate system anyway and don't need global coordinates. Window managers often need to perform a coordinate transfor-
mation from the coordinate space of one window to another, or unambiguously determine which subwindow a coordinate lies in. XTranslateCo-
ordinates() fulfills this need, while avoiding any race conditions by asking the server to perform this operation.
Errors
BadWindow
See Also
XGeometry, XParseGeometry().
Xlib - Standard Geometry XTranslateCoordinates()