When we're reparented we'll get both unmapnotify and mapnotify. Eat both so the unmap notify doesn't confuse the normal event processing.
--- a/src/video/x11/SDL_x11window.c Thu Sep 27 13:52:07 2012 -0700
+++ b/src/video/x11/SDL_x11window.c Thu Sep 27 13:52:57 2012 -0700
@@ -1065,6 +1065,7 @@
XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
/* Wait to be mapped, filter Unmap event out if it arrives. */
+ XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow);
XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
/* Wait to be visible, or XSetInputFocus() triggers an X error. */