/* draw a string */ XDrawString(dpy, root, g, random()%wa.width, random()%wa.height, "Ooops!", strlen("Ooops!") );The parameters of XDrawStrings are: the display, the window to write to, the graphic context, the x and y coordinates, the string to write, and the number of character in the string.
Note that the x and y coordinates are not the coordinates of the upper-left point of the first character. Assuming each letter to be contained in a box, the x represent the leftmost x of the box that contains the first character of the string. The y is instead the coordinate of the feet of the characters. The image below shows three strings: the red crosses are centered in the x,y coordinates of each string.
It is clear that the second string actually goes below the y cooordinate, while the third string does not touch the y axis.
To compile, test, and install, see: testing and installing a new module