"One size will fit all" is not the best programming paradigm ever. Actually, it's specifically because X suffered from this problem that we are changing to wayland. Wayland enforces as little as possible.
Some libs are provided, though, and you can write extensions to the protocol. Extensions that any compositor may, or may not support. Or may support with some other lib.