Also not discussed - the wayland version implements a lot more features, comments, and boilerplate. The one in OP is 178 lines with comments and features basic window control.
It would be really interesting to see a Wayland version with equivalent functionally to the X one to get some idea of what the real difference is in complexity.