Fixed a layering bug.

Previously, the focused window would be drawn above all windows regardless
of their layer. Now, the focused window is drawn at the correct level
compared to its peers.