It seems that the problem isn't the reparenting stuff. The attached patch for SDL-1.2.14 worked for me.
If anyone is interested, here is what happens: SDL creates two windows: FSwindow and WMwindow. FSwindow has the override redirect flag set, and WMwindow is ment to be managed by the wm for windowed mode. The actual drawing happens in SDL_Window. In windowed mode the SDL_Window is a child of WMwindow. As soon as the app requests full screen mode the SDL_Window is reparented into the FSwindow which then stretches the whole screen. The problem is that the WMwindow is also created and managed by dwm. As soon as the screen resolution is changed, dwm raises the bar and restacks all tiled windows (including the empty - thus black) WMwindow just below the bar. Now all managed windows are above the FSwindow. This also explains why full screen mode works when the resolution doesn't change, since then the stacking order of the windows stays and FSwindow is still on top. Thinking about this, another way to fix this problem would be to change all XRaiseWindow calls in dwm to restacking them just below the bar and never raising the bar. That way dwm would play nicely with other override redirect windows as well. I don't know if that would be worth it. -- Eckehard Berns
--- SDL-1.2.14/src/video/x11/SDL_x11modes.c~ 2012-01-11 17:38:21.138611142 +0100 +++ SDL-1.2.14/src/video/x11/SDL_x11modes.c 2012-01-11 17:30:52.906622687 +0100 @@ -968,6 +968,7 @@ x = (real_w - window_w)/2; y = (real_h - window_h)/2; XReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y); + XRaiseWindow(SDL_Display, FSwindow); /* FIXME: move the mouse to the old relative location */ XSync(SDL_Display, True); /* Flush spurious mode change events */ }