GLX/EGL are supposed to abstract exactly this away, this is a bad hack at best and might totally break stuff at worst.