As I said, the first half of the issue is that GNUstep cannot find the
focused window while it is unmapped. So it deactivates itself.
This patch transfers the focus to another window in the
same GNUstep application before it is unmapped,
therefore, fixes the problem.
The second half of the problem is that after the unmapping,
window manager tends to actively find another window to focus on,
therefore, even GNUstep transfers the focus, it still loses it.
So there is nothing GNUstep can do about it.
It has to be fixed on window manager.
This patch works for me, but may need to improvement.