I know more precisely when the annoying remaps is performed. It happens between the two initial calls to the GL texture creation function. It is definitely a new behaviour introduced by the SDL 2.0.4 library. Assuming a WM is present, it is not making any trouble. In case no WM is active, the window is reparented to the X root window which cause the lost of focus.
The initial patch is not waiting the second call to the GL texture before changing the window focus. This is resulting in loosing the focus again after the remmap is performed. Adding a delay is solving the issue but looks a very ugly path to solve this. Something better can be done here.
SDL 2.0.4
OpenGL: VBO supported
OpenGL: PBO supported
OpenGL: FBO supported
OpenGL: using vid filter: 1
GL texture: copy 1, shader 0, dynamic 1, 960x672 960x672 [RGB32, Equal: 1, Palette: 0,
scale 3x3, border 0, pitch 384,960/8192], bytes/pix 4
Reparented: 0xc00007 to 0x25d
Mapped : 0xc00007
Destroyed : 0xc00008
GL texture: copy 1, shader 0, dynamic 1, 960x672 960x672 [RGB32, Equal: 1, Palette: 0,
scale 3x3, border 0, pitch 384,960/8192], bytes/pix 4
SDL 2.0.3
OpenGL: VBO supported
OpenGL: PBO supported
OpenGL: FBO supported
OpenGL: using vid filter: 1
GL texture: copy 1, shader 0, dynamic 1, 960x672 960x672 [RGB32, Equal: 1, Palette: 0,
scale 3x3, border 0, pitch 384,960/8192], bytes/pix 4
GL texture: copy 1, shader 0, dynamic 1, 960x672 960x672 [RGB32, Equal: 1, Palette: 0,
scale 3x3, border 0, pitch 384,960/8192], bytes/pix 4