Document the source with Doxygen.

Also, some minor changes done while auditing during documenting,
including fixes for:

- A file descriptor leak in the auth child (may DoS the screen).
- A race condition between querying display size and creating the
  window.