CS 1.6 Linux: The hl_linux window gets locked in the desktop background, and it's sliced at the wrong resolution
Even though I haven't measured it, the size of the bugged window is probably the same as the size of my resolution in-game.
in-game: 640x480 desktop: 1366x768
I've been having this problem for a while. Sometimes when I tab out I get this:

It doesn't always happen though and that is weird to me. That's a picture of what happens exactly after I tab out. If I click focus on any of the other windows (steam, xterm), then the square containing the sliced visual gets "sent" to the background and it remains locked there... it's like it becomes part of the wallpaper, in the exact position that you are looking at in the picture. If I click in it, I'm unable to send input to the game because the keystrokes don't seem to be registered by the bugged out window, thus I cannot open the console and hit quit.
The other thing that happens is that the window disappears from the taskbar. I use jwm for the secondary X where I launch the game (it happens in my main X with xfce as well) and you can see there there's no item for the game's window. At that point I have to open a shell and kill the hl_linux process.

There's a way that I can get it to happen consistently. I happen to have some nearby 1.6 servers which are populated most of the day and it's actually sometimes difficult to get in, specially at night. So I wrote a little script that checks the servers periodically at a respectful interval, and if I luckily catch one of the servers with either 7/8/9 players, the program issues in the shell a: steam steam://connect/address:port. What happens in that case, is that if I happen to have the hl_linux process already running, and its window focused and in full screen, this command doesn't make the hl_linux process connect automatically. Instead, it opens the steam (not hl_linux's) server dialog for that specific server in the desktop and then handles focus out of full screen, to that server dialog, and there it enters join for you, which makes the hl_linux process actually connect to the server. When this happens, when the focus is given to steam in the desktop, the game's window bugs exactly like this too. And that I can get it to happen consistently.
What is the most probable root of this problem and a potential fix?
I use archlinux with linux-ck 4.5.4-1, + radeon xf86-video-ati 1:7.7.0-1 + xorg-server 1.18.3-1.
EDIT: Today it went even uglier when I applied the "Run in a window" option inside the game:

EDIT: A few days ago I tried using the catalyst driver instead of the opensource radeon diver (my card is not supported by amdgpu), and using catalyst I didn't have this problem once. However, the catalyst driver is a pain and not that much better.
When I was using Arch Linux with Enlightenment I didn't had that problem. Have you tried the thing about "killing compositors" on the Arch wiki ?
I don't use any compositor in my secondary X with jwm. I used to use xcompmgr on my main X but now that I use xfce4, which has its own compositor built-in, I don't. Anyway just to discard this, I went in and disabled compositing from xfce4 and it's still happening. This problem is so annoying I can't even talk about it without getting mad.
Ok so I've managed to overcome this problem by setting the environment variable SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 when launching hl.sh, I think you can set environment variables in steam's parameters too, but I launch the game manually.
This is just circumventing the problem though. The bug is still present and it's probably an sdl2 or xorg bug
you can set env variables in the game's launch config by using %command%.
Example:
SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command%