Patch extracted from !649. No functional change, just provide some common helpers which would be useful when re-using xcb, for atom retrieval.
Would make !649 easier to review, and this has already had a few passes.