window: Defer focus setting until after paint
Commit 3dbf5038 tried to defer focus changes until after rendering is done. But it failed to do so, since the toplevel ::render handler is still before rendering of popups that are attached to that toplevel. To do this properly, we need to do it in the AFTER_PAINT frame clock phase.
Fixes: #3725 (closed)