GUI Console stays on top when unfocused
Describe the bug
This is a very old issue, seemingly affecting W7 only. Maybe not every W7, but for me is very annoying.
What happens is that when GUI console window was focused, and I click outside of it, or Alt-Tab to another program, the console has a chance (~10-20%) to stay on top of the z-order, obstructing the window I'm working with. Then I have to click the console again and my window again to make the console go down properly.
To reproduce
Though the bug stayed for years, I haven't found a way to reliably reproduce it. It always happens when least expected and cannot be repeated.
I have experimentally found how to fix it though. If I comment out the following 4 lines, the bug never happens: https://github.com/red/red/blob/48eb6f749d731806fe7322a7bf2af160de718ecc/environment/console/GUI/gui-console.red#L196-L199
I haven't identified which particular of these lines is the cause, as the testing takes weeks to be able to tell with certainty.
Expected behavior
When deactivated, console should not obstruct the other windows.
Platform version (please complete the following information)
All versions known to me, on W7.
I haven't seen this on Win10, and while Win7 is a low priority for this kind of thing, it makes sense that we should understand what's going on, as it may have other effects. e.g. main event loop and caret allocation interactions.
The caret face is a layered window. I guess it's related to the layered window issue on Win7. It cannot be used as a child window which mess up the z-order of windows.
Why a separate window for caret?
It's a child window on win8+ platform.
But why? It's just one box command in draw.
I don't want to redraw everything each time the caret blinking.