Bugfix: Use DOM loaded event for TOC (Thanks TonyC)

See http://code.i3wm.org/i3-website/commit/?id=d8e239e6 for the original
commit for the i3 website. This one is for documentation built from git.
Fix t/158-wm_take_focus, it was not properly verifying events (Thanks TonyC)

See also http://cr.i3wm.org/patch/500 for TonyC’s patch. This version
reduces code duplication.
Bugfix: clear wm_size_hints if they are not set

Otherwise, we read random garbage. Found by the testsuite due to
t/185-scratchpad.t failing because a window was incorrectly recognized
as a floating window.
Maintain the _NET_CLIENT_LIST property

Add and update the _NET_CLIENT_LIST property on the root window to
better comply with ewmh standards.

Information on this property can be found here:
http://standards.freedesktop.org/wm-spec/latest/ar01s03.html

> These arrays contain all X Windows managed by the Window Manager.
> _NET_CLIENT_LIST has initial mapping order, starting with the oldest window.

fixes #1099
Dont set input focus and send WM_TAKE_FOCUS

If input focus is set by the window manager, it is not necessary to send
WM_TAKE_FOCUS because it has already taken focus.

http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

> The goal is to support window managers that want to assign the input
> focus to a top-level window in such a way that the top-level window
> either can assign it to one of its subwindows or can decline the offer
> of the focus. For example, a clock or a text editor with no currently
> open frames might not want to take focus even though the window
> manager generally believes that clients should take the input focus
> after being deiconified or raised.

Both setting input focus and sending WM_TAKE_FOCUS is effectively
setting focus on the window twice which is certainly against the spirit
of the spec, if not the letter.

fixes #1167
Move switch_mode to bindings.[ch]