Most programmers who write applications for X will use third party toolkits.
If you are interested in writing an application that uses X primitives directly without the use of a toolkit, you can use the Xlib interface, painful though it is.
The documentation for the Xlib interface can be found here:
O'Reilly & Associates have also made freely available online some of their classic X programming manuals. These are a bit older, dating from the X11R3, R4, or R5 eras, and the toolkit ones cover Xt-based toolkits which are no longer in widespread use for new applications, but much of the Xlib documentation still applies, it just doesn't cover all the new additions:
Xlib:
X Series Volume 2: Xlib Reference Manual (1989, covers X11R3)
X Series Volume 2: Xlib Reference Manual, 2nd Edition (1990, covers X11R4)
Xt & Xt-based toolkits:
X Series Volume 4: X Toolkit Intrinsics Programming Manual, 1st Edition (1990, covers X11R3)
X Series Volume 4: X Toolkit Intrinsics Programming Manual, 2nd Edition (1990, covers X11R4)
X Series Volume 4: X Toolkit Intrinsics Programming Manual, 3rd Edition (1993, covers X11R5)
X Series Volume 5: X Toolkit Intrinsics Reference Manual (1990, covers X11R4)
X Series Volumes 6A & 6B: Motif Programming & Reference Manuals
X Series Volumes 7A & 7B: XView Programming & Reference Manuals


