Added a finer grained layering mechanism.

This doesn't change how the user sets layers manually, but allows focused
window to appear above other windows on the same layer. This allows newly
created windows to be put above their siblings, which is saner than
having to hunt them down.