Missing VIDEOEXPOSE events with SDL_OPENGL on X11

I played around with SDL and OpenGL. I noticed that not SDL_VIDEOEXPOSE
events are generated when the SDL window is exposed because another
window that was obscuring the SDL window is moved away. I did get
SDL_VIDEOEXPOSE events if the window was moved, resized or

After some investigation it turned out that SDL seems to always enable
backing store if the X server supports it. Backing store prevents the X
server from generating Expose events because it silently restores
exposed parts from the backing store. Unfortunately this fails with
OpenGL. I guess the problem is that OpenGL uses direct rendering which
by-passes the X server causing the backing store to be out of sync.

Interestingly the parts enabling backing store were once dependent on
the environment variable SDL_VIDEO_X11_BACKINGSTORE but that check has
been #if 0’ed (not a recent change it was at least present in 1.2.9). I
have just reinstantiated this check (search for BackingStore in
video/x11/SDL_x11video.c) and everything works alright now.

Even if not using OpenGL it seems questionable to me wether backing
store is a win (see also the comment in the source code). Maybe the env
variable check should be reenabled?–