XTranslateCoordinates()XTranslateCoordinates()NameXTranslateCoordinates – 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
dest_y_returof reference window.
child If the point is contained in a mapped child of the destina‐
tion window, then that child ID is returned in child.
Returns
True if the two windows are on the same screen, else False.
DescriptionXTranslateCoordinates() translates coordinates from the frame of refer‐
ence 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 argu‐
ment. When src_w and frame_y are on the same screen, XTranslateCoordi‐
nates() 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 coordi‐
nates. Window managers often need to perform a coordinate transforma‐
tion from the coordinate space of one window to another, or unambigu‐
ously determine which subwindow a coordinate lies in. XTranslateCoor‐
dinates() 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()