Better X11 and Wayland platform detection
Created by: kbrenneman
This is a combination of #101 and #102.
The first commit is the same as #101, with some tabs replaced with spaces.
The second commit is the same logic as in #102, by looking for the pointer to _XAllocID.